aboutsummaryrefslogtreecommitdiff
path: root/nvim/lua
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2026-09-09 11:01:50 +0200
committerThomas Schmucker <ts@its1.de>2026-09-09 11:01:50 +0200
commit3803aada9e2c90a5147a86ba241750b1f06f001b (patch)
tree01d36da3229d6f1b6df4ff2a34ffe960ffc87f12 /nvim/lua
parent101c7b01c826d6f198c30073177e0ee81c0a1963 (diff)
parentdafb375026c30911dace5bd5d576d2f137f3c496 (diff)
downloaddotfiles-3803aada9e2c90a5147a86ba241750b1f06f001b.tar.gz
dotfiles-3803aada9e2c90a5147a86ba241750b1f06f001b.tar.bz2
dotfiles-3803aada9e2c90a5147a86ba241750b1f06f001b.zip
Merge branch 'add-ansible-support' into add-nvim-lint
Diffstat (limited to 'nvim/lua')
-rw-r--r--nvim/lua/config/filetypes.lua27
-rw-r--r--nvim/lua/config/treesitter.lua5
-rw-r--r--nvim/lua/plugins/lsp.lua15
3 files changed, 45 insertions, 2 deletions
diff --git a/nvim/lua/config/filetypes.lua b/nvim/lua/config/filetypes.lua
index 1b85053..0cb9036 100644
--- a/nvim/lua/config/filetypes.lua
+++ b/nvim/lua/config/filetypes.lua
@@ -1,7 +1,30 @@
1-- Custom Filetype-Erkennung fuer Dateien, die von der eingebauten Erkennung 1-- Custom Filetype-Erkennung fuer Dateien, die sich nicht allein anhand ihrer
2-- abweichen sollen. 2-- Endung unterscheiden lassen (z.B. Ansible-YAML vs. normales YAML).
3--
4-- "yaml.ansible" wird ausserdem in config.treesitter (Autocmd-Pattern) und in
5-- plugins/lsp.lua (ansiblels.filetypes) verwendet.
3 6
7-- Ansible-Dateien haben die Endung .yml/.yaml wie normales YAML und sind nur am
8-- Dateinamen bzw. am Pfad erkennbar. Die Patterns sind mit "$" verankert, damit
9-- Jinja-Templates (z.B. tasks/main.yml.j2) weiter als jinja gelten.
4vim.filetype.add({ 10vim.filetype.add({
11 filename = {
12 ["playbook.yml"] = "yaml.ansible",
13 ["playbook.yaml"] = "yaml.ansible",
14 ["site.yml"] = "yaml.ansible",
15 ["site.yaml"] = "yaml.ansible",
16 ["requirements.yml"] = "yaml.ansible",
17 ["requirements.yaml"] = "yaml.ansible",
18 },
19 pattern = {
20 [".*/roles/.*/tasks/.*%.ya?ml$"] = "yaml.ansible",
21 [".*/roles/.*/handlers/.*%.ya?ml$"] = "yaml.ansible",
22 [".*/tasks/.*%.ya?ml$"] = "yaml.ansible",
23 [".*/handlers/.*%.ya?ml$"] = "yaml.ansible",
24 [".*/group_vars/.*%.ya?ml$"] = "yaml.ansible",
25 [".*/host_vars/.*%.ya?ml$"] = "yaml.ansible",
26 [".*/playbooks/.*%.ya?ml$"] = "yaml.ansible",
27 },
5 extension = { 28 extension = {
6 j2 = "jinja", 29 j2 = "jinja",
7 }, 30 },
diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/config/treesitter.lua
index 5451c6d..8e4e4ba 100644
--- a/nvim/lua/config/treesitter.lua
+++ b/nvim/lua/config/treesitter.lua
@@ -37,6 +37,11 @@ local extra_filetypes = {
37 -- vim.treesitter.start() keinen Parser und die FileType-Autocmd feuert nicht. 37 -- vim.treesitter.start() keinen Parser und die FileType-Autocmd feuert nicht.
38 sh = "bash", 38 sh = "bash",
39 ps1 = "powershell", 39 ps1 = "powershell",
40
41 -- Zusammengesetzter Dateityp aus config.filetypes: den Parser loest Neovim
42 -- selbst am Punkt auf, der Eintrag sorgt aber fuer das Autocmd-Pattern --
43 -- Patterns splitten nicht, "yaml" wuerde fuer "yaml.ansible" nicht feuern.
44 ["yaml.ansible"] = "yaml",
40} 45}
41 46
42-- Macht die Parser der Filetypes ohne gleichnamigen Parser bekannt. 47-- Macht die Parser der Filetypes ohne gleichnamigen Parser bekannt.
diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua
index 46892b5..e0ad450 100644
--- a/nvim/lua/plugins/lsp.lua
+++ b/nvim/lua/plugins/lsp.lua
@@ -93,7 +93,22 @@ return {
93 }, 93 },
94 } 94 }
95 95
96 vim.lsp.config.ansiblels = {
97 filetypes = { "yaml.ansible" }, -- Erkennung: siehe config.filetypes
98 settings = {
99 ansible = {
100 validation = {
101 lint = {
102 enabled = true,
103 path = "ansible-lint",
104 },
105 },
106 },
107 },
108 }
109
96 vim.lsp.enable({ 110 vim.lsp.enable({
111 "ansiblels", -- npm install -g @ansible/ansible-language-server & (brew install ansible-lint, pkg install sysutils/py-ansible-lint)
97 "basedpyright", -- npm install -g basedpyright, brew install basedpyright 112 "basedpyright", -- npm install -g basedpyright, brew install basedpyright
98 "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck 113 "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck
99 "clangd", -- pkg install llvm 114 "clangd", -- pkg install llvm