Monday, June 18, 2012

Re: VIM: best way to swap the Caps and esc, but JUST for vim

no luch trying this in windows/dygwin...
turn to some xwin issue (complaining no DISPLAY or something..)
will give up on this win crap..

于 2012/6/17 3:30, Erik Christiansen 写道:
> On 17.06.12 11:25, ping song wrote:
>> On Sun, Jun 17, 2012 at 10:18 AM, ping song <songpingemail@gmail.com> wrote:
>>> I don't want to affact other users/apps since this is not just my PC...
>>> what's the best practice so far to just swap the 2 keys for VIM? or at
>>> least, change caps to esc. most/all answers I got involves a
>>> system-wide configuration... thanks!
>
> AIUI, then, the core need is to make the mapping just for one user.
>
> The method I've become addicted to is user-specific, because the
> keyboard mapping is put in ~/.Xmodmap, not the system-wide file:
>
> $ cat ~/.Xmodmap
> keycode 0x42 = Escape
> clear Lock
>
> (Admittedly, that only moves Esc to Capslock, because I've never found
> Capslock useful, but it's easy enough to do two-way swaps.)
>
> If it is inconvenient for the alternate user to have to restart X, as
> another user, then there are enough examples of how to use "xmodmap -e"
> to flip keymappings back and forth on the fly, under the heading
> "EXAMPLES" in man xmodmap.
>
> The example which swaps Caps_Lock and Control_L could be tweaked to swap
> with Esc instead of the Left Control key. Although the manpage is not
> specific, I figure that you'd put the half a dozen lines into
> ~/.my_esc_toggle_thingy and do:
>
> $ xmodmap ~/.my_esc_toggle_thingy
>
> which in Vim should be mappable to a function key, or whatever.
> Alternatively, a simple shell alias could automate it:
>
> alias vim='xmodmap ~/.mett ; /usr/bin/vim ; xmodmap ~/.mett'
>
> (Shorter name, to avoid wrapping in the email.)
>
> The only problem with that is that now it _is_ only for Vim, so you lose
> keyboard consistency across applications. Still, it is what the subject
> line asks for.
>
> Give either method a try, and tell us how it went. ;-)
>
> Erik
>


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

No comments:

Post a Comment