From ba93b49c79bbb242e04a2991c7d6918979b9f5ae Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Mar 2026 20:59:00 +0000 Subject: [PATCH 1/6] Disable R autocomplete in quarto prose sections Otter.nvim was feeding R language server completions into the prose/markdown areas of .qmd files. Disable otter's completion source so the autocomplete popup doesn't appear when writing text outside code chunks. https://claude.ai/code/session_01HBreTNcQgKZrD7azocwiaD --- nvim/lua/plugins/quarto.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nvim/lua/plugins/quarto.lua b/nvim/lua/plugins/quarto.lua index d9600db..312eded 100644 --- a/nvim/lua/plugins/quarto.lua +++ b/nvim/lua/plugins/quarto.lua @@ -1,7 +1,19 @@ return { "quarto-dev/quarto-nvim", ft = { "quarto" }, + opts = { + cmpSource = { + enabled = false, + }, + }, dependencies = { - "jmbuhr/otter.nvim", + { + "jmbuhr/otter.nvim", + opts = { + completion = { + enabled = false, + }, + }, + }, }, } From 30a87d891190e92e8d32e55ecd5d0ca510a6dcd1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Mar 2026 21:09:52 +0000 Subject: [PATCH 2/6] Remove R language support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R is unused — all qmd code sections use Python. Removes the LazyVim R language extra, the R.nvim plugin (and its build workaround), and the R entry from conform's injected formatter config. https://claude.ai/code/session_01HBreTNcQgKZrD7azocwiaD --- nvim/lua/config/lazy.lua | 1 - nvim/lua/plugins/language.lua | 19 ------------------- 2 files changed, 20 deletions(-) diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua index d4fcb0e..1d17cf4 100644 --- a/nvim/lua/config/lazy.lua +++ b/nvim/lua/config/lazy.lua @@ -28,7 +28,6 @@ require("lazy").setup({ { import = "lazyvim.plugins.extras.lang.json" }, { import = "lazyvim.plugins.extras.lang.markdown" }, { import = "lazyvim.plugins.extras.lang.python" }, - { import = "lazyvim.plugins.extras.lang.r" }, { import = "lazyvim.plugins.extras.lang.toml" }, { import = "lazyvim.plugins.extras.lang.yaml" }, diff --git a/nvim/lua/plugins/language.lua b/nvim/lua/plugins/language.lua index 3546b2d..a0e1127 100644 --- a/nvim/lua/plugins/language.lua +++ b/nvim/lua/plugins/language.lua @@ -1,22 +1,4 @@ return { - { - "R-nvim/R.nvim", - -- TODO: Remove this build workaround once https://github.com/R-nvim/R.nvim/issues/466 is - -- fixed and merged to main, then advance past that commit with `:Lazy update R.nvim`. - -- The upstream bug: check_rout_parser() calls vim.uv.chdir() into resources/tree-sitter-rout - -- but early `return` on build failure skips the chdir(cwdir) restore, leaving nvim stuck in - -- the plugin directory. Root cause is that the tree-sitter-rout submodule gitlink is absent - -- from older pinned commits, so `git submodule update` is a no-op and grammar.js is missing. - -- Workaround: clone the source directly so the build succeeds and cwd is properly restored. - -- Removal check: delete this block, run `make nvim-check`, confirm PASS [R]: clean startup. - build = function() - local target = vim.fn.stdpath("data") .. "/lazy/R.nvim/resources/tree-sitter-rout" - if vim.fn.filereadable(target .. "/grammar.js") == 0 then - vim.fn.system({ "rm", "-rf", target }) - vim.fn.system({ "git", "clone", "https://github.com/R-nvim/tree-sitter-rout", target }) - end - end, - }, { "nvim-treesitter/nvim-treesitter", opts = { @@ -77,7 +59,6 @@ return { latex = "tex", markdown = "md", python = "py", - r = "r", typescript = "ts", vimwiki = "md", }, From d1bb8babcda9c31ae3e6f43e8ba98fec7c96d094 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Mar 2026 21:41:17 +0000 Subject: [PATCH 3/6] Remove javascript/typescript language support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unused — remove JS treesitter parser and JS/TS entries from conform's injected formatter config. https://claude.ai/code/session_01HBreTNcQgKZrD7azocwiaD --- nvim/lua/plugins/language.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/nvim/lua/plugins/language.lua b/nvim/lua/plugins/language.lua index a0e1127..977d236 100644 --- a/nvim/lua/plugins/language.lua +++ b/nvim/lua/plugins/language.lua @@ -6,7 +6,6 @@ return { "bash", "fish", "html", - "javascript", "json", "latex", "lua", @@ -55,11 +54,9 @@ return { -- because some formatters care about the filename. lang_to_ext = { bash = "sh", - javascript = "js", latex = "tex", markdown = "md", python = "py", - typescript = "ts", vimwiki = "md", }, -- Map of treesitter language to formatters to use From d6629fb9ad83172bdeb4fc0ada831090f70f1d11 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Mar 2026 21:49:47 +0000 Subject: [PATCH 4/6] Add Lazy clean step and remove R.nvim workaround from Ansible Replace the tree-sitter-rout clone step (no longer needed after removing R support) with a Lazy clean step to remove unused plugin files during setup. https://claude.ai/code/session_01HBreTNcQgKZrD7azocwiaD --- ansible/tasks/neovim.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ansible/tasks/neovim.yml b/ansible/tasks/neovim.yml index 0343bd3..e3b0d43 100644 --- a/ansible/tasks/neovim.yml +++ b/ansible/tasks/neovim.yml @@ -53,16 +53,13 @@ tags: - nvim -- name: Clone tree-sitter-rout parser source into R.nvim resources - # TODO: Remove once https://github.com/R-nvim/R.nvim/issues/466 is fixed and merged -- see - # nvim/lua/plugins/language.lua for full context. Idempotent: skipped if grammar.js exists. - ansible.builtin.shell: | - target="{{ ansible_env.HOME }}/.local/share/nvim/lazy/R.nvim/resources/tree-sitter-rout" - grammar="$target/grammar.js" - if [ ! -f "$grammar" ]; then - rm -rf "$target" - git clone https://github.com/R-nvim/tree-sitter-rout "$target" - fi +- name: Clean unused Lazy plugins + ansible.builtin.command: + argv: + - nvim + - --headless + - "+Lazy! clean" + - "+qa" tags: - nvim From e8b907e732b0de988e9f86889db5789fe34bad1c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Mar 2026 22:14:11 +0000 Subject: [PATCH 5/6] Clean up: drop html parser, pyright dupe, stale markdown settings - Remove html treesitter parser (unused) - Remove pyright from Ansible venv (already installed via Mason by LazyVim) - Clean up ftplugin/markdown.lua: remove vim-markdown plugin globals (plugin not installed), remove redundant BufWinEnter autocmd that stacked on every buffer load, use opt_local for folding/conceal instead https://claude.ai/code/session_01HBreTNcQgKZrD7azocwiaD --- ansible/tasks/neovim.yml | 1 - nvim/ftplugin/markdown.lua | 23 ++++------------------- nvim/lua/plugins/language.lua | 1 - 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/ansible/tasks/neovim.yml b/ansible/tasks/neovim.yml index e3b0d43..efb9fd6 100644 --- a/ansible/tasks/neovim.yml +++ b/ansible/tasks/neovim.yml @@ -11,7 +11,6 @@ - mdformat - neovim - pynvim - - pyright - ruff - yamllint diff --git a/nvim/ftplugin/markdown.lua b/nvim/ftplugin/markdown.lua index 890d13f..bface7d 100644 --- a/nvim/ftplugin/markdown.lua +++ b/nvim/ftplugin/markdown.lua @@ -1,12 +1,7 @@ --- https://www.reddit.com/r/neovim/comments/1av26kw/i_tried_to_figure_it_out_but_i_give_up_how_do_i/ - -vim.api.nvim_create_autocmd("BufWinEnter", { - command = "set formatoptions+=cqln", -}) vim.opt_local.textwidth = 80 -- auto format text as it's being edited --- n=format lists +-- c=auto-wrap comments, q=allow gq, l=don't break existing long lines, n=format lists vim.opt_local.formatoptions:append("cqln") -- recognize asterisk as bullets @@ -21,16 +16,6 @@ vim.opt_local.shiftwidth = 2 vim.opt_local.tabstop = 2 vim.opt_local.expandtab = true --- support front matter of various format -vim.g.vim_markdown_frontmatter = 1 -- for YAML format -vim.g.vim_markdown_toml_frontmatter = 1 -- for TOML format -vim.g.vim_markdown_json_frontmatter = 1 -- for JSON format - --- disable header folding -vim.g.vim_markdown_folding_disabled = 1 - --- do not use conceal feature -vim.g.vim_markdown_conceal = 0 - -vim.g.vim_markdown_auto_insert_bullets = 0 -vim.g.vim_markdown_new_list_item_indent = 0 +-- disable folding and conceal (LazyVim markdown extra uses render-markdown.nvim) +vim.opt_local.foldenable = false +vim.opt_local.conceallevel = 0 diff --git a/nvim/lua/plugins/language.lua b/nvim/lua/plugins/language.lua index 977d236..cf7742a 100644 --- a/nvim/lua/plugins/language.lua +++ b/nvim/lua/plugins/language.lua @@ -5,7 +5,6 @@ return { ensure_installed = { "bash", "fish", - "html", "json", "latex", "lua", From 6e0cf0fd3a6ad029824413cf9476cabd8a1f0598 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Mar 2026 22:17:33 +0000 Subject: [PATCH 6/6] Add vim-pencil for prose writing in markdown and quarto Replace manual formatoptions/wrap config with vim-pencil in hard wrap mode. This gives reliable prose wrapping that understands markdown structures (lists, blockquotes, code blocks) without needing to manually configure formatoptions. - Add pencil.lua plugin config (hard wrap, tw=80, autoformat) - Simplify markdown ftplugin: PencilHard replaces formatoptions - Simplify quarto ftplugin: PencilHard replaces manual soft wrap, remove unused R-mode variables https://claude.ai/code/session_01HBreTNcQgKZrD7azocwiaD --- nvim/ftplugin/markdown.lua | 15 +-------------- nvim/ftplugin/quarto.lua | 9 +-------- nvim/lua/plugins/pencil.lua | 9 +++++++++ 3 files changed, 11 insertions(+), 22 deletions(-) create mode 100644 nvim/lua/plugins/pencil.lua diff --git a/nvim/ftplugin/markdown.lua b/nvim/ftplugin/markdown.lua index bface7d..9a99b21 100644 --- a/nvim/ftplugin/markdown.lua +++ b/nvim/ftplugin/markdown.lua @@ -1,21 +1,8 @@ -vim.opt_local.textwidth = 80 +vim.cmd("PencilHard") --- auto format text as it's being edited --- c=auto-wrap comments, q=allow gq, l=don't break existing long lines, n=format lists -vim.opt_local.formatoptions:append("cqln") - --- recognize asterisk as bullets --- https://unix.stackexchange.com/a/31348 -vim.opt_local.formatlistpat:append([[\|^\\*\s*]]) - --- Maintain indenting of paragraphs in the text -vim.opt_local.autoindent = true - --- Use two spaces for tabs vim.opt_local.shiftwidth = 2 vim.opt_local.tabstop = 2 vim.opt_local.expandtab = true --- disable folding and conceal (LazyVim markdown extra uses render-markdown.nvim) vim.opt_local.foldenable = false vim.opt_local.conceallevel = 0 diff --git a/nvim/ftplugin/quarto.lua b/nvim/ftplugin/quarto.lua index c250414..52cb5a0 100644 --- a/nvim/ftplugin/quarto.lua +++ b/nvim/ftplugin/quarto.lua @@ -5,15 +5,8 @@ local api = vim.api local ts = vim.treesitter vim.b.slime_cell_delimiter = "```" -vim.b["quarto_is_r_mode"] = nil -vim.b["reticulate_running"] = false --- wrap text, but by word not character --- indent the wrappped line -vim.wo.wrap = true -vim.wo.linebreak = true -vim.wo.breakindent = true -vim.wo.showbreak = "|" +vim.cmd("PencilHard") -- don't run vim ftplugin on top vim.api.nvim_buf_set_var(0, "did_ftplugin", true) diff --git a/nvim/lua/plugins/pencil.lua b/nvim/lua/plugins/pencil.lua new file mode 100644 index 0000000..2280034 --- /dev/null +++ b/nvim/lua/plugins/pencil.lua @@ -0,0 +1,9 @@ +return { + "preservim/vim-pencil", + ft = { "markdown", "quarto", "vimwiki" }, + init = function() + vim.g["pencil#textwidth"] = 80 + vim.g["pencil#wrapModeDefault"] = "hard" + vim.g["pencil#autoformat"] = 1 + end, +}