nvim config update

This commit is contained in:
Never Gude 2026-01-19 13:44:27 +01:00
parent 44d00ebb21
commit 66b146e4b5
3 changed files with 34 additions and 27 deletions

View file

@ -58,6 +58,9 @@ vim.keymap.set({ "n" }, "<A-j>", "<C-w>j")
vim.keymap.set({ "n" }, "<A-k>", "<C-w>k")
vim.keymap.set({ "n" }, "<A-l>", "<C-w>l")
vim.keymap.set('n', '<leader>ld', vim.lsp.buf.definition, { desc = 'vim.lsp.buf.definition()' })
vim.keymap.set('n', '<leader>lf', vim.lsp.buf.format, { desc = 'vim.lsp.buf.format()' })
-- [[ Basic Autocommands ]].
-- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()`
-- Highlight when yanking (copying) text.
@ -134,14 +137,14 @@ vim.filetype.add({
})
-- Install nvim-treesitter
vim.pack.add({"https://github.com/nvim-treesitter/nvim-treesitter"})
vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" })
require("nvim-treesitter").install('latex', 'lua', 'c', 'ocaml')
-- See `:h lsp-quickstart` for more details.
vim.pack.add({"https://github.com/mason-org/mason.nvim"})
vim.pack.add({ "https://github.com/mason-org/mason.nvim" })
require("mason").setup()
vim.lsp.enable({'lua_ls', 'texlab', 'clangd', 'ocaml-lsp'})
vim.lsp.enable({ 'lua_ls', 'texlab', 'clangd', 'ocaml-lsp' })
vim.diagnostic.config({
@ -156,11 +159,11 @@ vim.diagnostic.config({
virtual_text = true, -- Show inline diagnostics
})
vim.keymap.set("n", "<leader>dn", "]d", {desc = "Jump to next diagnostic"})
vim.keymap.set("n", "<leader>dp", "[d", {desc = "Jump to previous diagnostic"})
vim.keymap.set("n", "<leader>dN", "]D", {desc = "Jump to last diagnostic"})
vim.keymap.set("n", "<leader>dP", "[D", {desc = "Jump to first diagnostic"})
vim.keymap.set("n", "<leader>ds", "<C-w>d", {desc = "Display diagnostic on current line"})
vim.keymap.set("n", "<leader>dn", "]d", { desc = "Jump to next diagnostic" })
vim.keymap.set("n", "<leader>dp", "[d", { desc = "Jump to previous diagnostic" })
vim.keymap.set("n", "<leader>dN", "]D", { desc = "Jump to last diagnostic" })
vim.keymap.set("n", "<leader>dP", "[D", { desc = "Jump to first diagnostic" })
vim.keymap.set("n", "<leader>ds", "<C-w>d", { desc = "Display diagnostic on current line" })
-- [[ UI Configuration ]]
vim.pack.add({
@ -181,6 +184,11 @@ vim.o.winborder = "none"
-- Use mini.completion
require("mini.completion").setup()
local imap_expr = function(lhs, rhs)
vim.keymap.set('i', lhs, rhs, { expr = true })
end
imap_expr('<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]])
imap_expr('<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]])
-- Snipped integration for mini.completion
require("mini.snippets").setup()
@ -205,11 +213,11 @@ miniclue.setup({
{ mode = { "n", "x" }, keys = "<Leader>" },
-- `[` and `]` keys
{ mode = "n", keys = "[" },
{ mode = "n", keys = "]" },
{ mode = "n", keys = "[" },
{ mode = "n", keys = "]" },
-- Built-in completion
{ mode = "i", keys = "<C-x>" },
{ mode = "i", keys = "<C-x>" },
-- `g` key
{ mode = { "n", "x" }, keys = "g" },
@ -223,7 +231,7 @@ miniclue.setup({
{ mode = { "i", "c" }, keys = "<C-r>" },
-- Window commands
{ mode = "n", keys = "<C-w>" },
{ mode = "n", keys = "<C-w>" },
-- `z` key
{ mode = { "n", "x" }, keys = "z" },
@ -252,18 +260,17 @@ miniclue.setup({
-- Use and configure mini.hipatterns
local hipatterns = require('mini.hipatterns')
hipatterns.setup({
highlighters = {
-- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' },
hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' },
todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' },
note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' },
highlighters = {
-- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' },
hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' },
todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' },
note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' },
-- Highlight hex color strings (`#rrggbb`) using that color
hex_color = hipatterns.gen_highlighter.hex_color(),
},
-- Highlight hex color strings (`#rrggbb`) using that color
hex_color = hipatterns.gen_highlighter.hex_color(),
},
})
-- Use mini.notify
require("mini.notify").setup()