Skip to content

Instantly share code, notes, and snippets.

@nicokosi
Last active August 24, 2018 07:36
Show Gist options
  • Save nicokosi/d8acc85daf41e044f1bdf05bc146a6c3 to your computer and use it in GitHub Desktop.
Save nicokosi/d8acc85daf41e044f1bdf05bc146a6c3 to your computer and use it in GitHub Desktop.
My personal vim cheatsheet

Vim basics

Via command examples.

Open

Single window

Example:

vim Specs.hs Ladder.hs

Switch to a file: :e Ladder.sh.

Splitted windows

Horizontally:

vim Specs.hs Ladder.hs -O

Vertically:

vim Specs.hs Ladder.hs -o

Syntax highlighting

If needed, enable it: :syntax on.

Undo

escape + u

Search

:/wordToSearch then type n for next occurrence, shift + n for previous one.

Replace

Globally: :%s/replaceThisWord/withThisOne/g.

Close

:x! saves all files and quits.

:x | !runhaskell Specs saves all files, quits and runs the command runhaskell Specs.

:q! quits without saving files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment