mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
Add option guard and undo
Signed-off-by: Rob B <github@0x7e.net>
This commit is contained in:
parent
c8e39c0127
commit
a5da18c6ab
@ -49,26 +49,33 @@ if !exists('*' .. expand('<SID>') .. 'GoKeywordPrg')
|
|||||||
endfunc
|
endfunc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
noremap <silent> <buffer> ]] <Cmd>call <SID>GoFindSection('next_start', v:count1)<CR>
|
if !exists("no_plugin_maps") && !exists("no_go_maps")
|
||||||
noremap <silent> <buffer> ][ <Cmd>call <SID>GoFindSection('next_end', v:count1)<CR>
|
noremap <silent> <buffer> ]] <Cmd>call <SID>GoFindSection('next_start', v:count1)<CR>
|
||||||
noremap <silent> <buffer> [[ <Cmd>call <SID>GoFindSection('prev_start', v:count1)<CR>
|
noremap <silent> <buffer> ][ <Cmd>call <SID>GoFindSection('next_end', v:count1)<CR>
|
||||||
noremap <silent> <buffer> [] <Cmd>call <SID>GoFindSection('prev_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>
|
||||||
|
let b:undo_ftplugin ..= ''
|
||||||
|
\ . '| unmap <buffer> ]]'
|
||||||
|
\ . '| unmap <buffer> ]['
|
||||||
|
\ . '| unmap <buffer> [['
|
||||||
|
\ . '| unmap <buffer> []'
|
||||||
|
endif
|
||||||
|
|
||||||
function! <SID>GoFindSection(dir, count)
|
function! <SID>GoFindSection(dir, count)
|
||||||
mark '
|
mark '
|
||||||
let c = a:count
|
let c = a:count
|
||||||
while c > 0
|
while c > 0
|
||||||
if a:dir == 'next_start'
|
if a:dir == 'next_start'
|
||||||
keepjumps call search('^\(type\|func\)\>', 'W')
|
keepjumps call search('^\(type\|func\)\>', 'W')
|
||||||
elseif a:dir == 'next_end'
|
elseif a:dir == 'next_end'
|
||||||
keepjumps call search('^}', 'W')
|
keepjumps call search('^}', 'W')
|
||||||
elseif a:dir == 'prev_start'
|
elseif a:dir == 'prev_start'
|
||||||
keepjumps call search('^\(type\|func\)\>', 'bW')
|
keepjumps call search('^\(type\|func\)\>', 'bW')
|
||||||
elseif a:dir == 'prev_end'
|
elseif a:dir == 'prev_end'
|
||||||
keepjumps call search('^}', 'bW')
|
keepjumps call search('^}', 'bW')
|
||||||
endif
|
endif
|
||||||
let c -= 1
|
let c -= 1
|
||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
Loading…
x
Reference in New Issue
Block a user