Allow AddHeaderLevel and RemoveHeaderLevel to take counts

This commit is contained in:
Henry Qin 2019-02-11 14:29:17 -08:00
parent b4c9a4f028
commit 8941508e35
2 changed files with 11 additions and 4 deletions

View File

@ -1618,7 +1618,10 @@ function! vimwiki#base#TO_table_col(inner, visual)
endfunction endfunction
function! vimwiki#base#AddHeaderLevel() function! vimwiki#base#AddHeaderLevel(...)
if a:1 > 1
call vimwiki#base#AddHeaderLevel(a:1 - 1)
endif
let lnum = line('.') let lnum = line('.')
let line = getline(lnum) let line = getline(lnum)
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH') let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
@ -1646,7 +1649,10 @@ function! vimwiki#base#AddHeaderLevel()
endfunction endfunction
function! vimwiki#base#RemoveHeaderLevel() function! vimwiki#base#RemoveHeaderLevel(...)
if a:1 > 1
call vimwiki#base#RemoveHeaderLevel(a:1 - 1)
endif
let lnum = line('.') let lnum = line('.')
let line = getline(lnum) let line = getline(lnum)
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH') let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')

View File

@ -633,13 +633,14 @@ vnoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
if !hasmapto('<Plug>VimwikiAddHeaderLevel') if !hasmapto('<Plug>VimwikiAddHeaderLevel')
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
endif endif
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :<C-U>call vimwiki#base#AddHeaderLevel()<CR> nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :
\<C-U>call vimwiki#base#AddHeaderLevel(v:count)<CR>
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel') if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
endif endif
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel : nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
\<C-U>call vimwiki#base#RemoveHeaderLevel()<CR> \<C-U>call vimwiki#base#RemoveHeaderLevel(v:count)<CR>
if !hasmapto('<Plug>VimwikiGoToParentHeader') if !hasmapto('<Plug>VimwikiGoToParentHeader')
nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader