J. Erik Heinz wrote:
Hi,
A.J.Mechelynck <[EMAIL PROTECTED]> words
        on 12.03.2007 - 08:30 (+0100 Zulu-Time):

Simon Jackson wrote:
the following entries in my vimrc only work in gvim but will not work
in eterm, aterm or xterm:

nmap <C-S-tab> :tabprevious<cr>
nmap <C-tab> :tabnext<cr>
map <C-S-tab> :tabprevious<cr>
map <C-tab> :tabnext<cr>
imap <C-S-tab> <ESC>:tabprevious<cr>i
imap <C-tab> <ESC>:tabnext<cr>i

anyone know why?

Open Console Vim with an empty [No Name] buffer, hit i or a to start Insert mode, then hit Ctrl-K followed by one of the keys in the {lhs} of your mappings. The keyname should appear in <> notation. If it doesn't, hit Ctrl-V followed by the same key. You should see the bytestring sent by the keyboard interface appear in the buffer. If nothing appears, it means that key press doesn't reach Vim. For instance, in my kde window manager, Ctrl-Tab and Ctrl-Shift-Tab are intercepted by the window manager to mean "go to next/previous virtual desktop"; they never reach xterm or even gvim.

I always wondered why the tips didn't work when I tried to implement
this in my .vimrc, but now I know. Awsome.
I figured out that the keystroke CTRL + Tabulator at my Terminal
reach the vim with as <C-I>. Don't know why but with the shortcut in the
.vimrc it works fine.

With the method Tony describe ^I ( <C-I> ), was not shown, I tried it
with: * Open vim * : * CTRL + K * and then I tpyed the keystroke twice ( here: CTRL + Tabulart ) Finaly the shortcut was shown. Perhpas this helps.

Cheers -- Erik

* Warning: To Vim, <C-I> and <Tab> are the same (in "cooked" keyboard input, both are represented by 0x09). If you map the one and hit the other, Vim will execute your mapping.

* My method works in Insert mode, not in Command-line mode. I said to start with i or a (insert or append), not colon (start an ex-command).

* I just tested it: it works for special keys (e.g. Ctrl-Del), not printable keys. <Tab> is a printable key, it inserts between 1 and 8 blank character cells. Shift-Tab is not a printable key: in Insert mode, Ctrl-K Shift-Tab inserts the 7 characters <S-Tab>.

* In Insert mode, ^K^I^I does the same as just ^I (it inserts a hard tab). (On my system, Ctrl-Tab doesn't reach any X application, remember?). In /dev/tty (the non-X console), Vim sees (on my system) Ctrl-Tab as Tab. Ctrl-K Ctrl-Tab shows ^K^I at bottom left, showing that Vim waits for further input (in this case, the second keypress of a digraph). If I press the space bar then, it inserts one character which shows as <89> in blue (the non-printing Unicode codepoint U+0089, or "tab plus 0x80": Ctrl-K "anything-ASCII" "space" gives "anything-ASCII" plus 0x80). When we hit ^K^I^I previously, there was no ^I^I digraph, so the 2nd tab got inserted (e.g. there is no bc digraph, ^Kbc gives c).


Best regards,
Tony.
--
Mickey Mouse wears a Spiro Agnew watch.

Reply via email to