News for hackers. Stuff that matters.
Re:To Master Vim, Use It Like Language by barbs on Thursday October 01, 2015 @09:44PM (#10316103)
> inoremap jk <ESC>

Using two keystrokes instead of ESC to leave insert mode is definitely a personal preference and not necessarily more efficient or comfortable.

Re:To Master Vim, Use It Like Language by 0942v8653 on Thursday October 01, 2015 @09:58PM (#10316167)
Way more useful (for me anyway) is mapping Capslock to ESC. It works with any vi anywhere as long as you are using your main machine to connect. Also with inoremap don't you have to wait for the letter j to show up until you type your next character? That would drive me crazy.

Edit now that I have actually looked at the article: Yes, you can map it to Control but for me it's an awkward place to put a modifier. What if you want to do Ctrl-A? Ctrl-C? At least the way I type, I'm better off using the one in the corner.

Re:To Master Vim, Use It Like Language by bonquesha99 on Friday October 02, 2015 @12:01AM (#10316672)
I have a similar remapping of Caps:

  * When I tap Caps, it's `<esc>`
  * When I hold Caps OR hit it in combination with any other key, it's `<ctrl>`
It really feels like the best of both worlds. I primarily develop on OSX, so I use https://pqrs.org/osx/karabiner/ to handle the remapping.
Re:To Master Vim, Use It Like Language by tremendo on Friday October 02, 2015 @03:32PM (#10320715)
This works great on my Linux machine. On the Mac though I hate that all Mac apps use Command for well, all command-key combinations instead of Ctrl, so I map the Caps-lock to Command instead, but while Karabiner can do the dual "Esc on tap plus other on hold" for Ctrl, Shift and Option keys, it cannot frustratingly do it for the Command key. ITerm can switch caps-lock back to Ctrl, but then I lose the Esc double function. It's maddening.
Re:To Master Vim, Use It Like Language by jagger27 on Friday October 02, 2015 @12:12AM (#10316693)
Oh man I had no idea Karabiner could do that. Thanks!
Re:To Master Vim, Use It Like Language by cryptonaut on Thursday October 01, 2015 @10:07PM (#10316214)
Was just about to post this. Though I map Caps-Lock to Esc through xmodmap so it works everywhere instead of just in Vim.
Re:To Master Vim, Use It Like Language by barbs on Thursday October 01, 2015 @10:47PM (#10316408)
I'd actually like to map Caps-Lock to ESC as well, but I'd prefer to make it vim-specific rather than system-specific, and there's no way to do that :(.
Re:To Master Vim, Use It Like Language by berkes on Friday October 02, 2015 @01:58AM (#10316948)
I have this too, but it can be infuriating when:

* I have to quickly explain something on my colleagues machine. * A colleague wants to show me something on my machine.

The `<esc>` is, I daresay, one of the most ingrained keys when operating a computer. When you keep mistyping it, levels of stress will go up.

Re:To Master Vim, Use It Like Language by colordrops on Thursday October 01, 2015 @10:10PM (#10316232)
I prefer to avoid remappings so that I can use vim at any machine without having to figure things out, so my preference for escape is Ctrl-[. It takes a bit of getting used to but once you get it, left hand never has to reach up anymore.
Re:To Master Vim, Use It Like Language by coryfklein on Friday October 02, 2015 @03:38PM (#10320783)
I wish I could use this, but Dvorak moves that [ just a little too high for this to be practical. :(
Re:To Master Vim, Use It Like Language by andrewstuart2 on Thursday October 01, 2015 @10:16PM (#10316255)
It's definitely more efficient. I've had it mapped that way for years, and after a short time it basically became a single keystroke.

The efficiency doesn't come from the fact that it's not as far to reach. The efficiency comes from the fact that you don't have to find home row with your left hand again and can continue your command sequence immediately.

Re:To Master Vim, Use It Like Language by octref on Thursday October 01, 2015 @09:47PM (#10316118)
Haven't used ESC since finding out Ctrl-C.
Re:To Master Vim, Use It Like Language by steve_b on Thursday October 01, 2015 @10:37PM (#10316356)
bonus is that Ctrl-C gets you out of pretty much any mode.

Also, while in insert mode, using ctrl-h for backspace and ctrl-w for delete word are really nice.

Re:To Master Vim, Use It Like Language by ThatGeoGuy on Friday October 02, 2015 @12:28AM (#10316738)
Better yet, ^[ is actually ESC in vi/vim, and works without a config change. I started using this last year and haven't looked back. ^C works well, but I recall it having some limitations in certain environments (though for the life of me I can't recall what they were).

In any case, I prefer ^[ to ^C, and hopefully you will too!

Re:To Master Vim, Use It Like Language by mikerichards on Thursday October 01, 2015 @10:46PM (#10316397)
ouch...as others have said, CAPS LOCK is your friend
Re:To Master Vim, Use It Like Language by nrivadeneira on Thursday October 01, 2015 @11:59PM (#10316665)
Why is caps lock your friend? I can't think of any situation where it'd be more useful than another key such as ESC or my personal preference, CTRL.
Re:To Master Vim, Use It Like Language by DoggettCK on Friday October 02, 2015 @12:18AM (#10316706)
One of the best things I've done, though I personally use 'jf', since they've both got little nubs on the keys, and I occasionally have to spell "Dijkstra".
Re:To Master Vim, Use It Like Language by function_seven on Friday October 02, 2015 @12:51AM (#10316787)
Same here. I did both jk and kj. When I want to leave insert mode, I just mash those keys.
Re:To Master Vim, Use It Like Language by nrivadeneira on Thursday October 01, 2015 @11:57PM (#10316659)
I actually use jj for the same thing. It's so much better than using ESC.