does VIM read OK the tags file if ctags was installed after VIM?

40 views
Skip to first unread message

Jose Caballero

unread,
Aug 14, 2017, 7:23:22 PM8/14/17
to vim use
Hi,

I am working on a host that didn't have ctags installed. I have just
installed it.
However, I think I am missing some step.
After creating the tags file, opening a file with VIM and hitting
CTRL+] on a string, it does not jump to the file with the definition.
It just gives me a comment like

"tag 1 of 20 or more"

It is not a problem with the path, as I do first

:set path+=**

Same tree directory on a different host with same version of VIM, but
ctags installed, works fine. CTRL+] gives me a list of options from
the tags files, asking me to type the number (index) I want.

Any hint? What are the key words I should use to search for the
solution myself in google or the :help?


Thanks a lot in advance,
Jose

Erik Christiansen

unread,
Aug 15, 2017, 6:24:34 AM8/15/17
to vim use
On 14.08.17 19:23, Jose Caballero wrote:
> I am working on a host that didn't have ctags installed. I have just
> installed it.

The install order won't make any difference. Vim only needs to find a
tags file you've generated.

> However, I think I am missing some step.
> After creating the tags file, opening a file with VIM and hitting
> CTRL+] on a string, it does not jump to the file with the definition.
> It just gives me a comment like
>
> "tag 1 of 20 or more"

I've never seen that response, so can only offer general ideas, based on
what has always worked for me.

> It is not a problem with the path, as I do first
>
> :set path+=**
>
> Same tree directory on a different host with same version of VIM, but
> ctags installed, works fine. CTRL+] gives me a list of options from
> the tags files, asking me to type the number (index) I want.

As it's the same directory structure, what happens if you copy the tags
file over, instead of generating it? (Oh, **, multiple tag files. Even
so.) Alternatively, install the new ctags on the working host, in a
different path, and use it to overwrite the working tags files, if
that's quicker.

Are the ctags executables identical? (I've tended to use "exhuberant
ctags", though the choice was made so many decades ago that I can't
recall the basis. The plain version wasn't as appealing, though.)

> Any hint? What are the key words I should use to search for the
> solution myself in google or the :help?

It sounds to me like the uncooperative response has to be due to
different tags files, as the Vim instances are identical.

Limited help, I'm afraid, but it's assumption-testing time. ;-)

Erik

Ben Fritz

unread,
Aug 15, 2017, 11:09:17 AM8/15/17
to vim_use, jcaball...@gmail.com
On Monday, August 14, 2017 at 6:23:22 PM UTC-5, Jose Caballero wrote:
> It is not a problem with the path, as I do first
>
> :set path+=**
>

'path' option should not matter. What is your 'tags' option set to? Is it finding the tags file you expect (and only the tags file you expect)?

Jose Caballero

unread,
Aug 15, 2017, 4:42:44 PM8/15/17
to vim_use
Thanks Ben and Erik.

Both tags files are identical:

host1 $ md5sum tags
34e5413f4dea1c0644b35de7808a8029 tags

host2 $ mad5sum tags
34e5413f4dea1c0644b35de7808a8029 tags

Also tags are equal:

:set tags?
tags=./tags,./TAGS,tags,TAGS


But, when hitting CTRL+] on top of a tag....

@ host1 I get the expected

# pri kind tag file
1 F C i StatusInterface plugins/status/Plugin.py
from interfaces import StatusInterface
2 F c StatusInterface interfaces.py
class StatusInterface(object):


@ host 2, I get something like "tag 1 of 2 or more", and that's it.

Both host have VIM 7.4.160

Huh?

Cheers,
Jose

Benji Fisher

unread,
Aug 15, 2017, 5:44:33 PM8/15/17
to vim_use
That seems odd.  I think that my first suggestions would have been the same as Ben and Erik's.

Does :ts help clarify the situation?

:help :tselect

It seems that the message about the number of tags only shows up if there is no other message.  Often, a tag command takes you to a new file, so you get a message about entering that file instead.  See

:help tag-matchlist

and scroll past the various commands, or :help :ltag and scroll just a little bit.

When there is no other message, Vim shows which matching tag has been jumped
to, and the number of matching tags: >
tag 1 of 3 or more
The " or more" is used to indicate that Vim didn't try all the tags files yet.
When using ":tnext" a few times, or with ":tlast", more matches may be found.
When you didn't see this message because of some other message, or you just
want to know where you are, this command will show it again (and jump to the
same tag as last time): >
:0tn

HTH
-- 
Benji Fisher

Jose Caballero

unread,
Aug 17, 2017, 2:35:32 PM8/17/17
to vim use
hmmm.
That is interesting.
In both cases, after trying a tag, :ts gives me the same, similar to

