On 25/09/11 18:02, Roy Fulbright wrote:
I currently have the following mapping, which works fine, to move to the
next tab in my edit session:

noremap <silent><Leader><right> :tabnext<CR>

It would be much more convenient to use CTRL + Right Arrow instead of
backslash (my Leader character) + Right Arrow.
I've tried:

noremap <silent><C><right> :tabnext<CR>
noremap <silent><C-right> :tabnext<CR>

but neither of these work. I've looked at help map, help expr, and help
leader but found no answer.
Can someone show me how to map CTRL + Right Arrow?

Thanks in advance,

Roy

1. Maybe Vim doesn't get the Ctrl-Right combination. To determine if that is the case, put Vim in Insert mode then hit Ctrl-V (or Ctrl-Q if your Ctrl-V is remapped to the paste operation) followed by Ctrl-Right. If nothing appears in the buffer (and, assuming that you have 'showcmd' on, ^V remains displayed near bottom right of the Vim screen), then Vim doesn't get the Ctrl-Right combo and there's nothing to be done, other than selecting a different {lhs} for your mapping, or using gvim, which should recognise the keystroke correctly.

2. Maybe Vim gets the Ctrl-Right but sees it as no different than something else. Still in Insert mode, hit Ctrl-K followed by Ctrl-Right. If Vim displays <C-Right> it has correctly seen the keystroke and you should be able to map it (by using <C-Right> as your {lhs}). If it displays <Right> it has seen the keystroke but as if you hadn't held Ctrl down: this means your terminal passes Ctrl-Right as if it were just <Right>. Anything else means the key has been misidentified.

3. If the key is seen, but not as itself and not as some recognizable key, then there is probably an error in the termcap for the current terminal. In that case

        :set term?

will tell you which termcap entry Vim is using. If you don't see the same 'term' value on a different type of console (which can happen: e.g. on my system, KDE konsole and "true" xterm are both detected as xterm), you can try to add the following to your vimrc:

        if &term == <termname>
                set <C-Right>=<keycode>
        endif

where <termname> above should be replaced by the value of 'term' (with quotes around it) and <keycode> by what you get when hitting Ctrl-V followed by Ctrl-Right in Insert mode (with nothing around it). <C-Right> should be left as-is (9 characters). Don't forget that in a :set command, white space is not allowed between the = sign and the value, and any space, double quote, vertical bar or backslash present as part of the value must be backslash-escaped.


Best regards,
Tony.
--
"I have the world's largest collection of seashells.  I keep it
scattered around the beaches of the world ... Perhaps you've seen it.
                -- Steven Wright

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

Reply via email to