aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-05 12:34:51 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-05 12:34:51 +1200
commit19b81a4278166f79fc1093702fe7d254981f8dfd (patch)
tree70fccf5da620dce430439ea941c0bec581f64100
parentUse += shorthand in Vim ftplugin (diff)
downloaddotfiles-19b81a4278166f79fc1093702fe7d254981f8dfd.tar.gz
dotfiles-19b81a4278166f79fc1093702fe7d254981f8dfd.zip
Add global options for markdown_autoformat.vim
-rw-r--r--vim/ftplugin/markdown/autoformat.vim32
1 files changed, 19 insertions, 13 deletions
diff --git a/vim/ftplugin/markdown/autoformat.vim b/vim/ftplugin/markdown/autoformat.vim
index f714dad4..4b7e2f77 100644
--- a/vim/ftplugin/markdown/autoformat.vim
+++ b/vim/ftplugin/markdown/autoformat.vim
@@ -38,7 +38,9 @@ if !exists('*s:Load')
endif
endfunction
endif
-call s:Load()
+if !exists('g:markdown_autoformat_load') || g:markdown_autoformat_load
+ call s:Load()
+endif
" Suspend auto-formatting when in a code block (four-space indent)
if !exists('*s:Line')
@@ -54,12 +56,14 @@ if !exists('*s:Line')
endif
endfunction
endif
-augroup ftplugin_markdown_autoformat
- autocmd!
- autocmd BufWinEnter,CursorMoved,CursorMovedI,WinEnter
- \ <buffer>
- \ call s:Line()
-augroup END
+if !exists('g:markdown_autoformat_line') || g:markdown_autoformat_line
+ augroup ftplugin_markdown_autoformat
+ autocmd!
+ autocmd BufWinEnter,CursorMoved,CursorMovedI,WinEnter
+ \ <buffer>
+ \ call s:Line()
+ augroup END
+endif
" Suspend auto-format when pasting anything with a linebreak
if !exists('*s:Put')
@@ -75,12 +79,14 @@ if !exists('*s:Put')
endif
endfunction
endif
-nnoremap <buffer> <silent>
- \ p
- \ :<C-u>call <SID>Put('p')<CR>
-nnoremap <buffer> <silent>
- \ P
- \ :<C-u>call <SID>Put('P')<CR>
+if !exists('g:markdown_autoformat_put') || g:markdown_autoformat_put
+ nnoremap <buffer> <silent>
+ \ p
+ \ :<C-u>call <SID>Put('p')<CR>
+ nnoremap <buffer> <silent>
+ \ P
+ \ :<C-u>call <SID>Put('P')<CR>
+endif
" Undo all the above
if exists('b:undo_ftplugin')