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 '-'.

View File

@@ -17,8 +17,8 @@ return {
always_divide_middle = false,
globalstatus = true,
refresh = {
statusline = 200,
tabline = 200,
statusline = 100,
tabline = 300,
winbar = 500,
events = {
"WinEnter",

View File

@@ -0,0 +1,32 @@
-- Plugin: obsidian-nvim/obsidian.nvim
-- Installed via store.nvim
return {
"obsidian-nvim/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
--ft = "markdown",
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
-- -- refer to `:h file-pattern` for more examples
-- "BufReadPre path/to/my-vault/*.md",
-- "BufNewFile path/to/my-vault/*.md",
-- },
event = { "BufReadPre " .. vim.fn.expand("~") .. "/Documents/Obsidian notes/**.md" },
opts = {
workspaces = {
{
name = "personal",
path = "~/Documents/Obsidian notes/Felix/",
},
-- {
-- name = "work",
-- path = "~/vaults/work",
-- },
},
legacy_commands = false,
conceallevel = 2,
-- see below for full list of options 👇
},
}

View File

@@ -14,12 +14,8 @@ return {
end,
},
},
{
"alex-popov-tech/store.nvim",
dependencies = {
"OXY2DEV/markview.nvim", -- optional, for pretty readme preview / help window
},
cmd = "Store",
opts = {
width = 1000,
@@ -54,21 +50,10 @@ return {
{ "MunifTanjim/nui.nvim", lazy = true }, -- dep of noice.nvim
{ "rcarriga/nvim-notify", lazy = true }, -- dep of noice.nvim
{
"echasnovski/mini.nvim",
"nvim-mini/mini.nvim",
lazy = true,
version = false,
},
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons", -- optional, but recommended
},
cmd = "Neotree",
lazy = true, -- neo-tree will lazily load itself
},
{
"gelguy/wilder.nvim",
lazy = true,
@@ -77,11 +62,18 @@ return {
modes = { ":", "/", "?" },
},
},
{ "OXY2DEV/markview.nvim", lazy = true, ft = "Markdown", cmd = "Markview", event = { "BufRead *.md" } },
{
"OXY2DEV/markview.nvim",
lazy = true,
ft = "Markdown",
-- keys = { "<leader>M", mode = { "n" }, "<cmd>Markview toggle<cr>", desc = "Toggle Markdown render" },
cmd = "Markview",
event = { "BufRead *.md" },
},
{
"norcalli/nvim-colorizer.lua",
lazy = true,
event = { "BufRead" },
event = { "BufReadPost" },
opts = {
"*",
css = { rgb_fn = true, hsl_fn = true },
@@ -191,4 +183,8 @@ return {
lazy = true,
cmd = { "Typr", "TyprStats" },
},
{
"ibhagwan/fzf-lua",
opts = {},
},
}

View File

@@ -6,8 +6,13 @@ return {
keys = {
{ "<leader><leader>", mode = { "n" }, "<cmd>Telescope smart_open<cr>", desc = "smart_open" },
{ "<leader>ff", mode = { "n" }, "<cmd>Telescope find_files<cr>", desc = "Find File" },
{ "<leader>fb", mode = { "n" }, "<cmd>Telescope buffers<cr>", desc = "Find Buffer" },
{ "<leader>fh", mode = { "n" }, "<cmd>Telescope help_tags<cr>", desc = "Find Help" },
{ "<leader>fs", mode = { "n" }, "<cmd>Telescope live_grep<cr>", desc = "Live Grep" },
{ "<leader>fw", mode = { "n" }, "<cmd>Telescope grep_string<cr>", desc = "Find string under cursor" },
{ "<leader>f", group = "Telescope" },
{ "<leader>fd", mode = { "n" }, "<cmd>Telescope lsp_document_symbols<cr>", desc = "Find LSP Symbols" },
{ "<leader>fr", mode = { "n" }, "<cmd>Telescope oldfiles<cr>", desc = "Open Recent File", remap = true },
},
cmd = { "Telescope" },
opts = {
@@ -58,9 +63,7 @@ return {
branch = "0.3.x",
lazy = true,
-- keys = { "<leader><leader>", "<cmd>Telescope smart_open<cr>", desc = "smart open" },
config = {
function() require("telescope").load_extension("smart_open") end,
},
config = function() require("telescope").load_extension("smart_open") end,
},
{ "nvim-lua/plenary.nvim", lazy = true },
{ "MunifTanjim/nui.nvim", lazy = true },
@@ -69,9 +72,7 @@ return {
-- faster and better matching than fzf
{
"nvim-telescope/telescope-fzy-native.nvim",
config = {
function() require("telescope").load_extension("fzy_native") end,
},
config = function() require("telescope").load_extension("fzy_native") end,
},
{ "kkharji/sqlite.lua", lazy = true },
}

View File

@@ -71,18 +71,6 @@ return {
{ "<leader>gsh", "<cmd>Gitsigns stage_hunk<cr>", desc = "Stage Hunk" },
{ "<leader>gu", "<cmd>Gitsigns undo_stage_hunk<cr>", desc = "Undo Stage Hunk" },
-- lsp and debugging
{
"<leader>i",
function() require("conform").format({ async = true }) end,
desc = "Auto format file with linter(?), also on F3",
},
{
"F3",
function() require("conform").format({ async = true }) end,
mode = "ni",
desc = "Auto format file with formatter",
},
{ "<leader>le", vim.diagnostic.open_float, desc = "Open diagnostic float" },
{ "<leader>K", desc = "Show definition" },
-- { "<Leader>d", group = "Debugging" },
@@ -257,6 +245,10 @@ return {
{ "q", desc = "quit undotree" },
{ "p", desc = "jump into undetree diff window" },
{ "<cr>", desc = "undo to this state" },
-- obsidian
{ "<leader>of", "<cmd>ObsidianFollowLink<cr>", desc = "follow Obsidian Link" },
{ "<leader>ob", "<cmd>ObsidianBackLinks<cr>", desc = "show backlinks" },
},
},
}