vim CTRL-] keys isn't functioning as expected
Asked Answered
H

11

22

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.

How to fix it? Or maybe I'm reading :help wrong?

Hensley answered 19/7, 2012 at 14:8 Comment(6)
Are you using the "English (US)" keyboard layout? Is your ] key located just left of the Enter key? Do you have to press Shift to get a "]"?Cameraman
Yes, yes and no. Thanks, at least i'm reading it right.Hensley
That's strange. Have you tried :tag quickref (just a random tag) or double clicking on a tag in gvim? Do these at least work?Cameraman
Did you generate a tags file with ctags?Fricative
:tag {tag_name} is working and double click too. I fooled around with this script bundle: link, and made everything according to its README including call pathogen#helptags(). Does it changes keymapping?Hensley
For me it worked with Ctrl - ^Differentia
A
21

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
Acanthocephalan answered 19/7, 2012 at 16:33 Comment(1)
Don't forget: :verbose nmap <C-]> will tell you who rebound your key whereUralic
I
8

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).

Indict answered 11/11, 2015 at 22:13 Comment(1)
Thanks. This did the trick for me too. I am also using a German keyboard and just couldn't figure out why it's not working...Goodhumored
A
2

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

Adaadabel answered 4/3, 2021 at 21:23 Comment(0)
D
1

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.

Draught answered 6/5, 2013 at 10:16 Comment(1)
This one solved my problems on console, but not on GUI.Overstride
T
1

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 + ].

Tarriance answered 2/1, 2015 at 6:5 Comment(0)
Y
1

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
Yak answered 30/5, 2019 at 13:20 Comment(0)
J
1

On a Danish keybord on Windows 10 this works:

Ctrl + ¨

¨ is the diuresis or umlaut sign, positioned to the right of 'å'.

Jelle answered 29/12, 2022 at 8:12 Comment(0)
F
0

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.

Familiarity answered 13/10, 2016 at 10:0 Comment(0)
B
0

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

Bratton answered 4/12, 2019 at 15:21 Comment(0)
P
0

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>

Preschool answered 6/1, 2021 at 18:1 Comment(0)
P
0

Same solution for a german qwertz-keyboard -> CTRL-+ did the trick! Thanks!

Parent answered 11/11, 2022 at 20:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.