Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions ansible/tasks/neovim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
- mdformat
- neovim
- pynvim
- pyright
- ruff
- yamllint

Expand Down Expand Up @@ -53,16 +52,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

Expand Down
34 changes: 3 additions & 31 deletions nvim/ftplugin/markdown.lua
Original file line number Diff line number Diff line change
@@ -1,36 +1,8 @@
-- https://www.reddit.com/r/neovim/comments/1av26kw/i_tried_to_figure_it_out_but_i_give_up_how_do_i/
vim.cmd("PencilHard")

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
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

-- 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
vim.opt_local.foldenable = false
vim.opt_local.conceallevel = 0
9 changes: 1 addition & 8 deletions nvim/ftplugin/quarto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion nvim/lua/config/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },

Expand Down
23 changes: 0 additions & 23 deletions nvim/lua/plugins/language.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
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 = {
ensure_installed = {
"bash",
"fish",
"html",
"javascript",
"json",
"latex",
"lua",
Expand Down Expand Up @@ -73,12 +53,9 @@ return {
-- because some formatters care about the filename.
lang_to_ext = {
bash = "sh",
javascript = "js",
latex = "tex",
markdown = "md",
python = "py",
r = "r",
typescript = "ts",
vimwiki = "md",
},
-- Map of treesitter language to formatters to use
Expand Down
9 changes: 9 additions & 0 deletions nvim/lua/plugins/pencil.lua
Original file line number Diff line number Diff line change
@@ -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,
}
14 changes: 13 additions & 1 deletion nvim/lua/plugins/quarto.lua
Original file line number Diff line number Diff line change
@@ -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,
},
},
},
},
}
Loading