From 23d41f8c71f272a736906fbeb8d46441aa38dd66 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 May 2013 09:47:00 +1200 Subject: formatoptions should not be set in vimrc I have learned my lesson --- vim/after/ftplugin/mail.vim | 7 +++++-- vim/after/ftplugin/markdown.vim | 3 +++ vim/vimrc | 12 ------------ 3 files changed, 8 insertions(+), 14 deletions(-) create mode 100644 vim/after/ftplugin/markdown.vim (limited to 'vim') diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 2d623e67..a7e4daa8 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -1,3 +1,6 @@ -" Make emails slightly less of a pain to type -setlocal formatoptions+=aw +" Auto-format within textwidth +setlocal formatoptions+=a + +" Use trailing whitespace to denote continued paragraph +setlocal formatoptions+=w diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim new file mode 100644 index 00000000..8366275b --- /dev/null +++ b/vim/after/ftplugin/markdown.vim @@ -0,0 +1,3 @@ +" Auto-format within textwidth +setlocal formatoptions+=a + diff --git a/vim/vimrc b/vim/vimrc index 0c8a3538..bbe90f98 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -78,8 +78,6 @@ endif " Formatting set expandtab -set formatoptions=croqn1 -silent! set formatoptions+=j set smarttab set nojoinspaces set shiftround @@ -87,16 +85,6 @@ set shiftwidth=4 set softtabstop=4 set tabstop=4 nnoremap J mzJ`z -if has('eval') - function! ToggleFormatFlag(flag) - let l:operation = (&formatoptions =~ a:flag) ? '-=' : '+=' - silent! exec 'setlocal formatoptions' . l:operation . a:flag - setlocal formatoptions? - endfunction - nnoremap a :call ToggleFormatFlag('a') - nnoremap c :call ToggleFormatFlag('c') - nnoremap t :call ToggleFormatFlag('t') -endif " History set history=1000 -- cgit v1.2.3