mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated vim plugins
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:go_decls_var = {
|
||||
\ 'init': 'ctrlp#decls#init()',
|
||||
\ 'exit': 'ctrlp#decls#exit()',
|
||||
@ -20,7 +24,7 @@ function! ctrlp#decls#init() abort
|
||||
endfunction
|
||||
|
||||
function! ctrlp#decls#exit() abort
|
||||
unlet! s:decls s:current_dir s:target
|
||||
unlet! s:decls s:target
|
||||
endfunction
|
||||
|
||||
" The action to perform on the selected string
|
||||
@ -32,10 +36,6 @@ function! ctrlp#decls#accept(mode, str) abort
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
let dir = getcwd()
|
||||
try
|
||||
" we jump to the file directory so we can get the fullpath via fnamemodify
|
||||
" below
|
||||
execute cd . s:current_dir
|
||||
|
||||
let vals = matchlist(a:str, '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|')
|
||||
|
||||
" i.e: main.go
|
||||
@ -50,14 +50,10 @@ function! ctrlp#decls#accept(mode, str) abort
|
||||
call ctrlp#acceptfile(a:mode, filepath)
|
||||
call cursor(line, col)
|
||||
silent! norm! zvzz
|
||||
finally
|
||||
"jump back to old dir
|
||||
execute cd . fnameescape(dir)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! ctrlp#decls#enter() abort
|
||||
let s:current_dir = fnameescape(expand('%:p:h'))
|
||||
let s:decls = []
|
||||
|
||||
let l:cmd = ['motion',
|
||||
@ -117,7 +113,7 @@ function! ctrlp#decls#enter() abort
|
||||
call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s",
|
||||
\ decl.ident . space,
|
||||
\ decl.keyword,
|
||||
\ fnamemodify(decl.filename, ":."),
|
||||
\ fnamemodify(decl.filename, ":p"),
|
||||
\ decl.line,
|
||||
\ decl.col,
|
||||
\ decl.full,
|
||||
@ -151,4 +147,8 @@ function! ctrlp#decls#cmd(mode, ...) abort
|
||||
return s:id
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
Reference in New Issue
Block a user