]> git.rmz.io Git - dotfiles.git/commitdiff
vim: toggle formatoptions=a
authorSamir Benmendil <me@rmz.io>
Thu, 27 Aug 2015 00:45:56 +0000 (01:45 +0100)
committerSamir Benmendil <me@rmz.io>
Thu, 27 Aug 2015 01:33:49 +0000 (02:33 +0100)
vim/vimrc

index 717cfe0e63d597fb889bf8968c30cc52c05c044d..2cbf3b6d53ee1c46bcd7f58631f7fd55e5a6ee78 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -461,6 +461,11 @@ for idt in range(1,8)
   exe 'nnoremap co'.idt.' :set tabstop='.idt.' shiftwidth='.idt.' softtabstop='.idt.'<CR>'
 endfor
 
+" toggle auto format of text
+nnoremap coa :set <C-R>=&formatoptions =~ "a" ? 'formatoptions-=a' : 'formatoptions+=a'<CR><CR>
+nnoremap [oa :set formatoptions+=a<CR>
+nnoremap ]oa :set formatoptions-=a<CR>
+
 " space will toggle current fold in normal mode
 nnoremap <leader><Space> za
 " create folds around visual selection