Skip to content

Instantly share code, notes, and snippets.

@rootulp
Last active August 18, 2017 21:33
Show Gist options
  • Save rootulp/e30822339f24b4b12529b868e9294b0a to your computer and use it in GitHub Desktop.
Save rootulp/e30822339f24b4b12529b868e9294b0a to your computer and use it in GitHub Desktop.
Palantir Cotyledon Lightning Talk

What is Vim?

Vim is a text editor

Why use Vim?

  • Efficiency
  • It's everywhere (all of your PCloud or on premise servers)

Why don't more people use Vim?

  • Steep learning curve

Vim Modes

  • Normal Mode
    • Used to navigate a file
    • Switch to normal mode by pressing the Escape key
    • Navigate using h, j, k, l keys (left, down, up, right)
  • Insert Mode
    • Used to insert or delete text from the current position
    • Switch to insert mode by pressing i, a, I, or A
  • Command Line Mode
    • Used to execute commands
    • Switch to command line mode by pressing :
  • Visual Mode
    • Used to highlight text
    • Switch to visual mode by pressing v, V, or <CTRL-v>

Opening and Closing files

  • To open a file with vim $ vim file.txt
  • To save (write) the file, return to Normal Mode and type :w
  • To exit (quit) Vim, return to Normal Mode and type :q
  • To exit (quit) Vim without saving the file type :q!

Navigation Shortcuts

  • gg move to top of file
  • G move to bottom of file
  • <CTRL-u> move up half a page
  • <CTRL-d> move down half a page
  • You can prefix a movement command with a number to repeat the movement that many times. Ex. 10j moves down 10 lines

Editing Shortcuts

  • dd deletes current line
  • yy copies line to register
  • >> to indent line
  • << to de-indent line
  • . repeats the last change in Normal mode

Vim Commands

  • ci)
  • dt#

Continue Learning

  • $ vimvtutor
  • To get help on something, return to Normal mode and type :help <KEY>

Advanced

Resources

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