如何在vim中查看函数调用的位置?

时间:2022-01-21 19:18:44

I have been using vim and ctags for going over Perl files.
I was wondering the following:
Is there a way/plugin I can use so that I can press a key combination and be able to see all the places a function is called (as easily as I can jump to the definition of a function or view the list of all functions with the same name in all files of my project with ctags)?
I have read about cscope but I am not sure if it is usable for Perl or there is a solution for scripting languages.

我一直在使用vim和ctags来查看Perl文件。我想知道以下内容:是否有一个方法/插件我可以使用,以便我可以按一个组合键,并能够看到一个函数被调用的所有位置(就像我可以跳转到函数或视图的定义一样容易使用ctags在我的项目的所有文件中具有相同名称的所有函数的列表)?我已经阅读了有关cscope但我不确定它是否可用于Perl或者是否有脚本语言的解决方案。

1 个解决方案

#1


0  

Maybe this is what you are looking for:

也许这就是你要找的东西:

" Lists lines containing the word under the cursor. Type the line number
" followed by <CR> to jump to the corresponding line.
nnoremap [I [I:
xnoremap [I "vy:<C-u>ilist /<C-r>v<CR>:

" Same as above but for 'defines'
nnoremap [D [D:
xnoremap [D "vy:<C-u>dlist /<C-r>v<CR>:

Then position the cursor under a word and type [I or [D.

然后将光标放在一个单词下并键入[I或[D.

#1


0  

Maybe this is what you are looking for:

也许这就是你要找的东西:

" Lists lines containing the word under the cursor. Type the line number
" followed by <CR> to jump to the corresponding line.
nnoremap [I [I:
xnoremap [I "vy:<C-u>ilist /<C-r>v<CR>:

" Same as above but for 'defines'
nnoremap [D [D:
xnoremap [D "vy:<C-u>dlist /<C-r>v<CR>:

Then position the cursor under a word and type [I or [D.

然后将光标放在一个单词下并键入[I或[D.