Eric Leenman wrote:
Hi,

On my Windows XP machine I have two mappings like below, and they work.

 noremap <C-Left>  b
 inoremap <c-\><c-n> <C-left>

 noremap <C-Right> w
 inoremap <c-\><c-n> <C-Right>

Why doesn't these work on my Linux machine?
Is CTRL handled different under Linux then under Windows?

Regards,
Eric

[advertisement snipped]

Under Linux, many key combinations are preempted by the window manager, so that Vim never sees them. It may or may not depend on which window manager you use. Mine uses Ctrl-Fx to switch virtual desktops within the X display, so I have to use Shift-Fx in my owncoded mappings instead. Some Ctrl-letter combos are preempted too or maybe they aren't located at the same keyboard location: one which is very annoying is Ctrl-] (go to tag or helptag under cursor): for that one I have set up the following mapping:

   map    <F9>    <C-]>

so I can still follow hotlinks in the help, though by hitting F9 instead of Ctrl-]. Double-clicking the mouse still works but I rarely use the mouse in Vim.

To see if Vim receives something for a particular key combo, hit it, in Insert mode and preceded by Ctrl-V (or by Ctrl-Q if you use Ctrl-V to paste on the same machine). The byte(s) (if any) that Vim receives from the keyboard will be inserted, or, for a special key in gvim, the <> key designation (such as <S-F9> for Shift-F9). (For instance, when I hit on my Linux machine what used to give Ctrl-] on my Belgian keyboard under Windows, I get $, i.e., just as if Ctrl hadn't been depressed.) If Vim receives nothing (and 'showcmd' is set), ^V will remain displayed near the right end of the command line. Hit the spacebar to insert a space and return to "normal" Insert mode.


Best regards,
Tony.

Reply via email to