• Stars
    star
    9
  • Rank 1,939,727 (Top 39 %)
  • Language
  • Created almost 9 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Supporting cheatsheet for the talk given at VIM Barcelona 24th Feb 2016 https://vimeo.com/156750085

First things first

:help help

Moving around

:help cursor-motions

  • hjkl
  • 0 $ _
  • gg G
  • w e b
  • f t F T
  • :number numberG
  • {} ( avoid holding jk )

PRO TIP: ; to jump to next ocurrence

Inserting text

:help inserting

  • I i a O o A

Deleting, fixing small fuckups

  • x, xp ( AKA "the windows move", swaps to characters very quickly )
  • r ( replace one chaacter )

Ever typed widht? try fhxp from the beginning of the line

Line operations

dd J

Select

  • v
  • V

Text objects

:help text-objects

count + operator + motion

aw iw ap ap i([{t

Operators

  • c - change
  • d - delete ( when you delete, you copy! )
  • y - yank ( copy )

PROTIP: paste over selected text

Repeat

The power of .

Macros ( complex repeats )

  • set @q ( fix macro )
  • use :normal @q to apply macro line by line

Search

/ n N ? .* ( poor man's fuzzy search )

  • search word under cursor

CONFIG TIP: smartcase

Jump jump

:help jumps

  • <c-[>
  • gf
  • g;

Substitute power

:s/foo/bar :s/foo/bar/g :%s/foo/bar/g

:%s/somematch/&Lol :%s/backreferences!/\1,\2

Use custom separators ( useful for URLs )

:%s!https?://www.google.com!http://www.duckduckgo.com!gc

CONFIG TIP: use smartcase BOOK: Mastering regular expressions

Splits/windows

  • s
  • v
  • c
  • o
  • hjkl

CONFIG TIP: remap hjkl

Command mode PRO tips

  • " ( " / )
  • navigate without cursors
  • open command-line window ( edit commands in normal mode OMG )
  • for keystrokes ( useful for macros, you'll see later )

Complete!

  • ( complete by word )
  • ( complete file path, relative to current directory )
  • ( complete a line )
  • Use to go up and down