We’re going to look at some unique features that an almost 30yearold editor provides us.Vimis an improvement of the vi text editor that was released in 1976, which was itself an improvement of theEx line editor! Vim is the fifth most popular development environment, according to 2019 Stackoverflow survey.

Curious to know what it feels like to work with Vim? I think this tweet describes it well:

Let’s explore the reasons behind its popularity.

Text Objects: 

These are like magic; it’s like talking to your editor in human language and watching as it obeys your orders, for example: 

  • Delete a paragraph -> dap 
  • Change a paragraph -> cap 
  • Visually select a paragraph -> vap 

Or 

  • Delete inside parentheses -> di( 
  • Change inside parentheses -> ci( 
  • Visually select inside parentheses -> vi( 

You can use these letters as the indicator of your objects: 

  • w -> word 
  • W -> case insensitive word 
  • s -> sentence 
  • p -> Paragraph 
  • t -> tag 
  • { –> brace 
  • ( –> parentheses 
  • [ -> bracket 
  • ‘ -> single quote 
  • ” -> double quote 

Test them, and they’ll blow your mind. To learn moreread this blog post or watch this wonderful video.

Modal editing: 

You have to explicitly switch between modes like Insert modeVisual modeCommand mode and Search mode with modal editing. This gives us better opportunities to work with our editorby creating an efficient and robust workflow, without even touching the mouse.

If you learn Vim keybindings and modes, the knowledge gained is applicable in other programs, such as: 

  • Onivim -> Combination of Vim and VSCode 
  • Vimium -> The Hacker’s Browser 
  • Neovim -> Improved vim! 

 

Highly available and customisable: 

Last but not least is the impressive ability to work with vim on remote machines. Imagine you are ssh-ing into a server; most of the servers have vim preinstalled – if you know how to work with it, you can release the Kraken without installing anything else! 

kraken and ship

 

It’s highly customisable, with the ability to install tons of plugins, you can work however you prefer. Check out some examples like SpaceVim, or famous vim plugin developer GitHub pages, liketpope.

Hopefully, this article has persuaded you to try Vim out and see the old dragon’s power for yourself. 

 

Author

 

Farid Ahmadian

This article was written by Farid Ahmadian, a Systems Engineer at Bonial.