Vi for You and Me

Shivani Bhardwaj

about.me/Shivani.Bhardwaj

What is Vi?

vi is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs.

Straight from Wikipedia.

Let's see what it looks like

Commands

  • x
  • i
  • a
  • d

operator   [number]   motion

e.g. d2w

A short list of motions:

  •     w - until the start of the next word, EXCLUDING its first character.
  •     e - to the end of the current word, INCLUDING the last character.
  •     $ - to the end of the line, INCLUDING the last character.

Source: vimtutor

  • Undo (u)
  • Redo (Ctrl + R)
  • Save (:w)
  • Exit (:q)

A few more commands:

The magical .vimrc

Why vi?

  • vi is guaranteed to exist on most Linux systems.

  • It's much quicker to use vi for a sudo edit:

    $ sudo vi

Read this and more: https://stackoverflow.com/questions/597077/what-are-the-benefits-of-learning-vim

Recommended:

  • Use it everyday
  • Maintain a cheat sheet
  • Start with vimtutor
  • 5 minute guide: https://unixia.wordpress.com/2016/09/20/five-minutes-to-love-vim/
  • Help others :)

Vi for You and Me

By Shivani Bhardwaj

Vi for You and Me

  • 501