diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-02-14 12:11:31 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-02-14 12:11:31 +0100 |
| commit | 4829b3f7720ad7953690bdefa559fda3a32a6518 (patch) | |
| tree | c424b391a1c9ac6585d46be51e5072ee7d51de2c /.config/nvim | |
| parent | e5f3e6f06280f80d1dcff57f9ad654b7cf53e65b (diff) | |
| download | dotfiles-4829b3f7720ad7953690bdefa559fda3a32a6518.tar.gz dotfiles-4829b3f7720ad7953690bdefa559fda3a32a6518.tar.bz2 dotfiles-4829b3f7720ad7953690bdefa559fda3a32a6518.zip | |
new stuff
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/init.lua | 42 |
1 files changed, 38 insertions, 4 deletions
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", "<BS>", "dBx", { desc = "Delete char before + under cursor" }) --- Insert blank line below current line and center view -map("n", "s", "o<Esc>kzz", { desc = "Insert blank line below + center" }) - -- Start substitute on current line (pre-filled :%s//g) map("n", "S", ":%s//g<Left><Left>", { silent = false, desc = "Substitute on current line" }) -- Note: silent = false because it enters command-line mode @@ -198,12 +194,40 @@ map("n", "<Tab><Tab>", "<C-^>", { desc = "Toggle last / alternate buffer" }) -- Split window vertically map("n", "vv", "<C-w>v", { desc = "Split the current window vertically" }) +-- Insert blank line below current line and center view +map("n", "<leader>o", "o<Esc>kzz", { desc = "Insert blank line below + center" }) + -- Pressing <leader>h will prompt for a help topic and open it in vsplit map("n", "<leader>h", ":vert help ", { desc = "Open help vertically" }) -- Open messages in vplit map("n", "<leader>m", ":vnew | put =execute('messages')<CR>", { desc = "Open messages in vsplit" }) +-- Explain diagnostics +map("n", "<leader>de", ":lua vim.diagnostic.open_float()<CR>", { desc = "Explain diagnostics" }) + +-- Go to the next diagnostic +map("n", "<leader>dn", ":lua vim.diagnostic.goto_next()<CR>", { desc = "Go to the next diagnostic" }) + +-- Go to the previous diagnostic +map("n", "<leader>dp", ":lua vim.diagnostic.goto_prev()<CR>", { desc = "Go to the previous diagnostic" }) + +-- Open diagnostics locations +map("n", "<leader>dl", ":lua vim.diagnostic.setqflist()<CR>", { desc = "Open diagnostics locations" }) + +-- Toggle diagnostics +map("n", "<leader>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 .<CR>", { desc = "Repeat action on visual block" }) @@ -216,6 +240,16 @@ map("n", "<C-Down>", ":resize -2<CR>", { desc = "Decrease window height" }) map("n", "<C-Left>", ":vertical resize +2<CR>", { desc = "Increase window width" }) map("n", "<C-Right>", ":vertical resize -2<CR>", { 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 ------------------------------------------------------------ |
