2016国外网站设计欣赏,企业邮箱购买价格,网站功能建设中,大连巨人网络推广有限公司修改下vim的一些ctags相关快捷键#xff0c;个人用着顺手点。
小结如下#xff1a;
normal模式下的gk#xff0c;用来打开一个预览窗口预览函数定义#xff08;需要ctags生成好tags文件#xff09;。normal模式下的gd#xff0c;修改映射为ctrl]#xff0c;即跳转到函…修改下vim的一些ctags相关快捷键个人用着顺手点。
小结如下
normal模式下的gk用来打开一个预览窗口预览函数定义需要ctags生成好tags文件。normal模式下的gd修改映射为ctrl]即跳转到函数定义vim内置的ctags的跳转。normal模式下的F5用来替换优化下原来的gd我的个人用法是优化作用是高亮当前单词并加入vim的搜索mode中这样按下n可以跳到下一个位置N可以上一个位置。
以下是具体内容加入到 ~/.vimrc中即可。 preview defination in a preview windownnoremap gk :ptag expand(cword), This can not be used...
func PreviewSymbol()let l:word_under_cursor expand(cword)echo find def for symbol . l:word_under_cursor :ptag (l:word_under_cursor)execute ptag . l:word_under_cursor
endf
nnoremap gk :call PreviewSymbol()CRlet g:current_word_match_id -1
function! ToggleHighlightCurrentWord() if has hightword already, clear itif g:current_word_match_id ! -1silent! call matchdelete(g:current_word_match_id)let g:current_word_match_id -1returnendiflet l:current_word expand(cword) if empty, do nothingif empty(l:current_word)returnendif Use the same color with Search highlight grouphighlight link CurrentWord Search set highlight and store the highlighted word to current_word_match_id let g:current_word_match_id matchadd(CurrentWord, \ . escape(l:current_word, \) . \) set cur highlighted word as vims search patternexecute let / \\ . escape(l:current_word, \) . \\
endfunction Bind this function to F5
nnoremap F5 :call ToggleHighlightCurrentWord()CR
nnoremap leaderg :call ToggleHighlightCurrentWord()CRnnoremap gd c-]
nnoremap gt c-]