I know not everyone likes using vim but I thought those who do could share a good reason to get into it. For me its the repetition of the last change with the push of the dot key. Replace the current word with another and move the cursor to the next word you wish to replace. It makes the editor so versatile and feels very satisfying.
I use vim macros all the time. For example, you have a bunch of lines that need the same 3 operations done:
- insert
"
at the beginning of the line - insert
",
at the end on the line - indent
Press
qa
, do what you need to do on one line and go one line below, pressq
again to stop recording the macro, then you can do it 50 times with50@a
.I’ve done this a lot too. It’s the kind of thing where someone watching says “what is this black magic and how do I got to make the text said what I want?”.
- insert
I think these two talks by Chris Toomey sum up pretty well everything that is nice about vim:
If you’ve used vim for a while now and feel a bit stuck, they bring you to the next level and are pretty straightforward.
That said, other editors also have their pros and I’ve become a bit tired of looking for the most efficient one or so. It really doesn’t matter in my job if I need x hours or y hours to write something (although vim probably scores well there). I use it nowadays mostly because it works well for me, it feels kind of fun, it doesn’t eat my computing resources, and it’s here to stay (free).
Thank you for the resources, I’ll try them once I get the chance to work on a project for awhile again. The reasons why you like it are great to hear, as many videos tend to focus on speed over other aspects. If speed was my only concern I could have stayed with an IDE which I knew how to use. For me vim is both exciting to learn as a skill and convenient because of it’s server friendly interface.
For me, the moment it clicked was the first time I used it on my laptop. It was just so darn comfortable, and made me realize I was hesitant to do certain work without a mouse until that moment. My hands had to move around so much less, and that made for a much more enjoyable experience.
Yeah, using the console on my laptop made it so much more usable.
I started with vi on Solaris so Vim was a damn luxury to use. Not having to use a mouse or a GUI in server environment is a must. Even with all the cool editors out there now I still find myself using it even in X11 environments. Mastering it is a real achievement that you can be proud of because it’s never not worth your time.
The yank buffer is useful, but sometimes I’ll do an action that replaces the yank buffer, when I wanted to save that text. So put:
map K “_
in your .vimrc. Now you can use shift-k before a command to make it not update the yank buffer. For example: go to a word and type yw to copy the word. Go to another word and type KdwP to delete the word and paste your saved word. Alternately, you can also type Kcw then type something and ctrl-R followed by “ to paste.