Compare commits

...

4 Commits

Author SHA1 Message Date
34c88f6fe6 debug bufferline and lsp 2025-10-20 03:05:59 +02:00
5f67b259c6 debug bufferline due to update 2025-08-20 10:20:04 +02:00
fbead62967 add nix lsp and formatter 2025-03-28 02:47:53 +01:00
Jérémie SALVI
3a6258ccf0 refactoring 2025-01-11 19:32:59 +01:00
8 changed files with 128 additions and 63 deletions

View File

@@ -4,16 +4,18 @@ if not ok then
return return
end end
--- Plugin options
local frappe = require("catppuccin.palettes").get_palette("frappe") local frappe = require("catppuccin.palettes").get_palette("frappe")
local opts = { local opts = {
options = { options = {
-- mode = "tabs", -- mode = "tabs",
separator_style = "slant", separator_style = "slant",
}, },
highlights = require("catppuccin.groups.integrations.bufferline").get({ -- highlights = require("catppuccin.groups.integrations.bufferline").get({
styles = { "italic", "bold" }, -- }),
custom = { highlights = require("catppuccin.special.bufferline").get_theme {
styles = { "italic", "bold" },
custom = {
all = { all = {
fill = { -- bg before buffer fill = { -- bg before buffer
fg = frappe.text, fg = frappe.text,
@@ -219,10 +221,9 @@ local opts = {
}, },
}, },
}, },
}), },
} }
--- Load plugin
bufferline.setup(opts) bufferline.setup(opts)
--- Override keymaps --- Override keymaps

View File

@@ -18,3 +18,4 @@ require("config/lsp/bash")
require("config/lsp/lua") require("config/lsp/lua")
require("config/lsp/web") require("config/lsp/web")
require("config/lsp/php") require("config/lsp/php")
require("config/lsp/nix")

View File

@@ -20,16 +20,20 @@ lspconfig.ansiblels.setup({
}) })
mason_tool_installer.setup({ mason_tool_installer.setup({
ensure_installed = { "ansible-lint" }, ensure_installed = {
"ansible-lint",
"prettier",
},
}) })
conform.setup({ conform.setup({
formatters_by_ft = { formatters_by_ft = {
yaml = { "ansible-lint" }, yaml = { "prettier" },
yml = { "prettier" },
}, },
format_on_save = { format_on_save = {
async = false, async = false,
timeout_ms = 500, timeout_ms = 2000,
lsp_format = "fallback", lsp_format = "fallback",
}, },
}) })
@@ -43,6 +47,7 @@ vim.keymap.set({ "n", "v" }, "<leader>lf", function()
end, { desc = "Format" }) end, { desc = "Format" })
lint.linters_by_ft = { lint.linters_by_ft = {
yaml = { "ansible-lint" },
yml = { "ansible-lint" }, yml = { "ansible-lint" },
} }

View File

@@ -7,18 +7,15 @@ local ok, mason_lspconfig, mason_tool_installer, lspconfig, conform, lint = pcal
end) end)
if not ok then if not ok then
return return
end end
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = { "lua_ls" }, ensure_installed = { "lua_ls", },
}) })
mason_tool_installer.setup({ vim.lsp.config("lua_ls", {
ensure_installed = { "stylua", "luacheck" }, cmd = { "lua-language-server" },
})
lspconfig.lua_ls.setup({
-- capabilities = cmp_nvim_lsp.default_capabilities() -- capabilities = cmp_nvim_lsp.default_capabilities()
capabilities = require("config/lsp/lsp-capabilities"), capabilities = require("config/lsp/lsp-capabilities"),
on_attach = require("config/lsp/lsp-attach"), on_attach = require("config/lsp/lsp-attach"),
@@ -38,6 +35,11 @@ lspconfig.lua_ls.setup({
}, },
}, },
}) })
vim.lsp.enable('lua_ls')
mason_tool_installer.setup({
ensure_installed = { "stylua", "luacheck" },
})
conform.setup({ conform.setup({
formatters_by_ft = { formatters_by_ft = {

56
lua/config/lsp/nix.lua Normal file
View File

@@ -0,0 +1,56 @@
local ok, lspconfig, conform, lint = pcall(function()
return require("lspconfig"), require("conform"), require("lint")
end)
if not ok then
return
end
lspconfig.nixd.setup({
-- capabilities = cmp_nvim_lsp.default_capabilities()
capabilities = require("config/lsp/lsp-capabilities"),
on_attach = require("config/lsp/lsp-attach"),
settings = {
nixd = {
nixpkgs = {
expr = "import <nixpkgs> { }",
},
formatting = {
command = { "nixfmt" },
},
},
},
})
conform.setup({
formatters_by_ft = {
nix = { "nixfmt" },
},
format_on_save = {
async = false,
timeout_ms = 500,
lsp_format = "fallback",
},
})
vim.keymap.set({ "n", "v" }, "<leader>lf", function()
conform.format({
async = false,
timeout_ms = 500,
lsp_format = "fallback",
})
end, { desc = "Format" })
lint.linters_by_ft = {
lua = { "luacheck" },
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>ll", function()
lint.try_lint()
end, { desc = "Lint" })

View File

@@ -13,7 +13,7 @@ end
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = { ensure_installed = {
"intelephense", "intelephense",
"phpactor", --- "phpactor",
}, },
}) })

View File

@@ -1,7 +1,7 @@
--- Ensure plugin is avaiable --- Ensure plugin is avaiable
local ok, nvimtree = pcall(require, "nvim-tree") local ok, nvimtree = pcall(require, "nvim-tree")
if not ok then if not ok then
return return
end end
--- Unload netrw --- Unload netrw
@@ -10,32 +10,32 @@ vim.g.loaded_netrwPlugin = 1
--- Plugin options --- Plugin options
local opts = { local opts = {
sort = { sort = {
-- sorter = "case_sensitive", -- sorter = "case_sensitive",
}, },
view = { view = {
width = 30, width = 30,
}, },
renderer = { renderer = {
group_empty = true, group_empty = true,
indent_markers = { indent_markers = {
enable = true, enable = true,
}, },
icons = { icons = {
glyphs = { glyphs = {
folder = { folder = {
arrow_closed = "", -- arrow when folder is closed arrow_closed = "", -- arrow when folder is closed
arrow_open = "", -- arrow when folder is open arrow_open = "", -- arrow when folder is open
}, },
}, },
}, },
}, },
filters = { filters = {
dotfiles = false, dotfiles = false,
}, },
diagnostics = { diagnostics = {
enable = true, enable = true,
}, },
} }
--- Load plugin --- Load plugin

View File

@@ -1,21 +1,21 @@
return { return {
"williamboman/mason.nvim", "williamboman/mason.nvim",
dependencies = { dependencies = {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim",
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
{ {
"stevearc/conform.nvim", "stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
}, },
{ {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
}, },
}, },
}, },
}, },
} }