From da4532ecf0b79849040c6573233266c7b9afe4cd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 23 May 2019 09:19:40 +1200 Subject: Move my after ftplugin for Markdown into main --- vim/ftplugin/markdown.vim | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'vim/ftplugin') 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 q + \ quote#Quote() +xnoremap q + \ quote#Quote() +let b:undo_ftplugin .= '|nunmap q' + \ . '|xunmap q' + +" Quote operator with reformatting +nnoremap Q + \ quote#QuoteReformat() +xnoremap Q + \ quote#QuoteReformat() +let b:undo_ftplugin .= '|nunmap Q' + \ . '|xunmap Q' + +" Autoformat headings +command! -buffer -nargs=1 MarkdownHeading + \ call markdown#Heading() +nnoremap = + \ :MarkdownHeading = +nnoremap - + \ :MarkdownHeading - +let b:undo_ftplugin .= '|delcommand MarkdownHeading' + \ . '|nunmap =' + \ . '|nunmap -' " vim:set sw=2: -- cgit v1.2.3