On 17.06.12 11:25, ping song wrote: > On Sun, Jun 17, 2012 at 10:18 AM, ping song <[email protected]> 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 -- Unix isn't hard, it's just a lot. (Ascribed to one of its originators) -- 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
