aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-08 14:51:37 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-08 14:51:37 +1200
commit21a1149b3dcbb1d87ba9ffc44360960c5ea40981 (patch)
treee5f6be46b236a989bcbeb95b0cf1434f6cb0e536
parentb1556e5af023f05dcfd4d4014e932ce55e882e4e (diff)
parent3662143c82a3ea2b4393993ff8794810dc73abf0 (diff)
downloaddotfiles-1.49.0.tar.gz
Merge branch 'release/v1.49.0'v1.49.0
* release/v1.49.0: Use normal G for line jump to update jumplist Add and revise some comments Allow count prefixes for ,[ and ,] in mail Check both ends of the line range for mail maps Improve ,[ and ,] mappings in mail Add operator-pending analogues to quote para maps Add mappings to move through quoted mail blocks Bump VERSION
-rw-r--r--VERSION4
-rw-r--r--vim/after/ftplugin/mail.vim56
2 files changed, 58 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
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index 2917425d..657c98ca 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -61,3 +61,59 @@ nnoremap <buffer>
\ <LocalLeader>l
\ <C-U>:call <SID>FlagUnimportant()<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>l'
+
+" 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 'normal '.l:num.'G'
+
+endfunction
+
+" Maps using NewBlank() function above for quoted paragraph movement
+nnoremap <buffer> <silent> <LocalLeader>[
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 1)<CR>
+nnoremap <buffer> <silent> <LocalLeader>]
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 0)<CR>
+onoremap <buffer> <silent> <LocalLeader>[
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 1)<CR>
+onoremap <buffer> <silent> <LocalLeader>]
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 0)<CR>
+let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>['
+ \ . '|nunmap <buffer> <LocalLeader>]'
+ \ . '|ounmap <buffer> <LocalLeader>['
+ \ . '|ounmap <buffer> <LocalLeader>]'