aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-08 13:28:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-08 13:43:40 +1200
commit7cb43d08fb4f6c749b384bf7218b39557e824c47 (patch)
tree65b3bfbba770f59b0afbeceb953d170a24b48a29
parente54b958e17f984234eef2a4ca44a0d4ed299aadf (diff)
downloaddotfiles-7cb43d08fb4f6c749b384bf7218b39557e824c47.tar.gz
dotfiles-7cb43d08fb4f6c749b384bf7218b39557e824c47.zip
Allow count prefixes for ,[ and ,] in mail
-rw-r--r--vim/after/ftplugin/mail.vim23
1 files 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 <buffer>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <LocalLeader>[
- \ :<C-U>call <SID>NewBlank(line('.'), 1)<CR>
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 1)<CR>
nnoremap <buffer> <silent> <LocalLeader>]
- \ :<C-U>call <SID>NewBlank(line('.'), 0)<CR>
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 0)<CR>
onoremap <buffer> <silent> <LocalLeader>[
- \ :<C-U>call <SID>NewBlank(line('.'), 1)<CR>
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 1)<CR>
onoremap <buffer> <silent> <LocalLeader>]
- \ :<C-U>call <SID>NewBlank(line('.'), 0)<CR>
+ \ :<C-U>call <SID>NewBlank(line('.'), v:count1, 0)<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>['
\ . '|nunmap <buffer> <LocalLeader>]'
\ . '|ounmap <buffer> <LocalLeader>['