diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-30 11:30:06 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-30 11:30:52 +1200 |
commit | 44a75be8dde590f8189fc53d1564868b1d03967c (patch) | |
tree | b12e50a3cecdd228d714af6985bd0b0b6eb7039e | |
parent | Leave final blank for mail line squeeze, not first (diff) | |
download | dotfiles-44a75be8dde590f8189fc53d1564868b1d03967c.tar.gz dotfiles-44a75be8dde590f8189fc53d1564868b1d03967c.zip |
Spin out repeated blank lines map to new plugin
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | vim/after/ftplugin/mail.vim | 12 | ||||
m--------- | vim/bundle/squeeze_repeat_blanks | 0 | ||||
-rw-r--r-- | vim/vimrc | 6 |
4 files changed, 16 insertions, 5 deletions
diff --git a/.gitmodules b/.gitmodules index ebf3872a..6d232f3e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -53,6 +53,9 @@ [submodule "vim/bundle/shebang_create_exec"] path = vim/bundle/shebang_create_exec url = https://sanctum.geek.nz/code/vim-shebang-create-exec.git +[submodule "vim/bundle/squeeze_repeat_blanks"] + path = vim/bundle/squeeze_repeat_blanks + url = https://sanctum.geek.nz/code/vim-squeeze-repeat-blanks.git [submodule "vim/bundle/strip_trailing_whitespace"] path = vim/bundle/strip_trailing_whitespace url = https://sanctum.geek.nz/code/vim-strip-trailing-whitespace.git diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index df0f043d..609cd92f 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -29,6 +29,13 @@ endif setlocal formatoptions+=w let b:undo_ftplugin .= '|setlocal formatoptions<' +" Define what constitutes a 'blank line' for the squeeze_repeat_blanks.vim +" plugin, if loaded, to include leading quotes and spaces +if exists('g:loaded_squeeze_repeat_blanks') + let b:squeeze_repeat_blanks_blank = '^[ >]*$' + let b:undo_ftplugin .= '|unlet b:squeeze_repeat_blanks_blank' +endif + " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_mail_maps') finish @@ -83,8 +90,3 @@ let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>[' \ . '|ounmap <buffer> <LocalLeader>]' \ . '|xunmap <buffer> <LocalLeader>[' \ . '|xunmap <buffer> <LocalLeader>]' - -" Quick map to strip multiple blank lines in the entire buffer; this comes up -" a lot when replying to stripped HTML mail -nnoremap <buffer> <silent> <LocalLeader>x - \ :<C-U>call mail#ContractMultipleBlankLines()<CR> diff --git a/vim/bundle/squeeze_repeat_blanks b/vim/bundle/squeeze_repeat_blanks new file mode 160000 +Subproject e0e624a9b467c9b99de5bd76c9eda73c0701464 @@ -365,6 +365,12 @@ if exists(':xmap') xmap <Bslash>x :StripTrailingWhitespace<CR> endif +" \X squeezes repeated blank lines via a custom plugin +nmap <Bslash>X :SqueezeRepeatBlanks<CR> +if exists(':xmap') + xmap <Bslash>X :SqueezeRepeatBlanks<CR> +endif + " \y shows all registers nnoremap <Bslash>y :<C-U>registers<CR> |