3 ms·
The biggest thing that helped me was when I realized that it actually all makes sense. Every time you use vim and catch yourself repeating a command over and o
by hereonbusiness 12y ago
The biggest thing that helped me was when I realized that it actually all makes sense.
Every time you use vim and catch yourself repeating a command over and over (x, dd, hjkl) take a moment and think about if there is a more efficient way to do it by combining the commands you know.
Let's say you need to delete everything from you current cursor position to the next paren in the current line, ok you know that:
t -> move till char x in the current line
T -> move till previous char x in the current line
d -> delete
so you can combine that to:
dt( -> delete everything till next ( in line
Delete 10 lines, instead of 10 times "dd" you can just do: 10dd
Go from line 0 to line 20, instead of pressing j 20 times: 20G
Delete from current position to line 20: d20G
These are all really simple examples, but once you get the hang of it you move on to more complex stuff in no time, and you probably won't even have to look it up, it will just make sense.
- muraiki 12y agoYes, but there's a difference between "makes sense" and "I can do it without thinking, so it is a lot faster than pressing ctrl + right arrow a few times" which then leads to "maybe I'll use vim instead of Sublime Text after all." :)
- hereonbusiness 12y agoEverything takes time to master, but understanding/being able to make sense of something makes a big difference. You just started learning vim and are moving around with hjkl and x-ing words letter by letter, then you learn about moving with w/W and b/B and repeating/combining commands (2w, 2b, ...), and the next time you're using it you think "wait a minute, d is delete, I use dd all the time, why wouldn't I just d2w to delete those 2 words, huh, it didn't work right, the cursor is in the middle of the first word, I have to bd2w", at least that's somewhat how I first started getting it. Once you understand something it's hard to forget and after a short time using it you don't really need think about it like you mentioned.
- asadjb 12y agoThis is precisely why I love vim. It's like *nix. Small parts come together to make the whole a lot more better. I struggled quite a bit with vim. But once I read this stackoverflow answer, it all made sense! http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118 http://stackoverflow.com/questions/1218390/what-is-your-most...