dotfiles/nvim/.config/nvim
Marty Oehme 083973e7c1
nvim: Improve markdown checkbox toggling
Also given new mapping. Hit `<c-t>` instead of `<c-x>`. `<c-x>` (in
insert mode) instead now brings up the path completion which was
previously on the other mapping.

On any line in a markdown-like file (i.e. markdown, quarto, djot, etc.),
we can hit `<c-t>` in normal mode or insert mode to toggle the current
line having a checkbox or not. It takes care to leave the current item a
list item like it was if it already was filled with content.

It does _not_ remove the list item even if it is empty, this may be an
improvement for the future (i.e., empty line -> we hit <c-t> -> line
turns into `- [ ] ` -> we hit <c-t> -> line stays `- `).
But care should be taken to not remove a list item if we don't intend
to, e.g. we could have toggled part of a list beforehand and don't want
to remove the list on each toggle. That's why it is more conservative
for now and I think it should work well enough (the case is likely to be
rare in my mind).

Also, while it does pick up the extended checkbox symbols ([o], [~], [-]),
those are currently hardcoded into the query.
In my mind it should pick those up dynamically from another plugin
instead of hardcoding here, e.g. render-markdown which also defines the
symbols?

Lastly, we could extend it to use treesitter queries instead / on top if
TS is found which would make it more robust than regex matching. But for
an hour of hacking it works quite well.
2025-08-17 12:35:08 +02:00
..
after nvim: Improve markdown checkbox toggling 2025-08-17 12:35:08 +02:00
ftdetect nvim: Add djot filetype detection 2025-02-18 22:41:39 +01:00
lua nvim: Improve markdown checkbox toggling 2025-08-17 12:35:08 +02:00
snippets nvim: Add todo snippets to markdown 2025-07-16 17:53:56 +02:00
spell nvim: Update plugins and spellfile 2025-05-04 19:55:06 +02:00
abbrev.vim nvim: Add spelling and abbreviations 2024-08-07 20:05:42 +02:00
init.lua nvim: Refactor core setting loading into core module 2023-12-12 14:07:43 +01:00
lazy-lock.json nvim: Stay centered in zen mode 2025-07-16 20:18:34 +02:00