1

By pure coincidence, I hit CTRL+w and then Tab while editing a C++ file, and what happened is that the window was horizontally split and the new window loaded the buffer where the word under the entity was presumably defined.

I can reproduce this behavrior even with vim -Nu NONE thatfile.cpp.

Then I tried the same with the cursor on std::cout, but that gave me a E387, which at least led me to a seemingly relevant documentation page, but that page has no match for the regex \cctrl-w.*\_..*tab, so I assume I'm in the wrong place.

On the other hand, that page seems to describe something similar to what I'm observing, even if it associates it to another combo:

To split the current window and jump to the tag under the cursor use this command:

                          CTRL-W ]

But with CTRL+w,] I get E433 and E426 if my cursor is on std::cout, for instance.

To be precise, the jump is not exactly accurate. If I'm on filter on last line, CTRL+w, Tab leads me to /usr/include/meta/meta.hpp, whereas it should bring me to /usr/include/range/v3/view/filter.hpp, as YouCompleteMe does.

So, what am I seeing?

1 Answer 1

2

For historic reasons, <Tab> and <C-i> are indistinguishable in Vim (look up the ASCII table). When you pressed <C-w><Tab>, you actually pressed <C-w><C-i>, which is described under :help ctrl-w_ctrl-i:

Open a new window, with the cursor on the first line that contains the keyword under the cursor.

which is part of the larger :help include-search feature.

The errors you get are pretty much self-explanatory if you know that you are using include search:

  • E387: Match is on current line

    It probably means a) that Vim didn't find includes or b) that it found includes but didn't find the keyword under the cursor in them.

or tag search:

  • E433: No tags file

    Vim didn't find a tags file at the expected location (see :help 'tags').

  • E426: Tag not found: foo

    Therefore it couldn't find a tag for the keyword under the cursor.

The "<Tab> is <C-i>" business is mentioned under :help <Tab>. Both tag search and include search are quite thoroughly explained in chapter 29 of the user manual: :help usr_29. Poking Vim at random has always been a losing strategy. Don't.

1
  • Well, was actually an unintentionally mistaken keystroke :D
    – Enlico
    Commented Sep 7, 2023 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.