5 ms·
I think you're using the editor's modality wrong. ESC is not used to exit from Insert mode. ESC is used to switch from any mode back to Command mode. In fact C
by nakkiel 12y ago
I think you're using the editor's modality wrong.
ESC is not used to exit from Insert mode. ESC is used to switch from any mode back to Command mode. In fact Command mode is also called Normal mode. You should spend 95% of your time in Normal mode and use the other modes when you need them.
I suggest binding `kj` to ESC since it allows you to quickly make a change and continue browsing your code. Take the following session:
* Browse and spot something that needs to be changed
* Type `ci(messages, callbackkj`
* Keep browsing with `hjkl` as you're in Normal mode
While it may seem weird, I've yet to find an occurrence of `kj` in a program in years of using this binding and my hands haven't left the keyboard. The cognitive weight is zero as well (at least after building muscle memory).
Now, I believe it depends on the kind of programmers you are. My coworker is the kind who types in a lot of code and rewrites a lot of stuff. I'm the kind of rewires things and make subtle changes after spending a lot of time reading it. In other words it works well for me but probably wouldn't for him.
- disputin 12y agoNow, I believe it depends on the kind of programmers you are. My coworker is the kind who types in a lot of code and rewrites a lot of stuff. I'm the kind of rewires things and make subtle changes Interesting, I was thinking something similar - suitability for maintenance vs from scratch.
- afarrell 12y agoI use 'jj' rather than 'kj' and except for a pause after I type the first letter of 'join', it works well.
- StavrosK 12y agoInteresting coincidence, I was pasting a production certificate into Vim the other day and it contained "kj", which escaped the editor and ate a few letters until it reached an "i" and continued pasting. It took production down for 30 minutes until I noticed it. Remember, kids! ":set paste".
- jnetterf 12y ago"+p will paste the system clipboard.
- StavrosK 12y agoNo way! I just tried it, it doesn't work :( That's too bad.
- SEMW 12y agoAre you on a mac and using the system default vim? If so, Apple cripples it to not be able to directly access the system clipboard -- use homebrew's vim or macvim instead.
- StavrosK 12y agoNo, I'm on Ubuntu, it just looks like this method doesn't work with terminal vim. Your sibling comment looks like it has a solution, though!
- irahul 12y agoI am not sure which version of vim you are on. I have been using clibpoard paste for a long time in Ubunut. Do a ":version" in vim and check if it's compiled with +clipboard. If it is, then it should work. Also, you can have this in your vimrc: set clipboard=unnamedplus And then your vim copy-paste will be in sync with system clipboard(no need for +p or +y).
- tybenz 12y agoThat's for GUI Vim. If you're using Terminal VIM you can install this plugin: https://github.com/kana/vim-fakeclip https://github.com/kana/vim-fakeclip
- StavrosK 12y agoThank you, I'll try it right away!
- dllthomas 12y agoHaven't written many blackjack games?
- swah 12y agoIf I may use you as a random Vim power user, how do you quickly switch between project files?