diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-23 09:19:40 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-23 09:19:40 +1200 |
commit | da4532ecf0b79849040c6573233266c7b9afe4cd (patch) | |
tree | 6e067d5470cc3005ad24569c787b683b47b507c0 /vim/ftplugin | |
parent | Add Tim Pope's Markdown ftplugin (diff) | |
download | dotfiles-da4532ecf0b79849040c6573233266c7b9afe4cd.tar.gz dotfiles-da4532ecf0b79849040c6573233266c7b9afe4cd.zip |
Move my after ftplugin for Markdown into main
Diffstat (limited to 'vim/ftplugin')
-rw-r--r-- | vim/ftplugin/markdown.vim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim index 277ba94e..e59e661b 100644 --- a/vim/ftplugin/markdown.vim +++ b/vim/ftplugin/markdown.vim @@ -47,4 +47,48 @@ if has("folding") && exists("g:markdown_folding") let b:undo_ftplugin .= " foldexpr< foldmethod<" endif +" Spellcheck documents we're actually editing (not just viewing) +if &modifiable && !&readonly + setlocal spell + let b:undo_ftplugin .= '|setlocal spell<' +endif + +" Tolerate leading lowercase letters in README.md files, for things like +" headings being filenames +if expand('%:t') ==# 'README.md' + setlocal spellcapcheck= + let b:undo_ftplugin .= '|setlocal spellcapcheck<' +endif + +" Stop here if the user doesn't want ftplugin mappings +if exists('no_plugin_maps') || exists('no_markdown_maps') + finish +endif + +" Quote operator +nnoremap <buffer> <expr> <LocalLeader>q + \ quote#Quote() +xnoremap <buffer> <expr> <LocalLeader>q + \ quote#Quote() +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>q' + \ . '|xunmap <buffer> <LocalLeader>q' + +" Quote operator with reformatting +nnoremap <buffer> <expr> <LocalLeader>Q + \ quote#QuoteReformat() +xnoremap <buffer> <expr> <LocalLeader>Q + \ quote#QuoteReformat() +let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>Q' + \ . '|xunmap <buffer> <LocalLeader>Q' + +" Autoformat headings +command! -buffer -nargs=1 MarkdownHeading + \ call markdown#Heading(<f-args>) +nnoremap <buffer> <LocalLeader>= + \ :<C-U>MarkdownHeading =<CR> +nnoremap <buffer> <LocalLeader>- + \ :<C-U>MarkdownHeading -<CR> +let b:undo_ftplugin .= '|delcommand MarkdownHeading' + \ . '|nunmap <buffer> <LocalLeader>=' + \ . '|nunmap <buffer> <LocalLeader>-' " vim:set sw=2: |