Small nvim plugin to handle Markdown lists, including checkbox lists.
- Auto-insert list items to continue a list (works with
<enter>
in insert mode ando
andO
in normal mode). - Auto-insert also handles checkboxes (
* [ ] My todo item
) - Toggle checkboxes on and off
- Toggle if checkboxes are present in the list item or not
lazy.nvim
:
lazy.setup(
{
dir = "~/src/markdown-list-tools.nvim",
ft = "markdown",
config = function()
require("markdown-list-tools").setup()
end
},
)
require("markdown-tools").setup({
-- Which keys to remap for markdown files. Set to `false` to disable all remapping.
remap = {
-- Remap <enter> in insert mode to auto-insert list items
enter = true,
-- Remap `o` in normal mode to auto-insert list items
o = true,
-- Remap `O` in normal mode to auto-insert list items
O = true,
},
}
-- Toggle state for the current checkbox. Works in normal and visual mode
vim.keymap.set({ 'n', 'x' }, '<leader>c', require('markdown-tools').checkbox_toggle(), { desc = 'Toggle checkbox' });
-- Toggle if a checkbox is present or not. Works in normal and visual mode
vim.keymap.set({ 'n', 'x' }, '<leader>C', require('markdown-tools').checkbox_toggle_present(), { desc = 'Toggle checkbox present' });
Yup.
Inspired by: