(neovim) add git, yaml, ansible and helm support; minor fixes

This commit is contained in:
Bartek Stalewski 2025-07-25 00:52:15 +02:00
parent 79d83fd921
commit a71684c7f0
No known key found for this signature in database
9 changed files with 49 additions and 14 deletions

View file

@ -0,0 +1,4 @@
return {
cmd = { "ansible-language-server", "--stdio" },
filetypes = { "yaml.ansible" },
}

View file

@ -0,0 +1,4 @@
return {
cmd = { "helm_ls", "serve" },
filetypes = { "helm" },
}

View file

@ -0,0 +1,4 @@
return {
cmd = { "yaml-language-server", "--stdio" },
filetypes = { "yaml" },
}

View file

@ -2,6 +2,10 @@ vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
local map = vim.keymap.set
local nomap = vim.keymap.del
nomap("n", "[D")
nomap("n", "]D")
local diagnostic_goto = function(next, severity)
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
@ -19,12 +23,12 @@ end, { expr = true, desc = "Escape and Clear hlsearch" })
map("i", "<C-a>", "<esc>I")
map("i", "<C-e>", "<esc>A")
map("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" })
map("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" })
map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" })
map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" })
map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" })
map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" })
map("n", "]d", diagnostic_goto(true), { desc = "next diagnostic" })
map("n", "[d", diagnostic_goto(false), { desc = "prev diagnostic" })
map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "next error" })
map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "prev error" })
map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "next warning" })
map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "prev warning" })
map("v", "<leader>/", "gc", { desc = "toggle comments", remap = true })
@ -73,7 +77,7 @@ end, { desc = "grep", remap = true })
map("n", "<leader>hc", function()
Snacks.picker.command_history()
end, { desc = "commands", remap = true })
map("n", "<leader>hn", "<cmd>Noice<CR>", { desc = "notifications", remap = true })
map("n", "<leader>hn", "<cmd>messages<CR>", { desc = "notifications", remap = true })
map("n", "<leader>hs", function()
Snacks.picker.search_history()
end, { desc = "search", remap = true })

View file

@ -1,7 +1,10 @@
vim.lsp.enable({
"ansible",
"helm",
"lua",
"terraform",
"markdown",
"yaml",
})
vim.diagnostic.config({

View file

@ -0,0 +1,4 @@
return {
"mfussenegger/nvim-ansible",
ft = { "yaml.ansible" },
}

View file

@ -6,14 +6,18 @@ return {
build = ":MasonUpdate",
opts = {
ensure_installed = {
"ansible-language-server",
"ansible-lint",
"lua-language-server",
"markdown-toc",
"markdownlint-cli2",
"marksman",
"shfmt",
"stylua",
"terraform-ls",
"tflint",
"yaml-language-server",
"yamlfix",
"yamllint",
},
},
config = function(_, opts)
@ -54,12 +58,13 @@ return {
markdown = { "markdownlint-cli2" },
terraform = { "terraform_validate" },
tf = { "terraform_validate" },
yaml = { "yamllint" },
}
local markdownlint = require("lint").linters["markdownlint-cli2"]
markdownlint.args = {
"--config",
"/Users/f/.config/nvim-ftpd/linters/global.markdownlint-cli2.yaml",
vim.fn.stdpath("config") .. "/cfg_linters/global.markdownlint-cli2.yaml",
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
@ -84,11 +89,12 @@ return {
terraform = { "terraform_fmt" },
tf = { "terraform_fmt" },
zsh = { "shfmt" },
yaml = { "yamlfix" },
},
format_on_save = {
lsp_fallback = true,
async = false,
},
-- format_on_save = {
-- lsp_fallback = true,
-- async = false,
-- },
})
end,
},

View file

@ -7,17 +7,23 @@ return {
ensure_installed = {
"bash",
"diff",
"git_config",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore",
"gotmpl",
"hcl",
"helm",
"json",
"lua",
"markdown",
"markdown_inline",
"markdown",
"python",
"regex",
"terraform",
"vim",
"yaml",
},
highlight = { enable = true },
indent = { enable = true },