Oh Shit, Vim or Vi

vi is the de facto standard Unix editor, you find it in every NIX derived OS.

Thats why you should learn a handfull of commands, you can the show off your Vi skills

The first thing you need to learn is how to exit

  1. just quit: :q
  2. just quit and not save: :q! or ZQ (shift-Z-Q)
  3. quit and save any changes: ZZ (shift-Z-Z)

Next up is editing

  1. insert: i then escape to exit insert mode
  2. append: a then escape to exit insert mode then escape to exit insert mode
  3. append at the end of the line: A (shift-A)
  4. Begin a new line below the cursor: o then escape to exit insert mode
  5. Begin a new line above the cursor: O (shift-O) then escape to exit insert mode

Now you can exit and edit a file, what if you want to delete stuff?

  1. Delete characters: x
  2. Delete lines: dd
  3. Delete the characters under the cursor until the end of the line: D (shift-D)

Great, you can exit and edit and even delete. SO what else would bew cool to do?

How about copy a line and past it else where?

  1. yank a line: yy
  2. move to destination line
  3. paste after cursor p or P to paste before the cursor

SO you made a change and you need to undo it, or you made a change and want to repeat it. We have you covered!

  1. undo is just u
  2. you can redo a change with CTRL-R
  3. repeat the last change with .

Thats most of the cool stuff I know, the last 2 things are searching

  1. searching can be started with / then type out what your looking for.
  2. repeat your search with n
  3. you can also search up the file with ?

And the very last thing is substituting, this is find and replace

  1. :s%/find/replace/g this is look for find and replace it with replace everywhere
  2. :%s!file path!new path!g you can use any delimiter, that helps with changing a path