Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .config/nvim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ For non-Qubes systems, either:
| Perl | perltidy |
| Python | black |
| Shell | shfmt |
| Terraform | terraform_fmt (shells out to the `terraform` CLI, installed via Mason) |
| TeX | tex-fmt |
| XML | xmlformatter |

Expand All @@ -695,9 +696,13 @@ For non-Qubes systems, either:
| Markdown | markdownlint |
| Python | mypy, pylint, ruff |
| Ruby/ERB | erb_lint |
| Terraform | tflint |

> All linters above are auto-installed by `mason-tool-installer.nvim`, the
> single source of truth for Mason tool provisioning.
>
> tflint runs with built-in rules by default; create a project-local
> `.tflint.hcl` (via `tflint --init`) to enable plugin rules.

</details>

Expand Down
4 changes: 4 additions & 0 deletions .config/nvim/lua/my/plugins/conform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ return {
"perl",
"python",
"sh",
"terraform",
"terraform-vars",
"tex",
"xml",
"yaml",
Expand All @@ -33,6 +35,8 @@ return {
perl = { "perltidy" },
python = { "black" },
sh = { "shfmt" },
terraform = { "terraform_fmt" },
["terraform-vars"] = { "terraform_fmt" },
tex = { "tex-fmt" },
xml = { "xmlformatter" },
yaml = { "prettier" },
Expand Down
13 changes: 10 additions & 3 deletions .config/nvim/lua/my/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,18 @@ local function setup_lsp_servers()
},
})
-- bashls, rust_analyzer, cssls, html, jsonls, yamlls, stylelint_lsp,
-- marksman: use defaults; capabilities are injected via the '*' config
-- above, and mason-lspconfig.automatic_enable picks them up after setup.
-- marksman, terraformls: use defaults; capabilities are injected via the
-- '*' config above, and mason-lspconfig.automatic_enable picks them up
-- after setup.
-- stylelint_lsp default filetypes include JS/TS which can duplicate ts_ls
-- diagnostics on mixed projects; restrict reactively if friction surfaces.
require("mason-lspconfig").setup()
-- tflint is excluded: nvim-lint already runs tflint via linters_by_ft, and
-- both paths produce identical diagnostics — double-reporting otherwise.
require("mason-lspconfig").setup({
automatic_enable = {
exclude = { "tflint" },
},
})
end

return {
Expand Down
3 changes: 3 additions & 0 deletions .config/nvim/lua/my/plugins/mason-tool-installer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ return {
"yamlls",
"stylelint_lsp",
"marksman",
"terraformls",

-- Formatters (from conform.lua formatters_by_ft — Mason registry names)
"stylua",
Expand All @@ -32,6 +33,7 @@ return {
"shfmt",
"tex-fmt",
"xmlformatter",
"terraform", -- ships the `terraform` CLI; conform's terraform_fmt shells to `terraform fmt -`

-- Linters (from nvim-lint.lua linters_by_ft — Mason registry names)
"revive",
Expand All @@ -42,6 +44,7 @@ return {
"pylint",
"ruff",
"erb-lint",
"tflint",
},
auto_update = false, -- install-missing only, no silent drift
run_on_start = true, -- async install on VimEnter
Expand Down
1 change: 1 addition & 0 deletions .config/nvim/lua/my/plugins/nvim-lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ return {
html = { "erb_lint" },
markdown = { "markdownlint" },
python = { "mypy", "pylint", "ruff" },
terraform = { "tflint" },
}

-- NOTE: by default, erb_lint cmd and args are expecting a
Expand Down
7 changes: 7 additions & 0 deletions .config/nvim/lua/my/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ return {
"diff",
"gitcommit",
"go",
"hcl",
"html",
"latex",
"lua",
"make",
"markdown",
"python",
"query",
"terraform",
"vim",
"vimdoc",
"yaml",
Expand Down Expand Up @@ -108,5 +110,10 @@ return {
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)

-- `.tfvars` files get filetype `terraform-vars` (Neovim 0.11+ builtin),
-- but no dedicated treesitter parser exists. Reuse the `terraform`
-- parser for highlighting/text-objects on those buffers.
vim.treesitter.language.register("terraform", "terraform-vars")
end,
}
14 changes: 14 additions & 0 deletions .config/nvim/lua/my/settings/filetypes.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- luacheck: globals vim

-- Filetype overrides. Loaded eagerly via `lua/my/settings/init.lua` so
-- detection is in place before the first buffer is read.

-- `.tf` files: Neovim's builtin detect.tf inspects content and falls back to
-- the legacy `tf` filetype on empty / comment-only buffers, which prevents
-- terraform-ls from attaching to fresh files. Force `terraform` unconditionally
-- (the `.tfvars` → `terraform-vars` mapping is unaffected and stays builtin).
vim.filetype.add({
extension = {
tf = "terraform",
},
})
1 change: 1 addition & 0 deletions .config/nvim/lua/my/settings/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require("my.settings.vim_env")
require("my.settings.vim_opt")
require("my.settings.vim_g")
require("my.settings.filetypes")