DEV Community

Use Vim's dot command to do repetitive tasks faster

Igor Irianto on August 10, 2019

Follow @learnvim for more Vim tips and tricks! Vim has been my go-to editor for the last 1.5 years, yet I am still learning something new. Recentl...
Collapse
 
chsanch profile image
Christian Sánchez

Also you can use a [count] with . so you can repeat the change [count] times. See :help . for more info.

Collapse
 
iggredible profile image
Igor Irianto

Oh yeah, I forgot about count. Good call!

Collapse
 
ferricoxide profile image
Thomas H Jones II

I'm more a fan of macros and key-bindings for more-common repetitive-tasks (all hail the power of the .exrc or .vimrc!). That said, . is great for ad hoc stuff.

Collapse
 
iggredible profile image
Igor Irianto

Oh yes, macros. I played with them a bit, but I am not proficient with them yet. Macros are next-level stuff. They are definitely on my list to cover, so stay tuned! But for quick-and-dirty repetitive tasks, . is your man!

Collapse
 
darkes profile image
Victor Darkes

This seems real useful! Interested in what kind of development you do so that Vim is your go to editor?

Collapse
 
ferricoxide profile image
Thomas H Jones II • Edited

There's several vim plugins you can use that can turn vim into a near-IDE. So, if your comfort is vi (e.g., if you're like me and have been using vi - and derivatives - since the late 80s), you can have your proverbial cake and eat it too.

And, yes, some IDEs offer the ability to emulate vi/vim syntax, but, sometimes there's holes in those emulations (particularly if you're someone that uses macros and/or key-bindings).

Collapse
 
iggredible profile image
Igor Irianto

Hey Victor! At work we use VsCode (we also have IntelliJ), but I personally prefer Vim as my personal editor. Even at work, I use IntelliJ and VsCode's vim plugin because I can go near mouse-free.

As for my own personal setup - this is by no means comprehensive - but there are several must-have features that I need to make it my own personal IDE/editor. These are

  • neovim - "better" vim.
  • tmux - to manage multiple windows/ panes.
  • fzf - to quickly search file in project
  • Ag - to quickly search string in project
  • neotree - tree file explorer

You can check out my vim dotfiles here.

Some youtube vids I found helpful (I am not associated with any of these):

youtube.com/watch?v=xZTkrB_tEoY
youtube.com/watch?v=0YoNrTQCrHg&t=...
youtube.com/watch?v=YD9aFIvlQYs

Collapse
 
geekyarthurs profile image
Mahesh C. Regmi

great one!