aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-05 01:41:07 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-05 01:41:07 +1300
commitddc776dd2d08663525436bbe80823b36bc7e2b7e (patch)
tree59be3eb491355ba8afa03c0a46c73937c766b269
parentKeep script var cache of 'j' 'fo' flag support (diff)
downloaddotfiles-ddc776dd2d08663525436bbe80823b36bc7e2b7e.tar.gz
dotfiles-ddc776dd2d08663525436bbe80823b36bc7e2b7e.zip
Keep script var cache of 'a' 'fo' flag support
Use the result to decide how to map <Leader>a.
-rw-r--r--vim/config/format.vim9
1 files changed, 7 insertions, 2 deletions
diff --git a/vim/config/format.vim b/vim/config/format.vim
index 7d6fb2b1..a3a1a453 100644
--- a/vim/config/format.vim
+++ b/vim/config/format.vim
@@ -1,3 +1,8 @@
+" Figure out if we have the 'a' flag for 'formatoptions', to reapply
+" 'textwidth' wrapping to the current paragraph on every insertion or
+" deletion; keep in a script variable
+let s:formatoptions_has_a = v:version > 700
+
" Figure out if we have the 'j' flag for 'formatoptions', to automatically
" delete comment leaders when joining lines; keep it in a script variable
let s:formatoptions_has_j = v:version > 703
@@ -33,8 +38,8 @@ if has('eval') && has('user_commands')
\ <Leader>t
\ :<C-U>ToggleOptionFlagLocal formatoptions t<CR>
- " 'a' is newer
- if v:version >= 700
+ " 'a' needs testing
+ if s:formatoptions_has_a
nnoremap <silent>
\ <Leader>a
\ :<C-U>ToggleOptionFlagLocal formatoptions a<CR>