How to list all C function name in vim

2,825 views
Skip to first unread message

robert song

unread,
Jul 1, 2010, 9:35:24 PM7/1/10
to vim...@googlegroups.com
Hi, everyone.

Is there any plugin to list all C function name of a C file in Quickfix list,
also with the glocal and local variables. It's helpful to get a
general view of the file.

Best Regards,
robert

Marc Weber

unread,
Jul 1, 2010, 9:46:59 PM7/1/10
to vim_use
Hi Robert.

Excerpts from robert song's message of Fri Jul 02 03:35:24 +0200 2010:


> Hi, everyone.
>
> Is there any plugin to list all C function name of a C file in Quickfix list,
> also with the glocal and local variables. It's helpful to get a
> general view of the file.

No. AFAIK not.

However there are (maybe even better) alterantives:

tlist plugin. Or the TToc plugin (vim plugin library tlib).

Marc Weber

robert song

unread,
Jul 1, 2010, 10:37:43 PM7/1/10
to vim...@googlegroups.com
Hi, marc,

> However there are (maybe even better) alterantives:
>
> tlist plugin. Or the TToc plugin (vim plugin library tlib).

Nice, I tried tlist, and variable and function can be listed.

Best Regards,
robert

Javier Rojas

unread,
Jul 2, 2010, 1:29:58 AM7/2/10
to vim...@googlegroups.com
On Fri, Jul 02, 2010 at 10:35:24AM +0900, robert song wrote:
> Hi, everyone.
>
> Is there any plugin to list all C function name of a C file in Quickfix list,
> also with the glocal and local variables. It's helpful to get a
> general view of the file.

you might like the folding feature. Read about it here

:help usr_28

and in this case, you want folding by syntax, which works out of the box
with c/c++ files. See

:help 28.7

to get folding on your C/C++ file, do a

:set foldmethod=syntax

on the file

--
Javier Rojas

GPG Key ID: 0x24E00D68

signature.asc

Christian Brabandt

unread,
Jul 19, 2010, 2:33:54 PM7/19/10
to vim...@googlegroups.com
Hi Javier!

On Fr, 02 Jul 2010, Javier Rojas wrote:

> On Fri, Jul 02, 2010 at 10:35:24AM +0900, robert song wrote:
> > Hi, everyone.
> >
> > Is there any plugin to list all C function name of a C file in Quickfix list,
> > also with the glocal and local variables. It's helpful to get a
> > general view of the file.
>
> you might like the folding feature.

you could also use vimgrep, e.g. for the vim source, I use something
like this:

:vimgrep /^\w\+\ze(/j %

or you could use an even fancier method by filling the quickfix list or
location list window using setqflist() or setloclist() function
manually. But this would require a little bit scripting and probably
isn't worth the trouble.

Mit freundlichen Gr��en
Christian
--
Viele Gedenkminuten h�tten durch Denkminuten verhindert werden k�nnen.
-- Hoimar von Ditfurth

Reply all
Reply to author
Forward
0 new messages