4 ms·
(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)
by Lio 6y ago
(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)
- slim 6y agoYou may be using vim wrong. Good for you if you like it that way
- Lio 6y agoYou'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.
- slim 6y agomy 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.
- dhagz 6y agoCan'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/ https://hhkeyboard.us/pro-classic/
- Lio 6y agoNo 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.
- jng 6y agoUsing 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.
- Steltek 6y agoPolitely, 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.
- slim 6y agoI'll do. Thank you. I did not realise I was mean because english is not my native language
- pixel_fcker 6y agoEven better: map held Caps to Ctrl and a tap of Caps to Esc
- boogies 6y agoI 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/configuration/configure-complex-modifications/ https://karabiner-elements.pqrs.org/docs/manual/configuratio... in macOS.
- 0x008 6y agoOmg that is such a game changer for me. way more ergonimic than hitting esc
- teddyh 6y agoNote: Often Ctrl-3 does the same thing.
- Lio 6y agoThat'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.
- ryan-allen 6y agoI'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.
- Lio 6y agoHaving 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.
- sieste 6y agoI 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.
- contravariant 6y agoNote, don't do this if you're Dutch, words with 'jk', or rather 'ijk' in them are annoyingly common.
- griffinheart 6y agoI 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.
- verytrivial 6y agoThis 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!