Robert Cussons wrote:
> I don't know what you mean by 'inside' Vim, when I start up gvim I have the
> command below in the .vimrc:
> !xmodmap ~/.speedswapper
xmodmap is an external command.
By "inside" Vim I mean "by purely Vim means" such as :map etc.
> where the file .speedswapper is as follows:
> remove Lock = Caps_Lock
> keysym Escape = Caps_Lock
> keysym Caps_Lock = Escape
> add Lock = Caps_Lock
> The trouble with having this is that each time I start a new gvim session it
> remaps back to the old keys. In other words it alternates between being the
> key mapping I want and the default one! I am using KDE on a linux network.
> What I want is once the key mapping is made for it to remain on (so
> maybe .vimrc is the wrong place for the command, as this is read everytime
> gvim is started) but I only want this mapping to be in place for gvim, not
> other applications and I have no idea how to achieve that!
xmodmap applies to the whole of X.
I don't think you can remap CapsLock for gvim and not for the rest of X
i.e. all other applications including the windows manager itself.
By executing that xmodmap command once at X startup (probably in a
"service" triggered by init when entering the appropriate runlevel,
number 5 IIRC) you could, if you have admin privileges on your system,
interchange Esc and CapsLock once and for all for all users of X11 on
that machine; but I guess you don't want that; and IIUC they would still
be unswapped on non-X terminals such as the virtual consoles /dev/tty.
P.S., Next time, please reply to the list (e.g., use "Reply to all") and
not just privately to me (i.e., "Reply to Sender"). That way you will
give other Vim users a chance to see your post, and you will get a reply
even if I'm not available or if it's something to which I don't know the