Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What key do you press in Vim more often than any other? Esc! Not on the home row (although I'm sure you'll say you remap it to tab).


Esc is also C-[, and if you've mapped Control to the home row (eg, swapped with CapsLock) then it's not so bad either.


If you remap Esc to jk you don't even have to lift your fingers.


Another common one is Capslock.


Mapping capslock to be esc is what made vim possible for me.


Agreed. I don't know how anybody could use vi with escape unmapped. It's also very useful outside vi though, since esc is the default 'cancel' key in many cases. For example, most browser dialogs (and keyboard-navigable menus) can be closed with esc, and it works for many desktop dialogs too (at least on Linux).


Im too lazy to move two fingers for that, instead mine is mapped to jj. =P


What is jk?


Just key 'j' followed by 'k'. I have this in my vimrc for quickly jumping out of insert mode: inoremap jk <ESC>


To each his own. I'm very fluid with my esc key hitting. I find it to be a very satisfying motion.


imap jk <Esc> In insert mode. First press j, in the same second press k.


Esc? Not quite. C-c mostly. It differs sometimes from Esc, but rarely enough for me not to care.


I haven't pressed the escape button in the past few years using vim. Do something like `imap lkj <ESC>` and `vmap lkj <ESC>`. It's way nicer.


Remap to tab? Insanity!

I remap it to Caps Lock of course.


Where the Tab key is now is where the Escape key was on the system Bill Joy developed Vi.


Ah, right, I forgot what the common remap was, thought I'd get that wrong, thanks for the correction.


The more common remap is probably capslock->ctrl, for both vim and emacs users, I but I definitely prefer capslock->escape. During normal operation, my left pinky rides the gap between a and escape(aka capslock). Pressing either requires the slightest of deflections to the left or right.

I keep escape as escape as well. Capslock is absolutely worthless to me.


Or use PCKeyboardhack and I forget the other plugin but on a Mac, I have a brief caps lock mapped as esc, but holding it is control. it works effortlessley.


On my chromebook pixel, there is a super/windows key (labeled as a "search" key) where the capslock normally is on a US keyboard. Since I use super as the prefix key for all of my window manager shortcuts, I use xcape (https://github.com/alols/xcape) to allow that key to function both as super (if I hold it down) and as escape (if I tap it).

These sort of systems are a great way to remap keys; I wish such remapping was exposed by operating systems in a nice stock way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: