by Nyubis · 11y ago · 0 comments
Why not simply rebind caps lock to escape? Caps lock is used awfully little, considering how prominent its position on the keyboard is. On Linux, you can rebind it by adding
setxkbmap -option caps:escape
to your .profile. If instead of an additional escape you prefer it to be swapped around, use setxkbmap -option caps:swapescape
This is perhaps the most impactful change on my vim workflow.Fair points. I'm gonna start out on the defensive: I didn't post the article, which kinda stinks because if I knew it was going to get such attention I would have updated it to my current setup. Anyways as the 1.5 year old article states:
This article will almost certainly fall out of date with my vimrc in the very near future
I don't do jk escape anymore. I have since abandoned custom escapes because I work often enough on remote servers with vanilla vimrcs that don't have custom escape bindings set that the penalty I pay having to stop and consider which environment I'm in before every escape wasn't worth the small quality of life enhancement from having it set locally.Good tip on caps lock, though I currently have it set to control which I find is a much better use of the key. Especially once you know about ctrl-o.
Anyway, I chortled after telling this to my wife, to which she looked at me with a puzzled look and asked me what the punchline was...
This is brilliant idea. And it works on OSX too - using http://apple.stackexchange.com/a/132569
Having caps as ctrl makes it really easy to hit.
As an added benefit, getting used to this layout will help you out with migrating out of vim to emacs.
BUT there's also a way to do something like: if you press and hold caps, it acts like control. but if you press and release quickly it acts like esc. stevelosh describes how to do that on osx here http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#cont... but i still haven't found a way of doing that on linux.
That keybinding works to go from insert to normal in most filetypes (looking at you sql) without the binding so unconfigured vims are still usable with it, and it's really easy to reach.
I will admit it's a little more awkward than caps-lock, but I use my caps-lock for ctrl and thus can caps-lock-c instead.
Escape isn't really useful anywhere else in the system, so capslock as ctrl or super makes more sense to me.
The downside however is when you're stuck using someone else's computer or don't have root on Mac and Windows. I don't find myself on someone else's machine often though, so for me it's worth it to not have that half second delay.
I encourage everyone to try it. The amount of times in the last year where i've had to actually type the string "jk" is exactly...one? I think, though perhaps I was imagining even that one. I suppose it really doesn't matter what you bind it to as long as you can execute the escape whilst keeping ALL of your fingers on that good ol' home row.
I guess I should also note that I never use vim except in my own environment where i know i have my own vimrc. I totally get why people who are always using remote computers without their vimrc would want to keep default key bindings and thus be forced to use ctrl-[.
This was my thought when I saw this mapping for the first time, and when I started customizing my vimrc I opted for using caps lock as well. It didn´t take long for me to change that and start using kj instead -- in the end it was more common for me to type constants in all-caps than typing "Reykjavik."
As for jf: I searched through the pdf of a 1300 page Norwegian dictionary, and the single word in there containing jf is the abbreviation "jfr." which is the same as the abbreviation "cf." (confer) in English. So jf appears to be a very good choice.
I'm currently working on a vimrc that caters to people like me, those who only use CapsLock to capitalize, and avoid all chording. When I'm done, maybe I can map Shift to Esc.
capslock remapped to ctrl jw for escape in vim
jw is convenient if capslock is used as a control key. I had to pay attention to what I was doing in a vim file in order to remember what I had escape mapped to :)
I tried to use Caps Lock instead of Ctrl, and it wasn't uncomfortable or anything, I just didn't get used to it. I don't remember how it happened that I started to use Ctrl again: maybe it's because I don't always use 1 computer and Ctrl is too important of a key to be looking for every time I need it on somebody else's keyboard. Anyways, currently Caps is Caps and I don't really use it often. Or maybe even ever.