All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 local i, _ = string.find(vim.bo.filetype, "mail")
3 vim.opt_local.textwidth = 80
6 vim.g.table_mode_corner = "|"
8 -- {{{ support { and } motions across quoted text/blockquotes
9 -- written by @seandewar on 2025-05-20 in #neovim:matrix.org
10 local function make_jump_fn(backwards)
12 local skip_flags = "W" .. (backwards and "be" or "")
13 local jump_flags = "c" .. skip_flags
16 for _ = 1, vim.v.count1 do
17 local lnum = vim.api.nvim_win_get_cursor(0)[1]
18 -- First, check whether the cursor is already between paragraphs (in an
19 -- empty line/block), and skip past it if we are
20 if vim.fn.search([[^$]], "ncW", lnum) ~= 0 then
21 at_end = vim.fn.search([[.]], skip_flags) == 0
22 elseif vim.fn.search([[^\%(>\s*\)\+\zs$]], "ncW", lnum) ~= 0 then
23 -- In-between paragraphs inside a (possibly nested) block.
24 local depth = select(2, vim.fn.getline(lnum):gsub(">", ""))
25 at_end = vim.fn.search(([[^\%%(\%%(>\s*\)\{%u}$\)\@!.*$]]):format(depth), skip_flags) == 0
28 -- Finally, jump past the next paragraph, or to the beginning/end of the
29 -- buffer if there's no more
30 if at_end or vim.fn.search([[^$\|^\%(>\s*\)\+\zs$]], jump_flags) == 0 then
31 vim.fn.cursor(backwards and 1 or "$", backwards and 1 or vim.v.maxcol)
38 vim.keymap.set({ "n", "v" }, "}", make_jump_fn(false), { buffer = true })
39 vim.keymap.set({ "n", "v" }, "{", make_jump_fn(true), { buffer = true })