mirror of
https://github.com/vim/vim.git
synced 2025-07-24 10:45:12 -04:00
runtime(go): add section movement
Signed-off-by: Rob B <github@0x7e.net>
This commit is contained in:
parent
523f9f5898
commit
c8e39c0127
@ -49,6 +49,28 @@ if !exists('*' .. expand('<SID>') .. 'GoKeywordPrg')
|
|||||||
endfunc
|
endfunc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
noremap <silent> <buffer> ]] <Cmd>call <SID>GoFindSection('next_start', v:count1)<CR>
|
||||||
|
noremap <silent> <buffer> ][ <Cmd>call <SID>GoFindSection('next_end', v:count1)<CR>
|
||||||
|
noremap <silent> <buffer> [[ <Cmd>call <SID>GoFindSection('prev_start', v:count1)<CR>
|
||||||
|
noremap <silent> <buffer> [] <Cmd>call <SID>GoFindSection('prev_end', v:count1)<CR>
|
||||||
|
|
||||||
|
function! <SID>GoFindSection(dir, count)
|
||||||
|
mark '
|
||||||
|
let c = a:count
|
||||||
|
while c > 0
|
||||||
|
if a:dir == 'next_start'
|
||||||
|
keepjumps call search('^\(type\|func\)\>', 'W')
|
||||||
|
elseif a:dir == 'next_end'
|
||||||
|
keepjumps call search('^}', 'W')
|
||||||
|
elseif a:dir == 'prev_start'
|
||||||
|
keepjumps call search('^\(type\|func\)\>', 'bW')
|
||||||
|
elseif a:dir == 'prev_end'
|
||||||
|
keepjumps call search('^}', 'bW')
|
||||||
|
endif
|
||||||
|
let c -= 1
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user