Neovim plugin containing some useful Markdown editing functionality:
(This project used to be called LisToggle when it only supported the first item.)
I use and recommend vim-plug:
Plug 'walterl/downtools'
Repeatedly running :DownToggleListItem
(mapped to <C-Space>
in Markdown
files), turns the line
Lua in Neovim is easy.
into
- Lua in Neovim is easy.
into
- [ ] Lua in Neovim is easy.
into
- [X] Lua in Neovim is easy.
and back into
- [ ] Lua in Neovim is easy.
Indentation is preserved, and the list marker at the current indentation level
will be used, defaulting to -
.
Visually selecting bar
in a line containing foo bar baz
and hitting
<C-k>
, will change that line to:
foo [bar]() baz
<C-k>
just executes the DownMakeLink
command.
The cursor will be placed between the parentheses (()
).
Visually selecting bar
and hitting <C-b>
will change
foo bar baz
into
foo **bar** baz
Disable the <C-Space>
mapping in Markdown files with
let g:downtools_disable_list_toggle_mapping = 1
.
Disable the <C-k>
mapping in Markdown files with
let g:downtools_disable_vlink_mapping = 1
.
Disable the <C-b>
mapping in Markdown files with
let g:downtools_disable_bold_mapping = 1
.
This plugin was developed to explore writing Neovim plugins in Lua.
I quite like VimWiki's todo list toggling support, but I didn't want to use VimWiki for Markdown files, write a plugin for that in VimL (or regexes), and didn't want to have any external dependencies.
Using GitHub for pull requests, I noticed that it has a very useful shortcut
(Ctrl-k) for surrounding a selection in Markdown link dressing (it turns
selection foo
into [foo](url)
, with url
selected). Growing tired of
manually creating such links, I implemented that in this plugin too. This is
the point where the project was renamed from LisToggle to downtools.