From 4829b3f7720ad7953690bdefa559fda3a32a6518 Mon Sep 17 00:00:00 2001 From: filip <“filip.rabiega@gmail.com”> Date: Sat, 14 Feb 2026 12:11:31 +0100 Subject: new stuff --- .config/nvim/init.lua | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to '.config/nvim/init.lua') diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 2c7e130..e4a910c 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -74,7 +74,6 @@ vim.opt.completeopt = { "menuone", "noinsert" } ------------------------------------------------------------ -- Clipboard and mouse ------------------------------------------------------------ -vim.opt.clipboard:append("unnamedplus") vim.opt.mouse = "a" ------------------------------------------------------------ @@ -168,9 +167,6 @@ end -- Delete char before cursor + char under cursor map("n", "", "dBx", { desc = "Delete char before + under cursor" }) --- Insert blank line below current line and center view -map("n", "s", "okzz", { desc = "Insert blank line below + center" }) - -- Start substitute on current line (pre-filled :%s//g) map("n", "S", ":%s//g", { silent = false, desc = "Substitute on current line" }) -- Note: silent = false because it enters command-line mode @@ -198,12 +194,40 @@ map("n", "", "", { desc = "Toggle last / alternate buffer" }) -- Split window vertically map("n", "vv", "v", { desc = "Split the current window vertically" }) +-- Insert blank line below current line and center view +map("n", "o", "okzz", { desc = "Insert blank line below + center" }) + -- Pressing h will prompt for a help topic and open it in vsplit map("n", "h", ":vert help ", { desc = "Open help vertically" }) -- Open messages in vplit map("n", "m", ":vnew | put =execute('messages')", { desc = "Open messages in vsplit" }) +-- Explain diagnostics +map("n", "de", ":lua vim.diagnostic.open_float()", { desc = "Explain diagnostics" }) + +-- Go to the next diagnostic +map("n", "dn", ":lua vim.diagnostic.goto_next()", { desc = "Go to the next diagnostic" }) + +-- Go to the previous diagnostic +map("n", "dp", ":lua vim.diagnostic.goto_prev()", { desc = "Go to the previous diagnostic" }) + +-- Open diagnostics locations +map("n", "dl", ":lua vim.diagnostic.setqflist()", { desc = "Open diagnostics locations" }) + +-- Toggle diagnostics +map("n", "dt", function() + local is_enabled = vim.diagnostic.is_enabled() + vim.diagnostic.enable(not is_enabled) + + -- Print a small message so you know the state + if not is_enabled then + print("Diagnostics Enabled") + else + print("Diagnostics Disabled") + end +end, { desc = "Toggle diagnostics" }) + -- Repeat action on visual block map("v", ".", ":normal .", { desc = "Repeat action on visual block" }) @@ -216,6 +240,16 @@ map("n", "", ":resize -2", { desc = "Decrease window height" }) map("n", "", ":vertical resize +2", { desc = "Increase window width" }) map("n", "", ":vertical resize -2", { desc = "Decrease window width" }) +-- Create a custom user command to restart LSP +vim.api.nvim_create_user_command("LspRestart", function() + local clients = vim.lsp.get_clients() + for _, client in ipairs(clients) do + vim.lsp.stop_client(client.id) + end + vim.cmd("edit") -- Re-opens the file to trigger LSP start + print("LSP Restarted") +end, {}) + ------------------------------------------------------------ -- Tabs & indentation ------------------------------------------------------------ -- cgit v1.2.3