diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-05 01:42:46 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-05 01:42:46 +1300 |
commit | 8d7d5421f500d193e565fc9bfad8f1a67d77f762 (patch) | |
tree | 2a5003534b68ef2e7b0da0a40621d0cd041b211b /vim/config | |
parent | Use :echoerr not :echomsg for 'fo'-'a' absence (diff) | |
download | dotfiles-8d7d5421f500d193e565fc9bfad8f1a67d77f762.tar.gz dotfiles-8d7d5421f500d193e565fc9bfad8f1a67d77f762.zip |
Map <leader>j to toggle 'fo'-'j' flag in Vim
This is implemented in the same way as done for 'fo'-'a'; testing for
the presence of the flag based on known version tests first.
Diffstat (limited to 'vim/config')
-rw-r--r-- | vim/config/format.vim | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vim/config/format.vim b/vim/config/format.vim index 64a0a35b..759b5110 100644 --- a/vim/config/format.vim +++ b/vim/config/format.vim @@ -15,18 +15,12 @@ endif " " Use toggle_option_flag.vim plugin to bind quick toggle actions for some -" 'formatoptions' flags: +" 'formatoptions' flags; both of the above, plus: " " 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.0 (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 " if has('eval') && has('user_commands') @@ -49,4 +43,15 @@ if has('eval') && has('user_commands') \ :<C-U>echoerr 'No formatoptions a-flag'<CR> endif + " 'j' needs testing + if s:formatoptions_has_j + nnoremap <silent> + \ <Leader>j + \ :<C-U>ToggleOptionFlagLocal formatoptions j<CR> + else + nnoremap <silent> + \ <Leader>j + \ :<C-U>echoerr 'No formatoptions j-flag'<CR> + endif + endif |