Skip to content

Instantly share code, notes, and snippets.

@HugoLnx
Created December 18, 2017 18:28
Show Gist options
  • Save HugoLnx/f6af5d5089ca8d5045112aee5704baf3 to your computer and use it in GitHub Desktop.
Save HugoLnx/f6af5d5089ca8d5045112aee5704baf3 to your computer and use it in GitHub Desktop.
Getting Started with Vim: Setup & Learning Tips (Summary)

Getting Started with Vim: Setup & Learning Tips

Resumo da talk

Modes

  • navigation mode
  • insert mode
  • select mode (plain, line, block)

Files

  • quit (:q :q!)
  • write (:w filename, :w! filename)
  • edit (:e :e!)
  • write and quit(:wq :wq!)
  • External commands. (:!)

Navigation

  • directionals (h j k l)
  • quick directionals (J K)
  • word skip (w b)
  • beginning/end of line (_ $)
  • beginning/end of doc (gg G)
  • specific line (number gg or :number)
  • yank (yy Y)
  • paste (p P)
  • undo & redo (u CTRL+r)
  • delete (dd D) -> repaste
  • delete until (beginning/end of line, word)
  • yank until (quick)
  • delete char (x)

Advanced

  • Go to char (t f T F)

Navigation mode -> Insert mode

  • insertion mode (i)
  • ESC
  • insertion mode at beginning of line (I)
  • insertion mode after (a A)
  • line above, line below (o O)
  • substitute (s S)
  • replace (c C)

Block

  • ident (< >)
  • downcase/upcase (u U)
  • delete, change, yank, replace (d c y r)

Replace

  • full document :%s/xpto/abc/g
  • specific lines :10,20s/xpto/abc/g
  • regexp :%s/".*"/"HUGO"/g
  • capture groups :%s/"(.*)"/'\1'/g

Tabs

  • opening new (:tabe)
  • navigating (:tabn, :tabp, :tabm number)

Windows

  • Split vertical (CTRL+w>v)
  • Split horizontal (CTRL+w>s)
  • Navigate (CTRL+w>hjkl)

CTRL+P

  • tabs (CTRL+T)
  • windows (CTRL+v CTRL+x)
  • multiselect (CTRL+z)
  • create files

Extras

  • Auto-complete (CTRL+n)
  • Search (/ n N)
  • Yank to clipboard ("+)
  • Macros (q+)

Exercícios

Gist: https://gist.github.com/HugoLnx/170341e3f9639024bb36322c323f2dc8

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