# pri kind tag file
1 F C i StatusInterface plugins/status/Plugin.py
from interfaces import StatusInterface
2 F c StatusInterface interfaces.py
class StatusInterface(object):

And, indeed, typing the number opens the right file, as it was
supposed to work with CTRL+]

It is like the actual command CTRL+] is the one that is not working in
one of the hosts, but the tags information has been read by VIM and
it's reachable via :ts

Cheers,
Jose

Gary Johnson

unread,
Aug 17, 2017, 2:51:56 PM8/17/17
to vim use
On 2017-08-17, Jose Caballero wrote:

> In both cases, after trying a tag, :ts gives me the same, similar to
>
> # pri kind tag file
> 1 F C i StatusInterface plugins/status/Plugin.py
> from interfaces import StatusInterface
> 2 F c StatusInterface interfaces.py
> class StatusInterface(object):
>
> And, indeed, typing the number opens the right file, as it was
> supposed to work with CTRL+]
>
> It is like the actual command CTRL+] is the one that is not working in
> one of the hosts, but the tags information has been read by VIM and
> it's reachable via :ts

You could execute

:verbose map <C-]>

where those are all printable characters and not a literal CTRL-],
to see if there is a mapping for CTRL-] and if it exists, where it
is defined.

Regards,
Gary

Jose Caballero

unread,
Aug 17, 2017, 3:04:32 PM8/17/17
to vim use
Thanks for the tip.
At this point, I need to do a little bit of googling, as I am not sure
how to interpret the results.

:verbose map <C-]>
No mapping found

:nmap
n [m *@:call <SNR>22_Python_jump('?^\s*\(class\|def\)')<CR>
n [[ *@:call <SNR>22_Python_jump('?^\(class\|def\)')<CR>
n ]m *@:call <SNR>22_Python_jump('/^\s*\(class\|def\)')<CR>
n ]] *@:call <SNR>22_Python_jump('/^\(class\|def\)')<CR>
n gx <Plug>NetrwBrowseX
n <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>


Here the problem is simply my lack of knowledge, I have homework to do.
Thanks anyways to everyone for your time and tips.

Cheers,
Jose

Nikolay Aleksandrovich Pavlov

unread,
Aug 17, 2017, 4:16:09 PM8/17/17
to vim...@googlegroups.com
One of the other things which may affect <C-]> is &iskeyword setting:
check `:verbose set iskeyword?`. Note that &iskeyword setting is
likely to be the culprint if presence of certain non-alphanumeric
characters (e.g. underscore) makes tag not possible to find: any sane
configuration for non-esoteric languages will include a-zA-Z0-9 in
&iskeyword.

>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jose Caballero

unread,
Aug 17, 2017, 6:02:59 PM8/17/17
to vim use
In both cases

:verbose set iskeword?
iskeyword=@,48-57,_,192-255

Benji Fisher

unread,
Aug 17, 2017, 11:14:29 PM8/17/17
to vim_use
On Thu, Aug 17, 2017 at 6:02 PM, Jose Caballero <jcaball...@gmail.com> wrote:
2017-08-17 16:15 GMT-04:00 Nikolay Aleksandrovich Pavlov <zyx...@gmail.com>:
> 2017-08-17 22:04 GMT+03:00 Jose Caballero <jcaball...@gmail.com>:
>> 2017-08-17 14:51 GMT-04:00 Gary Johnson <gary...@spocom.com>:
>>> On 2017-08-17, Jose Caballero wrote:
>>>
>>>> In both cases, after trying a tag, :ts gives me the same, similar to
>>>>
>>>>    # pri kind tag                 file
>>>>       1 F C i    StatusInterface  plugins/status/Plugin.py
>>>>                    from interfaces import StatusInterface
>>>>       2 F   c    StatusInterface  interfaces.py
>>>>                    class StatusInterface(object):
>>>>
>>>> And, indeed, typing the number opens the right file, as it was
>>>> supposed to work with CTRL+]
>>>>
>>>> It is like the actual command CTRL+] is the one that is not working in
>>>> one of the hosts, but the tags information has been read by VIM and
>>>> it's reachable via :ts

Wait a minute.   I missed something here.

The results of :ts look reasonable, except that I would expect one row (probably the first) to be marked with ">" to the left of the "#" column.

Are you expecting to see the same thing from <C-]> (that is, CTRL-])?  If the cursor is on the word "StatusInterface", then <C-]> should work the same as ":tag StatusInterface", jumping to the line specified in the tags file.  It does not normally show the list of matching tags (like :ts).  If <C-]> is mapped to something non-standard, it is non-standard on the first host, not the second.

:help :tag
:help :tselect

HTH
-- 
Benji Fisher
Reply all
Reply to author
Forward
0 new messages