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
function! vimwiki#base#AddHeaderLevel()
function! vimwiki#base#AddHeaderLevel(...)
if a:1 > 1
call vimwiki#base#AddHeaderLevel(a:1 - 1)
endif
let lnum = line('.')
let line = getline(lnum)
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
@ -1646,7 +1649,10 @@ function! vimwiki#base#AddHeaderLevel()
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 line = getline(lnum)
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')
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
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')
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
endif
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')
nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader