From a3b1efeb050b75129df02b51d7acfd62ba3f25ee Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jun 2025 11:50:33 +0200 Subject: [PATCH 01/10] nvim: Set default tabwidth in md, quarto to 2 Makes it easier to read lists, and also easier to work with markdownlint even if it has not been configured for a given repository (since its list indentations default to 2 spaces). --- nvim/.config/nvim/after/ftplugin/markdown.lua | 4 ++++ nvim/.config/nvim/after/ftplugin/quarto.lua | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/after/ftplugin/markdown.lua b/nvim/.config/nvim/after/ftplugin/markdown.lua index ac9769d..acdb2f3 100644 --- a/nvim/.config/nvim/after/ftplugin/markdown.lua +++ b/nvim/.config/nvim/after/ftplugin/markdown.lua @@ -1,5 +1,9 @@ local map = vim.keymap.set +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.softtabstop = 2 + if require("core.util").is_available("which-key") then require("which-key").add({ { "c", group = "codecells" }, diff --git a/nvim/.config/nvim/after/ftplugin/quarto.lua b/nvim/.config/nvim/after/ftplugin/quarto.lua index a38d353..967fab4 100644 --- a/nvim/.config/nvim/after/ftplugin/quarto.lua +++ b/nvim/.config/nvim/after/ftplugin/quarto.lua @@ -1,5 +1,11 @@ +local map = vim.keymap.set + +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.softtabstop = 2 + if require("core.util").is_available("quarto") then - vim.keymap.set("n", "po", require("quarto").quartoPreview, { desc = "show quarto preview" }) + map("n", "po", require("quarto").quartoPreview, { desc = "show quarto preview" }) end -- TODO: Puths kernel into local file dir currently, @@ -65,7 +71,7 @@ end vim.api.nvim_create_user_command("JupyterStart", function(opts) startsession(opts) end, { nargs = "?" }) -vim.keymap.set("n", "cS", ":JupyterStart", { desc = "start code session", silent = true }) +map("n", "cS", ":JupyterStart", { desc = "start code session", silent = true }) if vim.g.quarto_auto_init_molten_session then vim.api.nvim_create_autocmd({ "BufEnter" }, { From b5198c385c726a226e0dacb120cc84d449e7d69c Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jun 2025 22:16:13 +0200 Subject: [PATCH 02/10] nvim: Switch zenmode to new toggle map Like other 'switch' toggles, turn on/off zen-mode with `]sz`/`[sz` respectively. --- nvim/.config/nvim/lua/plugins/prose.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 494e106..d45de60 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -34,7 +34,24 @@ local prose_plugs = { config = true, cmd = { "ZenMode" }, dependencies = { "folke/twilight.nvim" }, - keys = { { "sz", ":ZenMode", silent = true, desc = "toggle zen mode" } }, + keys = { + { + "[sz", + function() + require("zen-mode").close() + end, + silent = true, + desc = "stop zen mode", + }, + { + "]sz", + function() + require("zen-mode").open() + end, + silent = true, + desc = "start zen mode", + }, + }, }, { "andrewferrier/wrapping.nvim", From 35d1f8b03d12735d591d24c19bc54f9c0f19bccf Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jun 2025 22:57:56 +0200 Subject: [PATCH 03/10] nvim: Improve mini.pairs triple mappings Whenever there is a left-over quote (') or double quote ("), if we want to 'close' it, mini.pairs will by default add a new pair (e.g. """) instead. This simply changes it to close the pair. Makes some 'double-quote' pairings harder (e.g. we have a python dict: {"name"}) and want to add another {"name""value"} into it, but this happens relatively rarely in my use cases. The first on the other hand happens frequently enough to be an annoyance. Additionally, did the same for back-ticks so we can more easily create triple backticks ``` which are essential in many literate programming markup languages (markdown, quarto, rmd and so on). --- nvim/.config/nvim/lua/plugins/base.lua | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/nvim/.config/nvim/lua/plugins/base.lua b/nvim/.config/nvim/lua/plugins/base.lua index e0fcfb1..0f8590e 100644 --- a/nvim/.config/nvim/lua/plugins/base.lua +++ b/nvim/.config/nvim/lua/plugins/base.lua @@ -250,7 +250,33 @@ return { require("mini.map").setup() require("mini.move").setup() require("mini.operators").setup() - require("mini.pairs").setup() + require("mini.pairs").setup({ + mappings = { + -- these mappings ensure that when trying to _close_ any of the pairs + -- it will not double insert: + -- " <- you are here. Normal pairs will do """. This config will do "". + ['"'] = { + action = "closeopen", + pair = '""', + neigh_pattern = '[^\\"].', + register = { cr = false }, + }, + ["'"] = { + action = "closeopen", + pair = "''", + neigh_pattern = "[^%a\\'].", + register = { cr = false }, + }, + ["`"] = { + action = "closeopen", + pair = "``", + neigh_pattern = "[^\\`].", + register = { cr = false }, + }, + ["<"] = { action = "open", pair = "<>", neigh_pattern = "\r." }, + [">"] = { action = "close", pair = "<>" }, + }, + }) require("mini.trailspace").setup() end, }) From 9f415f8ccc651b9bd670338d8538e257a6ae524b Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jun 2025 23:16:46 +0200 Subject: [PATCH 04/10] nvim: Fix render-markdown naming scheme Old versions of render-markdown.nvim suggested renaming it to another plugin name, but this seems to not be the case anymore. I removed both for the time being and it fixed a long-standing issue I had with the plugin. --- nvim/.config/nvim/lua/plugins/prose.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index d45de60..cef2108 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -85,7 +85,6 @@ local prose_plugs = { -- displays prettier md rendering { "MeanderingProgrammer/render-markdown.nvim", - main = "render-markdown", opts = { file_types = { "markdown", "codecompanion" }, render_modes = { "n", "c", "i" }, @@ -108,7 +107,6 @@ local prose_plugs = { }, }, }, - name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons", From b9c60ffde6da3cfd4261a262730ea37539a5d5ad Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jun 2025 23:16:46 +0200 Subject: [PATCH 05/10] nvim: Update plugins --- nvim/.config/nvim/lazy-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index b7483d9..5fe3404 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -20,7 +20,7 @@ "flash.nvim": { "branch": "main", "commit": "ec0bf2842189f65f60fd40bf3557cac1029cc932" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, - "fzf-lua": { "branch": "main", "commit": "c53ba4f40f0514a5038646fb1e9ce05872b18eb1" }, + "fzf-lua": { "branch": "main", "commit": "05eaee319fcf2f5a0d378c2848641858c8b8962e" }, "git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" }, "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, "glance.nvim": { "branch": "master", "commit": "bf86d8b79dce808e65fdb6e9269d0b4ed6d2eefc" }, @@ -56,7 +56,7 @@ "nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, "nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" }, - "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, + "nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" }, "nvim-lspconfig": { "branch": "master", "commit": "77d3fdfb3554632c7a3b101ded643d422de7626f" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-surround": { "branch": "main", "commit": "8dd9150ca7eae5683660ea20cec86edcd5ca4046" }, @@ -74,7 +74,7 @@ "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "quarto-nvim": { "branch": "main", "commit": "5325af3731ac9840b308791f08ad660958d76163" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "1ab18259472d9fe5756750fec722c31bab1712da" }, - "render-markdown": { "branch": "main", "commit": "6d03af10063d5a2fadec3559de5dfa68da7d00ef" }, + "render-markdown.nvim": { "branch": "main", "commit": "6d03af10063d5a2fadec3559de5dfa68da7d00ef" }, "smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" }, "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" }, "texpresso.vim": { "branch": "main", "commit": "907838c08bbf99ad6bed3c908f1d0551a92ab4e0" }, From bb11a12f252b0a0ea80d94c980fadafc6066d2b4 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jun 2025 23:27:52 +0200 Subject: [PATCH 06/10] nvim: Remove criticmarkup Sad but I'll have to face it - I've never successfully used criticmarkup in, by now, 6 years of professional academic writing. The plugin also does not work as well as it should (anymore?) with my current neovim setup. The `:Critic` command works neither with accept nor reject and the different highlights are presumably overwritten by treesitter queries. Now, all of those _could_ be fixed but as I say above, I have never successfully used the markup. Perhaps one day it could be implemented in a slick nvim lua plugin with hiding and extmarks which mimicks a truly nice review editing experience. But not today. --- nvim/.config/nvim/lazy-lock.json | 1 - nvim/.config/nvim/lua/plugins/prose.lua | 3 --- 2 files changed, 4 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 5fe3404..ae3021e 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -85,7 +85,6 @@ "typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" }, "undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" }, "vifm.vim": { "branch": "master", "commit": "617e3dc7c9af1f03cc664124aff2fe98fafcf1b2" }, - "vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" }, "vim-numbertoggle": { "branch": "main", "commit": "df9b1fe616507340718716204ba7f434125bdf7a" }, "vim-spellsync": { "branch": "master", "commit": "ea9f431483ceb40ede8bd5b126a03eccd49b1bc0" }, "wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" }, diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index cef2108..3a1f9b1 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -285,9 +285,6 @@ local prose_plugs = { }, }, - -- syntax highlighting for markdown criticmarkup (comments, additions, ...) - { "vim-pandoc/vim-criticmarkup", ft = md_like }, - -- create mindmaps from your markdown { "Zeioth/markmap.nvim", From 22e8f9761f54bdfb33713e59133e9c68ecb8fc94 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 20 Jun 2025 23:35:39 +0200 Subject: [PATCH 07/10] nvim: Version-pin treesitter again Treesitter had to run as a non-versioned (trunk-tracking) plugin for a while since there was no updated version released. Now that it is we can return to a nicely versioned tag. --- nvim/.config/nvim/lua/plugins/treesitter.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 7b274a0..e8ab0ba 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -21,7 +21,6 @@ return { }, { "nushell/tree-sitter-nu", version = false }, }, - version = false, -- TODO: Can be set to versioned if new version after 2024-12-12 is released config = function() local enabled_parsers = {} for _, lang in pairs(Languages) do From 8f9954bd8af99d40e7798fc70a612583f48873ff Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 21 Jun 2025 10:45:04 +0200 Subject: [PATCH 08/10] nvim: Fix bracketed configuration mini.bracketed never received its configuration which is the reason I had some issues in the past. It was simply wrapped in one too many layers of tables. Now works as intended. --- nvim/.config/nvim/lua/plugins/base.lua | 30 ++++++++++++-------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/base.lua b/nvim/.config/nvim/lua/plugins/base.lua index 0f8590e..bb324e8 100644 --- a/nvim/.config/nvim/lua/plugins/base.lua +++ b/nvim/.config/nvim/lua/plugins/base.lua @@ -183,22 +183,20 @@ return { require("mini.align").setup({}) require("mini.bracketed").setup({ - { - buffer = { suffix = "b", options = {} }, - comment = { suffix = "k", options = {} }, - conflict = { suffix = "" }, -- disable to use git-conflict instead - diagnostic = { suffix = "d", options = {} }, - file = { suffix = "", options = {} }, - indent = { suffix = "" }, -- disable since we use indentscope - jump = { suffix = "j", options = {} }, - location = { suffix = "l", options = {} }, - oldfile = { suffix = "o", options = {} }, -- FIXME: overwritten by wrapping defaults currently - quickfix = { suffix = "q", options = {} }, - treesitter = { suffix = "t", options = {} }, - undo = { suffix = "" }, -- disable since I don't need it - window = { suffix = "w", options = {} }, - yank = { suffix = "y", options = {} }, - }, + buffer = { suffix = "b", options = {} }, + comment = { suffix = "k", options = {} }, + conflict = { suffix = "" }, -- disable to use git-conflict instead + diagnostic = { suffix = "d", options = {} }, + file = { suffix = "", options = {} }, + indent = { suffix = "" }, -- disable since we use indentscope + jump = { suffix = "j", options = {} }, + location = { suffix = "l", options = {} }, + oldfile = { suffix = "o", options = {} }, -- FIXME: overwritten by wrapping defaults currently + quickfix = { suffix = "q", options = {} }, + treesitter = { suffix = "t", options = {} }, + undo = { suffix = "" }, -- disable since I don't need it + window = { suffix = "w", options = {} }, + yank = { suffix = "y", options = {} }, }) require("mini.comment").setup({ hooks = { From f558a689761ea49827578b1e75dcca123c25d185 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 21 Jun 2025 10:46:31 +0200 Subject: [PATCH 09/10] nvim: Change diagnostic movement to ][e In preparation for adding debugging we change the bracket movement between diagnostics from `[d`/`]d` to `[e`/`]e` instead. This will be a big switch in muscle memory for me and I hope I can adapt to it pretty quickly, but at least mnemonically it still makes sense since we jump between [E]rrors (or warnings but good enough). --- nvim/.config/nvim/lua/plugins/base.lua | 2 +- nvim/.config/nvim/lua/plugins/lsp.lua | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/base.lua b/nvim/.config/nvim/lua/plugins/base.lua index bb324e8..c537a66 100644 --- a/nvim/.config/nvim/lua/plugins/base.lua +++ b/nvim/.config/nvim/lua/plugins/base.lua @@ -186,7 +186,7 @@ return { buffer = { suffix = "b", options = {} }, comment = { suffix = "k", options = {} }, conflict = { suffix = "" }, -- disable to use git-conflict instead - diagnostic = { suffix = "d", options = {} }, + diagnostic = { suffix = "e", options = {} }, file = { suffix = "", options = {} }, indent = { suffix = "" }, -- disable since we use indentscope jump = { suffix = "j", options = {} }, diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index 5d0a9d3..be349a8 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -134,17 +134,17 @@ vim.api.nvim_create_autocmd("LspAttach", { local map = vim.keymap.set map("n", "K", "lua vim.lsp.buf.hover()", o({ desc = "Hover definition" })) - map("n", "[d", "lua vim.diagnostic.goto_prev()", o({ desc = "Previous diagnostic" })) - map("n", "]d", "lua vim.diagnostic.goto_next()", o({ desc = "Next diagnostic" })) + map("n", "[e", "lua vim.diagnostic.goto_prev()", o({ desc = "Previous diagnostic" })) + map("n", "]e", "lua vim.diagnostic.goto_next()", o({ desc = "Next diagnostic" })) map( "n", - "[D", + "[E", "lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})", o({ desc = "Previous error" }) ) map( "n", - "]D", + "]E", "lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})", o({ desc = "Next error" }) ) From bbab0f167403836f8f8d87865b2e68833a6244d7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 21 Jun 2025 10:46:31 +0200 Subject: [PATCH 10/10] nvim: Add file bracketed movement For now there is no strict reason to have it disabled, even if I don't use it much. At the same time I can always re-disable it if I need the bracketed movement for something more important later down the line. --- nvim/.config/nvim/lua/plugins/base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/.config/nvim/lua/plugins/base.lua b/nvim/.config/nvim/lua/plugins/base.lua index c537a66..beeb3de 100644 --- a/nvim/.config/nvim/lua/plugins/base.lua +++ b/nvim/.config/nvim/lua/plugins/base.lua @@ -187,7 +187,7 @@ return { comment = { suffix = "k", options = {} }, conflict = { suffix = "" }, -- disable to use git-conflict instead diagnostic = { suffix = "e", options = {} }, - file = { suffix = "", options = {} }, + file = { suffix = "f", options = {} }, indent = { suffix = "" }, -- disable since we use indentscope jump = { suffix = "j", options = {} }, location = { suffix = "l", options = {} },