News for hackers. Stuff that matters.
Re:How Did Vim Become So Popular? by Lio on Wednesday July 01, 2020 @02:20AM (#23698346)
(Funnily enough ctrl-[ is one of my most used shortcuts in vim. It’s a convenient alternative to escape if you map caps-lock to ctrl)
Re:How Did Vim Become So Popular? by pixel_fcker on Wednesday July 01, 2020 @02:49AM (#23698513)
Even better: map held Caps to Ctrl and a tap of Caps to Esc
Re:How Did Vim Become So Popular? by boogies on Friday July 03, 2020 @07:17PM (#23728469)
I map held Caps to Super (so I can switch windows and use other higher-than-application-level shortcuts without leaving the home row in dwm), but yes, definitely don't limit yourself to one use for your keyboard's most convenient key without a use. In X11 it's as easy as

    setxkbmap -option caps:super
    xcape -e 'Super_L=Escape'
(where setxkbmap is built into X, and xcape is a one-command install away). And IIUC you can do this with ~6 clicks in a third-party GUI like https://karabiner-elements.pqrs.org/docs/manual/configuratio... in macOS.
Re:How Did Vim Become So Popular? by griffinheart on Wednesday July 01, 2020 @08:13AM (#23700524)
I really don't like chord like shortcuts, while ctrl and [ are positioned in a way you don't have to contort your hand it kind of requires you to move away from the hjkl row or stretch your pinkies. Consider mapping esc to jk (as a sequence) it works surprisingly well.

  inoremap jk <esc> 
and

  inoremap <esc> <nop>
so that you never use esc again

not having chord like shortcuts was one of the main reasons that led me to try vim over emacs in the beginning, so I kind of think they're "anti" vim.

Re:How Did Vim Become So Popular? by ryan-allen on Wednesday July 01, 2020 @04:22AM (#23699175)
I've been using ctrl-[ for years, but have been experimenting with jj. Now I'm not sure which one I like better!

I switched back to vim+tmux (nvim) a few weeks ago from a number of years using vs-code with the vim keybindings.

I'm still trying to configure my plugins so that I don't feel like I'm repeating myself too often.

Re:How Did Vim Become So Popular? by Lio on Wednesday July 01, 2020 @04:27AM (#23699199)
Having ctrl-[ in your muscle memory has the advantage that it also works in other readline programs that have a vi like interfacee, e.g. bash, zsh and many db consoles.
Re:How Did Vim Become So Popular? by sieste on Wednesday July 01, 2020 @04:37AM (#23699268)
I recommend mapping jk to esc in insert mode (instead of jj), so you remain on the same line if you accidentally use it in normal mode.
Re:How Did Vim Become So Popular? by contravariant on Wednesday July 01, 2020 @07:10AM (#23700169)
Note, don't do this if you're Dutch, words with 'jk', or rather 'ijk' in them are annoyingly common.
Re:How Did Vim Become So Popular? by verytrivial on Wednesday July 01, 2020 @09:06AM (#23700883)
This is now my muscle memory escape key since an embarrassingly cheap Bluetooth keyboard of mine only allowed escape == home button on my Android devices.

Pro Tip: Park the flesh of your left palm near the left ctrl key and use that instead of your pinky for ctrl. I admit this feels a bit weird at first but avoids the need to lift your fingers from the home row. Super bonus: use ^H for backspace. Try it out!

Re:How Did Vim Become So Popular? by teddyh on Wednesday July 01, 2020 @03:35AM (#23698839)
Note: Often Ctrl-3 does the same thing.
Re:How Did Vim Become So Popular? by Lio on Wednesday July 01, 2020 @04:31AM (#23699224)
That's excellent!

That gives a left handed option for escape without leaving the home row. I really like having mirrored shortcuts like that, thank you.

Re:How Did Vim Become So Popular? by 0x008 on Wednesday July 01, 2020 @03:09AM (#23698634)
Omg that is such a game changer for me. way more ergonimic than hitting esc
Re:How Did Vim Become So Popular? by slim on Wednesday July 01, 2020 @02:36AM (#23698437)
You may be using vim wrong. Good for you if you like it that way
Re:How Did Vim Become So Popular? by Lio on Wednesday July 01, 2020 @04:29AM (#23699214)
You're going to have to explain that one because I generally switch back to command mode after every edit so I use ctrl-[ a lot.

I'd be VERY interested to hear why that's wrong and what you do differently.

Re:How Did Vim Become So Popular? by slim on Wednesday July 01, 2020 @09:42AM (#23701198)
my reasoning was : you could have mapped caps lock to ESC but you did not. So maybe you are using CTRL too much (CTRL-V maybe?) which is not the best way to use vim.
Re:How Did Vim Become So Popular? by Lio on Wednesday July 01, 2020 @11:17AM (#23702370)
No your reasoning is way off. I map to ctrl rather than escape because I want to make use of the Insert and Ex mode ctrl shortcuts.

For example, if I want to insert a register into the ex mode command line I use ctr-r <register>.

Or if I want to pop out of insert mode for a single command I use ctr-o.

E.g. inserting opening and closing tags when a suitable plugin isn't present. Insert the opening and closing tag, jump back to command mode with ctrl-o, move backwards and you're ready to insert more text.

Re:How Did Vim Become So Popular? by dhagz on Wednesday July 01, 2020 @10:36AM (#23701802)
Can't speak for everyone, but I use this[1] keyboard most of the time, and it doesn't have a Caps Lock key to remap, but instead has Control where Caps Lock normally is. So using ctrl-[ is much easier than reaching up to the escape key.

[1] https://hhkeyboard.us/pro-classic/

Re:How Did Vim Become So Popular? by jng on Wednesday July 01, 2020 @05:22AM (#23699550)
Using Ctrl-[ is perfectly fine if that's convenient to you. Some people doe "inoremap jj <esc>" and double tap j to exit insert mode. If it's faster for you than pressing regular escape, it's an improvement, and thus good.
Re:How Did Vim Become So Popular? by Steltek on Wednesday July 01, 2020 @10:51AM (#23701984)
Politely, I'd consider rephrasing this in the future. Not everyone springs forth into the world with a 5kloc .vimrc. Everyone is incrementally learning from someone else at their own pace.
Re:How Did Vim Become So Popular? by slim on Wednesday July 01, 2020 @01:10PM (#23703883)
I'll do. Thank you. I did not realise I was mean because english is not my native language