Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I list the functions in the current file in vim

Tags:

vim

I'm new to vim and wanted to know how I can list all functions inside the current file within vim.

like image 847
John Mike Avatar asked Oct 29 '17 00:10

John Mike


2 Answers

How can I list anything in the current file in vim?

The most basic command for listing all instances of a pattern is :help :global:

:g/foo      " if you have line numbers enabled
:g/foo/#    " if you don't

So, to list functions you would do something like :g/^func:

:g/^func

and then :78<CR> to jump to qf#GetList().

like image 193
romainl Avatar answered Sep 25 '22 20:09

romainl


Try this: I mapped to Ctrl-f (list functions) but you can map to any key you like Press Ctrl-f will list the functions. Then issue ":"line_no

like image 32
MINH LUONG Avatar answered Sep 25 '22 20:09

MINH LUONG