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

I continue to use 'hjkl' to navigate in vi(m) because using the arrow keys requires me to move my whole arm. This is an awkward movement that requires time for my fingers to find the arrow keys. When using 'hjkl' to navigate, my right hand is always on home row, ready to either navigate or start typing. When typing in non-vi text boxes (such as this one), I do this movement, but I don't like it.

I do have an inefficiency: I move my hand for the escape key (which I should remap to caps lock, but I've never gotten around to it in the past decade), but I pivot at the elbow. It's far less awkward.



Try:

inoremap jj <Esc>

In insert mode you just press j twice and you get out of insert mode. This is my favorite key remap in vim.

You can put that in your .vimrc file or just try it out from the command bar.


I started using inoremap jk <Esc>

I'm not sure why, but I found it to be more fluid for me?


I have both in my rc file but I end up using jj 99% of the time. jk does feel pretty fluid though.


Try jw.


inoremap jj <Esc>

Same solution here. This favors people who tend to move from top to bottom during skimming a piece of code utilizing the j-key to move further down, which then let's you automagically exit EDIT-mode. Happens to me every fourth/fifth time.

Earlier it was more often. However, as skills develop I increasingly rarely use the hjkl-keys.

These days vim is placed at the end of a git/grep toolchain and most likely I tend to "/\v" for something or move more like "45j" directly to the place in focus (relativenumbers are your friend). Being in a row the natural tendency now is to jump with "f" or "F" and repeating with ";" if necessary.

If you passed this milestone already, your opinion is highly welcome!


I like to use hjkl for very short moves, wb for most moves in a sentence, "IA" for insert moves to the start or end of a line. I don't find f to be that useful because I don't like the thought required to figure out what letter I want. I guess it's just a personal preference though.

larger moves are a mix of the {}() and /\v if I know what I am looking for by name. c-f c-b is nice if I am just browsing the code.


It's not the act of doing the remapping. It's accepting that I'll have to retrain my brain.


inoremap <ESC> <NUL> gets you in the habit pretty fast.


True. Though, it gets better quickly and then it's quickly a net plus.


Remap caps lock to escape. After I did this I realized Esc is a really useful key in a wide variety of contexts.


make capslock to contorl, then use xcape

https://github.com/alols/xcape

now capslock does both ctrl and escape

best settings ever!


Great idea, thanks!

I've dealt with this by switching ctrl and alt - I find hitting alt with my thumb is far less strenuous than reaching for ctrl with my pinky.

I may give xcape a shot, however.


Man does that ever look awesome


One of the best ideas I ever had. Caps Lock is one of the biggest keys on my keyboard and close to the rest. It would be a waste to use it for a single, rarely-used function.


Capslock is already ctrl.

Now, I could dmap ctrl-l to esc. But I'm so used to the high-left pivot for 'esc' on Thinkpad keypads (and it's a tall key making for an easier target) that it's not worth the bother.


After switching between keyboards with Esc in different places, I've learned to use

    Ctrl-[
instead. Can hit it without moving that far, and it works just as well in GVim as it does in all terminal programs.

The only downside is being confused when nothing happens in a browser...


I learnt that `Ctrl-W` removes a whole word backwards in vim and the terminals.

The only downside is being confused when


You could use Ctrl+C which works great for getting out of insert mode. Also Ctrl+J can be used instead as Enter. It also does work great in bash/zsh. It took me some time to switch but it was totally worth it. Caution: Switching caps lock with control was needed as prerequisite.


The downside of ^c is that it doesn't trigger an InsertLeave event or abbreviations. Which can be a pain, or exactly what you want, depending on the occasion.


Remap caps lock to control and use ^c or ^[




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

Search: