vim CTRL-] keys not working

梦想的初衷 提交于 2019-12-08 14:47:25

问题


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?


回答1:


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



回答2:


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




回答3:


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.




回答4:


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




回答5:


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.




回答6:


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



回答7:


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



来源:https://stackoverflow.com/questions/11562654/vim-ctrl-keys-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!