From c53630b77de70cb715c7417be529dbaaaf0f36ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20L=C3=BCdecke?= Date: Fri, 11 Apr 2025 20:59:23 +0200 Subject: [PATCH] Moving to neovim 0.11, new calc, keys streamlined Keybindings: - E (explain error) now is x - dropped 0 and following, were remainders from Emacs - insert: now deletes word right of cursor LSP: - diagnostics popup replaced with neovim 0.11 virtual lines (much nicer) Options: - neo-tree width dropped, was too wide - workspaces no longer auto open, was interfering with using neovim as git client or file manager Plugins: - replaced cmp-rpncalc with qalc.nvim (which uses the qalc cli) --- after/ftplugin/rust.lua | 2 +- lua/config/nvim-cmp.lua | 5 +---- lua/keybindings.lua | 5 +---- lua/lsp.lua | 6 +++++- lua/plugins.lua | 19 ++++++++++++++----- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua index 15e7005..e5cd3d5 100644 --- a/after/ftplugin/rust.lua +++ b/after/ftplugin/rust.lua @@ -2,7 +2,7 @@ local bufnr = vim.api.nvim_get_current_buf() vim.keymap.set( "n", - "E", + "x", function() vim.cmd.RustLsp({ 'explainError', 'current' }) end, diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua index 637ef04..90b6c53 100644 --- a/lua/config/nvim-cmp.lua +++ b/lua/config/nvim-cmp.lua @@ -89,11 +89,8 @@ cmp.setup({ { name = 'luasnip' }, -- For luasnip user { name = 'buffer' }, -- For buffer word completion { name = 'path' }, -- For path completion - { name = 'rpncalc' }, -- for RPN calculations { name = 'orgmode' }, -- for nvim-orgmode { name = 'sonicpi' }, -- for sonic-pi integration + { name = 'calc' }, -- for calulcator }) }) - - - diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 8cedb8d..76344a3 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -77,12 +77,9 @@ vim.keymap.set('n', 'mc', mywords.uhl_all, { desc = "Clear all highlights -- Shortcuts which are known from Emacs -- ------------------------------------------ -vim.keymap.set('n', '0', ":hide", { desc = "Win: close current" }) -vim.keymap.set('n', '1', ":only", { desc = "Win: close others" }) -vim.keymap.set('n', '2', ":split", { desc = "Win: split horizontally" }) -vim.keymap.set('n', '2', ":vsplit", { desc = "Win: split vertically" }) vim.keymap.set('n', 'q', "gwap", { desc = "Wrap paragraph" }) vim.keymap.set('n', '', ":silent! nohls", { desc = "Clear search" }) +vim.keymap.set('i', '', 'dW', {desc = "Delete word right" }) -- horizontally scroll with mouse vim.keymap.set('n', '', 'zh') diff --git a/lua/lsp.lua b/lua/lsp.lua index 3018c06..84a0ebc 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -57,7 +57,11 @@ local on_attach = function(client, bufnr) local fzf = require('fzf-lua') vim.keymap.set('n', 'd', fzf.diagnostics_document, { desc = "Document diagnostics" }) vim.keymap.set('n', 'D', fzf.diagnostics_workspace, { desc = "Workspace diagnostics" }) - vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Popup diagnostics" }) + -- vim.keymap.set('n', 'E', vim.diagnostic.open_float, { desc = "Popup diagnostics" }) + vim.keymap.set('n', 'e', function() + local new_config = not vim.diagnostic.config().virtual_lines + vim.diagnostic.config({ virtual_lines = new_config }) + end, { desc = "Virtual line diagnostics" }) vim.keymap.set('n', 's', fzf.lsp_document_symbols, { desc = "Doc symbols" }) vim.keymap.set('n', 'c', fzf.lsp_code_actions, { desc = "Code Actions" }) vim.keymap.set('n', '[', vim.diagnostic.goto_prev, { desc = "Previous diagnostics" }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 5b4a2e8..e18dda2 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -290,7 +290,6 @@ require("lazy").setup({ require("neo-tree").setup({ window = { position = "left", - width = 60, mappings = { [""] = { "toggle_node", @@ -324,7 +323,7 @@ require("lazy").setup({ mru_sort = false, -- option to automatically activate workspace when opening neovim in a workspace directory - auto_open = true, + auto_open = false, -- option to automatically activate workspace when changing directory not via this plugin auto_dir = true, @@ -336,12 +335,22 @@ require("lazy").setup({ end }, - -- rpn calculator - -- also added as source to cmp + -- calulcation in cmp { - "PhilRunninger/cmp-rpncalc", + "hrsh7th/cmp-calc", }, + -- calculate using qalc cli, call :QalcAttach or :Qalc + { + "Apeiros-46B/qalc.nvim", + config = function() + require('qalc').setup({ + bufname = "Qalculate", + }) + end, + }, + + -- TODO, WARN, HACK, PERF, NOTE, TEST and others highlighting and searching { "folke/todo-comments.nvim",