From 9e20cbd7294ef76d2b7270b56af59fb82fea5785 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 5 Nov 2017 01:16:46 +1300 Subject: Block 'formatoptions' 'a' flag on old Vim versions If I ever care, this needs more careful testing to find the version in which the flag was added. --- vim/config/format.vim | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'vim') diff --git a/vim/config/format.vim b/vim/config/format.vim index 688b60c9..40019d0a 100644 --- a/vim/config/format.vim +++ b/vim/config/format.vim @@ -9,22 +9,36 @@ endif " Use toggle_option_flag.vim plugin to bind quick toggle actions for some " 'formatoptions' flags: " +" c - Automatically wrap comments at 'textwidth' (which I allow the filetypes +" to set for me) +" t - Automatically wrap text at 'textwidth' (as above) +" +" Only in Vim >= 7.1 (I think): +" " a - Automatically format paragraphs, reapplying the wrap on every text " insertion or deletion; sometimes I want this and sometimes I " don't, it particularly varies when typing prose in Markdown that " includes headings and code -" c - Automatically wrap comments at 'textwidth' (which I allow the filetypes -" to set for me) -" t - Automatically wrap text at 'textwidth' (as above) " if has('eval') && has('user_commands') - nnoremap - \ a - \ :ToggleOptionFlagLocal formatoptions a + + " 'c' and 't' have both been around since at least 6.1 nnoremap \ c \ :ToggleOptionFlagLocal formatoptions c nnoremap \ t \ :ToggleOptionFlagLocal formatoptions t + + " 'a' is newer + if v:version >= 701 + nnoremap + \ a + \ :ToggleOptionFlagLocal formatoptions a + else + nnoremap + \ a + \ :echomsg 'No "formatoptions" "a" flag in Vim < 7.1' + endif + endif -- cgit v1.2.3