Wednesday, December 4, 2013

Re: CTRL-] doesn't work ?

On 04/12/13 06:25, Yu Mao Kao wrote:
> Hi,
>
> There is one problem in my environment which running vim-7.4.86-1 on arch linux.
>
> CTRL-] does not jump to tags in my machine, simply in :help neither.
> However :ta, :tags, and g] work so well.
>
> I have done some test,
> :verbose nmap <C-]>
> shows nothing.
>
> And
> $ vim -u "NONE"
> to bypass all my vimrc and plugins.
>
> None has working CTRL-].
>
>
> How could I figure out this problem?
> Thanks for any help.
>
> Best regards,
> YMK
>

First of all, and especially if you aren't using both an en-US keyboard
on an en-US OS-locale, I'd recommend to ascertain whether your Ctrl-]
key is sending a Ctrl-] code. If it isn't, Vim cannot recognise it.

To do that, first make sure that 'showcmd' is on (which is not the Unix
default) then start a new buffer (by :enew or :new or :tabnew) then
start Insert mode and hit Ctrl-V followed by Ctrl-]

If nothing appears and ^V is still present near bottom right of your
screen, then Vim got nothing for your Ctrl-] -- otherwise whatever
appeared is the code your keyboard sent when you hit Ctrl-]. If it says
^] but you can put the cursor only on the ^ then it is correct;
otherwise go back to Normal mode and put the cursor on the inserted
code, then git ga

If it is what you expect (and you aren't running on an EBCDIC IBM-zOS
mainframe), Vim should tell you that it has value 29, Hex 1d, Octal 035.
Anything else is not the Ctrl-] code and in that case there are two
solutions:

1. (difficult, and doesn't always work) Hunt around on your keyboard,
including various combination with and without Ctrl, with and without
AltGr (if present), etc. until you find what you need to hit in order to
produce ^] (Hex 1d). Maybe it is not present on your keyboard.

2. (easy, and always works) Select a key (preferably a key in the F1-F12
series, with or without Shift) which doesn't yet have a function. When I
started using Vim (that was Vim 6.1) I couldn't find how to produce the
Ctrl-] code (I have learnt since then, that, at least on my current OS
and keyboard which aren't what I was using at the time, it is
AltGr-Ctrl-$ which isn't easy to type so I kept the "temporary"
solution) and I chose F9. So assuming that you also choose F9 (otherwise
replace that by whatever you choose) here are the mappings to add in
your vimrc:

map <F9> <C-]>
map! <F9> <C-]>

Then save your modified vimrc and restart Vim. This will make Vim "see"
a Ctrl-] whenever you hit F9 in any mode (except, I think, after Ctrl-
V or Ctrl-K in Insert or Command-line mode).


Best regards,
Tony.
--
"A radioactive cat has eighteen half-lives."

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: