From ee2e981cf9f7aa5f9a2d98979d49201ad522ca71 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 30 Aug 2018 09:44:29 +1200 Subject: Count quoted blank lines for mail line squeeze --- vim/autoload/mail.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim index 0c3b7eb7..f498006b 100644 --- a/vim/autoload/mail.vim +++ b/vim/autoload/mail.vim @@ -73,7 +73,7 @@ function! mail#ContractMultipleBlankLines() abort let l:deletions = [] let l:blank = 0 for l:num in range(1, line('$')) - if strlen(getline(l:num)) > 0 + if getline(l:num) !~# '^[> ]*$' let l:blank = 0 elseif l:blank let l:deletions += [l:num] -- cgit v1.2.3 From ef90fd3d15e77016c6552655c24c4a86c6e8567a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 30 Aug 2018 09:44:46 +1200 Subject: Leave final blank for mail line squeeze, not first --- vim/autoload/mail.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim index f498006b..967aac17 100644 --- a/vim/autoload/mail.vim +++ b/vim/autoload/mail.vim @@ -76,7 +76,7 @@ function! mail#ContractMultipleBlankLines() abort if getline(l:num) !~# '^[> ]*$' let l:blank = 0 elseif l:blank - let l:deletions += [l:num] + let l:deletions += [l:num - 1] else let l:blank = 1 endif -- cgit v1.2.3 From 44a75be8dde590f8189fc53d1564868b1d03967c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 30 Aug 2018 11:30:06 +1200 Subject: Spin out repeated blank lines map to new plugin --- .gitmodules | 3 +++ vim/after/ftplugin/mail.vim | 12 +++++++----- vim/bundle/squeeze_repeat_blanks | 1 + vim/vimrc | 6 ++++++ 4 files changed, 17 insertions(+), 5 deletions(-) create mode 160000 vim/bundle/squeeze_repeat_blanks 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 [' \ . '|ounmap ]' \ . '|xunmap [' \ . '|xunmap ]' - -" Quick map to strip multiple blank lines in the entire buffer; this comes up -" a lot when replying to stripped HTML mail -nnoremap x - \ :call mail#ContractMultipleBlankLines() diff --git a/vim/bundle/squeeze_repeat_blanks b/vim/bundle/squeeze_repeat_blanks new file mode 160000 index 00000000..e0e624a9 --- /dev/null +++ b/vim/bundle/squeeze_repeat_blanks @@ -0,0 +1 @@ +Subproject commit e0e624a9b467c9b99de5bd76c9eda73c0701464c diff --git a/vim/vimrc b/vim/vimrc index 80587d35..caa52867 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -365,6 +365,12 @@ if exists(':xmap') xmap x :StripTrailingWhitespace endif +" \X squeezes repeated blank lines via a custom plugin +nmap X :SqueezeRepeatBlanks +if exists(':xmap') + xmap X :SqueezeRepeatBlanks +endif + " \y shows all registers nnoremap y :registers -- cgit v1.2.3 From dd9bdb1cf0e30faaf006593d2fde0c8442fe82ec Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 30 Aug 2018 11:31:09 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index e4ace7d4..1f70db18 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v1.63.0 -Tue Aug 28 23:08:40 UTC 2018 +tejr dotfiles v1.64.0 +Wed Aug 29 23:31:09 UTC 2018 -- cgit v1.2.3