(neovim) move coding related components to extra loaded configuration

This commit is contained in:
Bartek Stalewski 2025-07-26 18:40:23 +02:00
parent 1d969481df
commit 86cf2fa9d4
No known key found for this signature in database
21 changed files with 185 additions and 156 deletions

View file

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

View file

@ -0,0 +1,63 @@
return {
{
"saghen/blink.cmp",
dependencies = {
"rafamadriz/friendly-snippets",
"L3MON4D3/LuaSnip",
},
event = "InsertEnter",
version = "*",
config = function()
require("blink.cmp").setup({
snippets = { preset = "luasnip" },
signature = { enabled = true },
appearance = {
use_nvim_cmp_as_default = false,
nerd_font_variant = "normal",
},
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {
cmdline = {
min_keyword_length = 2,
},
},
},
keymap = {
["<Enter>"] = { "accept", "fallback" },
["<Tab>"] = { "select_next", "fallback" },
["<S-Tab>"] = { "select_prev", "fallback" },
},
cmdline = {
enabled = false,
},
completion = {
menu = {
border = nil,
scrolloff = 1,
scrollbar = false,
draw = {
columns = {
{ "kind_icon" },
{ "label", "label_description", gap = 1 },
{ "kind" },
{ "source_name" },
},
},
},
documentation = {
window = {
border = nil,
scrollbar = false,
winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,EndOfBuffer:BlinkCmpDoc",
},
auto_show = true,
auto_show_delay_ms = 500,
},
},
})
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
}

View file

@ -0,0 +1,101 @@
return {
{
"williamboman/mason.nvim",
cmd = "Mason",
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
build = ":MasonUpdate",
opts = {
ensure_installed = {
"ansible-language-server",
"ansible-lint",
"lua-language-server",
"markdownlint-cli2",
"marksman",
"shfmt",
"stylua",
"terraform-ls",
"tflint",
"yaml-language-server",
"yamlfix",
"yamllint",
},
},
config = function(_, opts)
require("mason").setup(opts)
local mr = require("mason-registry")
local function ensure_installed()
for _, tool in ipairs(opts.ensure_installed) do
if mr.has_package(tool) then
local p = mr.get_package(tool)
if not p:is_installed() then
vim.notify("Mason: Installing " .. tool .. "...", vim.log.levels.INFO)
p:install():once("closed", function()
if p:is_installed() then
vim.notify("Mason: Successfully installed " .. tool, vim.log.levels.INFO)
else
vim.notify("Mason: Failed to install " .. tool, vim.log.levels.ERROR)
end
end)
end
else
vim.notify("Mason: Package '" .. tool .. "' not found", vim.log.levels.WARN)
end
end
end
if mr.refresh then
mr.refresh(ensure_installed)
else
ensure_installed()
end
end,
},
{
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("lint").linters_by_ft = {
markdown = { "markdownlint-cli2" },
terraform = { "terraform_validate" },
tf = { "terraform_validate" },
yaml = { "yamllint" },
}
local markdownlint = require("lint").linters["markdownlint-cli2"]
markdownlint.args = {
"--config",
vim.fn.stdpath("config") .. "/lua/config/global.markdownlint-cli2.yaml",
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
},
{
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = { "mason.nvim" },
config = function()
require("conform").setup({
formatters_by_ft = {
["terraform-vars"] = { "terraform_fmt" },
bash = { "shfmt" },
lua = { "stylua" },
markdown = { "markdownlint-cli2" },
sh = { "shfmt" },
terraform = { "terraform_fmt" },
tf = { "terraform_fmt" },
zsh = { "shfmt" },
yaml = { "yamlfix" },
},
format_on_save = {
lsp_fallback = true,
async = false,
},
})
end,
},
}