Question

Hi I'm new to vim and I'm stuck. In :help tag it says that one can go to a tag definition using the CTRL-] keystroke. But I can't get this to work. I thought I messed some mappings with my plugins, so I cleaned .vimrc. But I still get cursor to a tag word (in help for example). I strike Ctrl and ] simultaneously and nothing happens.

Does anybody know how to fix it? Or maybe I'm reading :help wrong?

Was it helpful?

Solution

First, use the :verbose command (thanks to sehe) to know who rebound your key where.

:verbose nmap <C-]>

Then, if you cannot find where your key was rebound, bind yourCtrl-] key by the original one then retry:

:nnoremap <C-]> <C-]>

For more info:

:help mapping
:help :verbose
:help :noremap

OTHER TIPS

I have the same issue, and :verbose did not bring up anything useful. What I figured out is that Ctrl-+ takes me there.

Please note that I am using a German keyboard where the plus sign sits at the position of square bracket on a US keyboard. Maybe the code only looks at the location of the key (I remember reading something to that respect in combination with the Ctrl-key).

A somewhat late entry, but I had the same problem. Thought I'd share a possible solution so others wont have to go through the agony.

The solution in my case was: Press Ctrl and while keeping it pressed down, press ] twice!!! Whatever key combination you use to produce the right square bracket, ], do it twice!! I do not know why this works in my case. There's nothing in the help files that mentions this. Spent probably an hour or two trying to figure out the Ctrl-] combination until I came upon the solution by accident.

I was facing same problem on virtual box VM. The right ctrl key is to switch between the host and the guest environment. Try using left ctrl + ].

The problem is due to default setting of Virtual box. In Oracle Virtual Box you can see by default right control is using as Host key combination. Go to File -> Preferences-> Input and change Host key combination to "None". Initially for me also left ctrl worked and after the above changes both keys working.

For mee, "Ctrl-]" means "Ctrl+Alt GR+)". In other words,

  • Press "Ctrl"
  • Press "Alt GR" while "Ctrl" is pressed
  • Press ")" ("]" is also there) while the two above are pressed

This solution only works for linux in an X environment for non-us keyboard layouts.

I just struggled with this problem in linux with a swiss german keyboard layout. We type ] by pressing AltGr+¨, thus i would have to use AltGr+Ctrl+¨ to jump to the ctag definition, which is awkward.

What i did was to remap the ¨ (diaeresis) key to ] (bracketright)

  1. print current mapping for keycode 35:

    $> xmodmap -pke | grep 35 keycode 35 = dead_diaeresis exclam dead_diaeresis exclam bracketright dead_macron bracketright

  2. remap key (we just replace the first dead_diaeresis with bracketright):

    $> xmodmap -e 'keycode 35 = bracketright exclam dead_diaeresis exclam bracketright dead_macron bracketright'

Pressing keycode 35 (¨) will now print ] without the need of any modifier, and CTRL-] works to jump to the tag.

xmodmap -e can be executed as user without need for sudo, you can put it for example in your .profile.

see swiss-german layout for reference

I had this same problem and I solved it. In my case I was maping the key CTRL + F10. So I First hit CTRL + F10 in Vim insert mode and see what the key output is. In my case it was F36 then I simply map it in vimrc file as

map <F36> <CR>YOUR COMMAND<CR>

With macOS on a Norwegian keyboard: CTRL-] is CTRL-å

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top