autolist.nvim
autolist.nvim copied to clipboard
AutolistNewBulletBefore adds sub-bullets before a line ending in a colon
Ending a line with a colon, and using o in normal mode (or <cr> in insert mode), automatically makes the next line start an indented, bulleted list. This is a great feature and one I use frequently for my note-taking and nested to-do lists.
If I am in normal mode on a line ending in a colon, and use O – mapped to O<cmd>AutolistNewBulletBefore<cr> – it creates an indented, bulleted list above the new line, regardless of what is above the line.
This is reproducible using autolist.nvim (and lazy.nvim) as the only plugin. My config is
require("lazy").setup({
{
"gaoDean/autolist.nvim",
ft = {
"markdown",
"text",
},
config = function()
require("autolist").setup()
vim.keymap.set("i", "<tab>", "<cmd>AutolistTab<cr>")
vim.keymap.set("i", "<s-tab>", "<cmd>AutolistShiftTab<cr>")
vim.keymap.set("i", "<CR>", "<CR><cmd>AutolistNewBullet<cr>")
vim.keymap.set("n", "o", "o<cmd>AutolistNewBullet<cr>")
vim.keymap.set("n", "O", "O<cmd>AutolistNewBulletBefore<cr>")
end,
},
}
With the cursor on the first line, typing O from this:
This is a test:
- Test bullet
Results in this:
-
This is a test:
- Test bullet
Ideally, I'd want just a plain new line, or a line bulleted to match the current indent, rather than adding an extra layer of indent. Is that feasible?