From efda105c223c31b91945706167b19bf8143a1a77 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 00:05:45 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 6902da17..b3b6d4ef 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v1.47.0 -Sun Aug 5 21:59:08 UTC 2018 +tejr dotfiles v1.48.0 +Tue Aug 7 12:05:45 UTC 2018 -- cgit v1.2.3 From 05282eb4f03dba38006344b566d4f22ba1689217 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 11:46:32 +1200 Subject: Add mappings to move through quoted mail blocks --- vim/after/ftplugin/mail.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 2917425d..7c67987f 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -61,3 +61,11 @@ nnoremap \ l \ :call FlagUnimportant() let b:undo_ftplugin .= '|nunmap l' + +" Maps to move to the next blank line content-wise (i.e. quoted still counts) +nnoremap [ + \ :call search('\m^[ >]*$', 'bW') +nnoremap ] + \ :call search('\m^[ >]*$', 'W') +let b:undo_ftplugin .= '|nunmap [' + \ . '|nunmap ]' -- cgit v1.2.3 From ffaa0071e0e865701656c3d3ebe2115c25de5725 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 11:58:30 +1200 Subject: Add operator-pending analogues to quote para maps --- vim/after/ftplugin/mail.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 7c67987f..e7548b3c 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -67,5 +67,11 @@ nnoremap [ \ :call search('\m^[ >]*$', 'bW') nnoremap ] \ :call search('\m^[ >]*$', 'W') +onoremap [ + \ :call search('\m^[ >]*$', 'bW') +onoremap ] + \ :call search('\m^[ >]*$', 'W') let b:undo_ftplugin .= '|nunmap [' \ . '|nunmap ]' + \ . '|ounmap [' + \ . '|ounmap ]' -- cgit v1.2.3 From 6ad8bfc39501fe74708899734c16d89bc8241ada Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 13:16:56 +1200 Subject: Improve ,[ and ,] mappings in mail --- vim/after/ftplugin/mail.vim | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index e7548b3c..66064401 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -63,14 +63,29 @@ nnoremap let b:undo_ftplugin .= '|nunmap l' " Maps to move to the next blank line content-wise (i.e. quoted still counts) +function! s:NewBlank(num, up) abort + let l:num = a:num + let l:par = 0 + while l:num <= line('$') + if getline(l:num) =~# '^[ >]*$' + if l:par + break + endif + else + let l:par = 1 + endif + let l:num += a:up ? -1 : 1 + endwhile + execute l:num +endfunction nnoremap [ - \ :call search('\m^[ >]*$', 'bW') + \ :call NewBlank(line('.'), 1) nnoremap ] - \ :call search('\m^[ >]*$', 'W') + \ :call NewBlank(line('.'), 0) onoremap [ - \ :call search('\m^[ >]*$', 'bW') + \ :call NewBlank(line('.'), 1) onoremap ] - \ :call search('\m^[ >]*$', 'W') + \ :call NewBlank(line('.'), 0) let b:undo_ftplugin .= '|nunmap [' \ . '|nunmap ]' \ . '|ounmap [' -- cgit v1.2.3 From e54b958e17f984234eef2a4ca44a0d4ed299aadf Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 13:24:05 +1200 Subject: Check both ends of the line range for mail maps --- vim/after/ftplugin/mail.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 66064401..62039585 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -66,7 +66,7 @@ let b:undo_ftplugin .= '|nunmap l' function! s:NewBlank(num, up) abort let l:num = a:num let l:par = 0 - while l:num <= line('$') + while l:num > 0 && l:num <= line('$') if getline(l:num) =~# '^[ >]*$' if l:par break -- cgit v1.2.3 From 7cb43d08fb4f6c749b384bf7218b39557e824c47 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 13:28:15 +1200 Subject: Allow count prefixes for ,[ and ,] in mail --- vim/after/ftplugin/mail.vim | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 62039585..b10a79ab 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -63,29 +63,34 @@ nnoremap let b:undo_ftplugin .= '|nunmap l' " Maps to move to the next blank line content-wise (i.e. quoted still counts) -function! s:NewBlank(num, up) abort - let l:num = a:num - let l:par = 0 +function! s:NewBlank(start, count, up) abort + let l:block = 0 + let l:blocks = 0 + let l:num = a:start while l:num > 0 && l:num <= line('$') if getline(l:num) =~# '^[ >]*$' - if l:par + if l:block + let l:block = 0 + let l:blocks += 1 + endif + if l:blocks == a:count break endif else - let l:par = 1 + let l:block = 1 endif let l:num += a:up ? -1 : 1 endwhile execute l:num endfunction nnoremap [ - \ :call NewBlank(line('.'), 1) + \ :call NewBlank(line('.'), v:count1, 1) nnoremap ] - \ :call NewBlank(line('.'), 0) + \ :call NewBlank(line('.'), v:count1, 0) onoremap [ - \ :call NewBlank(line('.'), 1) + \ :call NewBlank(line('.'), v:count1, 1) onoremap ] - \ :call NewBlank(line('.'), 0) + \ :call NewBlank(line('.'), v:count1, 0) let b:undo_ftplugin .= '|nunmap [' \ . '|nunmap ]' \ . '|ounmap [' -- cgit v1.2.3 From 9ca1c72bbd022e366c59e2800e33780a6a7fff1a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 13:46:29 +1200 Subject: Add and revise some comments --- vim/after/ftplugin/mail.vim | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index b10a79ab..0082ea78 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -62,27 +62,49 @@ nnoremap \ :call FlagUnimportant() let b:undo_ftplugin .= '|nunmap l' -" Maps to move to the next blank line content-wise (i.e. quoted still counts) +" Move through quoted paragraphs like normal-mode `{` and `}` function! s:NewBlank(start, count, up) abort + + " Flag for whether we've started a block let l:block = 0 + + " Flag for the number of blocks passed let l:blocks = 0 + + " Iterate through buffer lines let l:num = a:start while l:num > 0 && l:num <= line('$') + + " If the line is blank if getline(l:num) =~# '^[ >]*$' + + " If we'd moved through a non-blank block already, reset that flag and + " bump up the block count if l:block let l:block = 0 let l:blocks += 1 endif + + " If we've hit the number of blocks, end the loop if l:blocks == a:count break endif + + " If the line is not blank, flag that we're going through a block else let l:block = 1 endif + + " Move the line number or up or down depending on direction let l:num += a:up ? -1 : 1 endwhile + + " Move to line (needs jumps and marks setting) execute l:num + endfunction + +" Maps using NewBlank() function above for quoted paragraph movement nnoremap [ \ :call NewBlank(line('.'), v:count1, 1) nnoremap ] -- cgit v1.2.3 From 3662143c82a3ea2b4393993ff8794810dc73abf0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Aug 2018 14:02:22 +1200 Subject: Use normal G for line jump to update jumplist And also the '' mark --- vim/after/ftplugin/mail.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 0082ea78..657c98ca 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -100,7 +100,7 @@ function! s:NewBlank(start, count, up) abort endwhile " Move to line (needs jumps and marks setting) - execute l:num + execute 'normal '.l:num.'G' endfunction -- cgit v1.2.3