add niri and update nvim config

This commit is contained in:
fbachus
2026-01-22 22:54:47 +01:00
parent 8a6093de74
commit 3fdadd648b
208 changed files with 6922 additions and 255 deletions

View File

@@ -32,8 +32,8 @@ return {
"gdscript",
"lua",
"php",
"python",
"rust",
"python",
"typescript",
"vim",
},
@@ -46,39 +46,20 @@ return {
ensure_installed = {
"rust_analyzer",
"ruff",
"biome",
--"quick_lint_js",
--"eslint",
"html",
"cssls",
"gdscript",
"sqls",
"hyprls",
"lua_ls",
"ast-grep",
-- "pylyzer",
"vimls",
"ts_ls",
},
automatic_enable = { true, rust_analyzer = false },
},
config = function()
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
vim.keymap.set("n", "<leader>le", vim.diagnostic.open_float)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "<leader>K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set("n", "<leader>f", function() vim.lsp.buf.format({ async = true }) end, opts)
end,
})
end,
},
{
"neovim/nvim-lspconfig",
@@ -146,14 +127,14 @@ return {
vim.keymap.set("n", "<leader>K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set("n", "<leader>f", function() vim.lsp.buf.format({ async = true }) end, opts)
vim.keymap.set("n", "<leader>F", function() vim.lsp.buf.format({ async = true }) end, opts)
end,
})
end,
},
{
"mfussenegger/nvim-lint",
event = { "BufWritePre", "InsertLeave" },
event = { "BufEnter", "InsertLeave" },
lazy = true,
opts = {
linters_by_ft = {
@@ -161,8 +142,8 @@ return {
gdscript = { "gdlint" },
gitcommit = { "commitlint" },
lua = { "ast-grep" },
fish = { "fish_lsp" },
markdown = {},
fish = { "fish_lsp" },
sql = { "sqruff" },
python = { "ruff" },
r = { "r-languageserver" },
@@ -172,7 +153,7 @@ return {
},
config = function()
local lint = require("lint")
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave" }, {
callback = function() lint.try_lint() end,
})
end,
@@ -180,15 +161,22 @@ return {
-- supposedly faster formatter
{
"stevearc/conform.nvim",
lazy = true,
event = { "BufWritePre" },
--keys = { "<leader>i", "F3" },
opts = {
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = "*",
callback = function(args) require("conform").format({ bufnr = args.buf }) end,
}),
event = { "BufWritePost" },
keys = {
{
"<leader>i",
function() require("conform").format({ async = true }) end,
desc = "Auto format file with formatter, also on F3",
},
{
"F3",
function() require("conform").format({ async = true }) end,
mode = { "n", "i" },
desc = "Auto format file with formatter",
},
},
opts = {},
config = {
formatters_by_ft = {
lua = { "stylua" },
rust = { "rustfmt", lsp_format = "fallback" },
@@ -198,7 +186,6 @@ return {
bash = { "shellharden" },
javascript = { "biome" },
typescript = { "biome" },
markdown = { "prettier" },
r = { "air" }, -- how to make air use tabs not spaces
css = { "ast-grep" },
html = { "ast-grep" },
@@ -212,6 +199,10 @@ return {
lsp_format = "fallback",
},
log_level = vim.log.levels.WARNING,
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = "*",
callback = function(args) require("conform").format({ bufnr = args.buf }) end,
}),
function()
require("conform").formatters.prettier = {
inherit = true,
@@ -222,9 +213,13 @@ return {
command = "biome format",
prepend_args = "--indent-width=4 --use-editorconfig=true",
}
require("lua").formatters.stylua = {
require("conform").formatters.stylua = {
prepend = "--column-width=80",
}
require("conform").formatters.gdformat = {
command = "gdformat",
prepend_args = { "--fast {%}" },
}
end,
},
},
@@ -235,11 +230,11 @@ return {
event = "BufRead",
opts = {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 4, -- How many lines the window should span. Values <= 0 mean no limit.
max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 35, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
lazy = true,
multiline_threshold = 4, -- Maximum number of lines to show for a single context
multiline_threshold = 1, -- Maximum number of lines to show for a single context
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = "topline", -- Line used to calculate context. Choices: 'cursor', 'topline'.
-- Separator between context and content. Should be a single character string, like '-'.