DEV Community

Discussion on: Introduction to Vim

Collapse
 
ferricoxide profile image
Thomas H Jones II

To start: Always looking for guides I can link our new teammates to, so, thanks!

Small quibbles:

  • dw - delete from where the cursor is until the end of the word

Is slightly inaccurate. What it really is "delete to next word". de would be "delete from where the cursor is until the end of the current word". The difference is subtle but can be seen if you're nuking characters/words from a multi-word line of text: dw deletes the separators between two words while de terminates the delete-action before the word-separator

  • d$ - delete to the end of the line from where the cursor is

While correct, can also be accomplished with just D. If you're a lazy-typist like I am, that's two keystrokes (<SHIFT> and d) rather than three (d, <SHIFT> and 4).

With your search tips, once you've done either /<TERM> or ?<TERM>, simply typing / or ? will accomplish the same thing as n or N, respectively.

If you're a really lazy-typist (like I am), you'll make heavy use of '.' ...which repeats whatever your last modifying-action was — whether delete, insert or whatever — each time you type it.

And of course the real beauty of vim is most commands are predictably modifiable or stackable. Want to delete the line you're on: dd. Want to delete three lines - including the one you're on, 3dd. Want to delete to the third word to the right, 3dw. Want to delete to the beginning of the line you're on, d0. Want to delete from where you are to the end of the file, dG. ...ad nauseam.

Yeah: vi/vim enthusiast for just shy of thirty years. =)

Collapse
 
fabiorosado profile image
Fabio Rosado

Thank you so much for your comment Thomas, I got to admit that I didn't know that . would repeat the previous command, this will save me a lot of time! I don't use the search command all that much to be honest so I didn't knew that you could use the / or ? would accomplish the same thing.

I've updated the post following your suggestions and comments, so thank you so much for them as I have learned new things today as well :D

Collapse
 
rossijonas profile image
Jonas B. R.

Thomas you get right in the vein! All of us vimmers are obsessed counting keystrokes 😂😂!!! It looks like you're a very eperienced vim user, and I'd like to extend to you the invitation to help more people learn vim, bringin some digested tips.
I invite you to check vim drops, and start to write some tips there!

Have a good weekend!✌️

Collapse
 
ferricoxide profile image
Thomas H Jones II • Edited

First time I used vi would have been sometime in 1989 (criminy, I'm old): one of my dorm floormates was a CE major. He worked at one of the CS/CE college's UNIX labs and created an account for me to play around with (mostly for Usenet). Was an early eye-opener to the powers of regex ...and an introduction to the vi/emacs wars.

At any rate: posted a link to your Medium page to our Slack's "Linux Q&A" channel.

Thread Thread
 
rossijonas profile image
Jonas B. R.

Cool Thomas! Nice to hear form you, I'll definetely check the link over there and follow the topics! Thanks for sharing that! BTW, I'm not that young too, I'm almost 38 rsrsrs, looking to all this tech professionals , we could be considered dinosaurs...hehehe Have a great week!