Function name in status bar

158 views
Skip to first unread message

Salvatore Benedetto

unread,
Aug 28, 2009, 9:22:38 AM8/28/09
to vim...@googlegroups.com
Hi,

is it possible to have the function name, while editing a C/C++ file
in the status bar (or whatever it's called) beside the opened file
and the line number?

Regards,
S.

David Lam

unread,
Aug 28, 2009, 11:32:27 AM8/28/09
to vim...@googlegroups.com
yup you can- i asked the same question a month ago... sylvain's answer works perfect:

http://markmail.org/message/td2wimogjbcdwtd2

Mikalai Chaly

unread,
Aug 28, 2009, 2:54:42 PM8/28/09
to vim...@googlegroups.com


If you are using taglist plugin, there is such ability. Just open :help taglist.txt and search for "status line".

Here is an example from taglist help file:

    :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)

Looks pretty nice, at least in .c files.

Mikalai

David Chanters

unread,
Aug 28, 2009, 5:10:07 PM8/28/09
to vim...@googlegroups.com
2009/8/28 Mikalai Chaly <nch...@gmail.com>:

>
>
> If you are using taglist plugin, there is such ability. Just open :help
> taglist.txt and search for "status line".
>
> Here is an example from taglist help file:
>
>     :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)
>
> Looks pretty nice, at least in .c files.

Hmm, I extraced the taglist plugin under ~/.vim/ as per the
instructions and updated my statusline setting in ~/.vimrc so it looks
like this:

set statusline=%<%#MyGitBranch#%{GitBranchInfoString()}%*\
%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)\ %h%m%r%=%-14.(%l,%c%V%)\ %P

(If this mailer wraps that line it's actually all on one line in my ~/.vimrc)

Yet I see *nothing* printed out on my statusline when editing .c
files, and I even manually:

:so ~/.vim/plugin/taglist.vim

.... just in case, but that had no effect for the statusline. I can
use other features of the taglist plugin whether I manually source it
or not, so I know it's loading up just fine.

Any ideas why I might not see the function name?

Thanks!

David

Mikalai Chaly

unread,
Aug 29, 2009, 2:15:51 AM8/29/09
to vim...@googlegroups.com

Yes - from the beginning function name is empty.

I'm not expert in taglist, so I can just make an assumption.  I suppose, plugin automatically updates its dictionary files only when taglist window is visible.

I was succeeded to show function name using ":TlistAddFiles %"

So - that task can be automated somehow :)

Mikalai

Salvatore Benedetto

unread,
Sep 3, 2009, 5:46:19 AM9/3/09
to vim...@googlegroups.com
Any other way beside taglist plugin?

Because I don't use it, I just use ctags and cscope, which
should be the equivalent to taglist if I understood correctly
the plugin after a quick read.

Thannks to all for the replies.

Regards,
S.

Gary Johnson

unread,
Sep 3, 2009, 11:24:12 AM9/3/09
to vim...@googlegroups.com
On 2009-09-03, Salvatore Benedetto wrote:
> Any other way beside taglist plugin?
>
> Because I don't use it, I just use ctags and cscope, which
> should be the equivalent to taglist if I understood correctly
> the plugin after a quick read.

There is this one, which I use.

ctags.vim : Display function name in the title bar and/or the status line
http://vim.sourceforge.net/scripts/script.php?script_id=610

Regards,
Gary


Reply all
Reply to author
Forward
0 new messages