commit db24af722b51c7cb3393563db854ff9395d804ae parent be4efda00c3ebd3cb8992944c37038b367000da3 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Mon, 27 Jan 2020 14:49:59 +0100 vim: run proselint after saving a markdown file Former-commit-id: 07734ed0ef35edceef3addfc79ccf4b1496fbdaa Diffstat:
M | vim/after/ftplugin/markdown.vim | | | 40 | +++++++++++++++++++++++++++++++--------- |
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim @@ -1,19 +1,41 @@ +" Mappings inoremap <buffer> ;1 # inoremap <buffer> ;2 ## inoremap <buffer> ;3 ### inoremap <buffer> ;4 #### inoremap <buffer> ;5 ##### inoremap <buffer> ;6 ###### +nnoremap <buffer> <leader><CR> :silent !open "%<.pdf"<CR>:redraw!<CR> + +" Autocommands +if g:loaded_dispatch + augroup markdown_autocmds + au! * <buffer> + au BufWrite <buffer> Dispatch proselint % + augroup END +else + function! s:proselint_buffer() + compiler proselint + make + copen + compiler markdown + endfunction + augroup markdown_autocmds + au! * <buffer> + au BufWrite <buffer> call s:proselint_buffer() + augroup END +endif + +" Settings compiler markdown setlocal wrap setlocal conceallevel=2 -nnoremap <buffer> <leader><CR> :silent !open "%<.pdf"<CR>:redraw!<CR> -if exists('b:undo_ftplugin') - let b:undo_ftplugin .= '| imapc <buffer>' - let b:undo_ftplugin .= '| nmapc <buffer>' - let b:undo_ftplugin .= '| setlocal makeprg< conceallevel< wrap<' -else - let b:undo_ftplugin = ' imapc <buffer>' - let b:undo_ftplugin = ' nmapc <buffer>' - let b:undo_ftplugin .= '| setlocal makeprg< conceallevel< wrap<' + +" Undo_ftplugin +if !exists('b:undo_ftplugin') + let b:undo_ftplugin = '' endif +let b:undo_ftplugin .= '| imapc <buffer>' +let b:undo_ftplugin .= '| nmapc <buffer>' +let b:undo_ftplugin .= '| execute "au! markdown_autocmds * <buffer>"' +let b:undo_ftplugin .= '| setlocal makeprg< conceallevel< wrap<'