aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-04 18:09:36 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-04 18:09:36 +1200
commitd0fbc06579efafd175fce6a6a7b5460d55311d11 (patch)
treeaa527db01c8f8865bd18233810b9ffb2a54a6efa /vim/after/ftplugin
parentUse heuristics on Markdown to guess autoformat (diff)
downloaddotfiles-d0fbc06579efafd175fce6a6a7b5460d55311d11.tar.gz
dotfiles-d0fbc06579efafd175fce6a6a7b5460d55311d11.zip
Set and clear Markdown autocmd in group
Diffstat (limited to 'vim/after/ftplugin')
-rw-r--r--vim/after/ftplugin/markdown/autoformat.vim17
1 files changed, 13 insertions, 4 deletions
diff --git a/vim/after/ftplugin/markdown/autoformat.vim b/vim/after/ftplugin/markdown/autoformat.vim
index 8e476158..2bb4f87c 100644
--- a/vim/after/ftplugin/markdown/autoformat.vim
+++ b/vim/after/ftplugin/markdown/autoformat.vim
@@ -17,10 +17,16 @@ endif
" that is longer than 'textwidth'
call ftplugin#markdown#autoformat#Load()
-" Suspend auto-formatting when in a code block (four-space indent)
-autocmd BufWinEnter,CursorMoved,CursorMovedI,WinEnter
- \ <buffer>
- \ call ftplugin#markdown#autoformat#Line()
+" Group autocommands
+augroup ftplugin_markdown_autoformat
+ autocmd!
+
+ " Suspend auto-formatting when in a code block (four-space indent)
+ autocmd BufWinEnter,CursorMoved,CursorMovedI,WinEnter
+ \ <buffer>
+ \ call ftplugin#markdown#autoformat#Line()
+
+augroup END
" Suspend auto-format when pasting anything with a linebreak
nnoremap <buffer> <silent>
@@ -34,4 +40,7 @@ nnoremap <buffer> <silent>
if exists('b:undo_ftplugin')
let b:undo_ftplugin = b:undo_ftplugin
\ . '|setlocal formatoptions<'
+ \ . '|augroup ftplugin_markdown_autoformat'
+ \ . '|autocmd!'
+ \ . '|augroup END'
endif