## vi/less cheatsheet

  • ~~~~ command mode #roughly ranked
  • [3] dt — “dta” delete until the next “a”
  • R — Overwrite each character one by one until end of line. Useful if the replacement content is similar to original?
  • [2] 9s — wipe out 9 characters (including current) and enter insert-mode. Better than R when you know how many chars (9) to change
  • C — wipe out from cursor to END of line and puts you into insert-mode
  • A — to append at END of current line
  • capital O — open new line above cursor
  • Ctrl-R to re-do
  • from inside q(LESS), type a single “v” to launch vi
  • [1] ctrl-^ — to switch to “the other file”
  • [3] :e# — is same
  • cw — wipe out from cursor to end of word and puts you into insert mode
    • c2w or 2cw
  • no simple command to delete 5 characters

–paging commands in vi and less

  • jump to end of file: capital G == in both vi and LESS
  • jump to head of file: 1G == in both vi and LESS
  • page dn: Ctrl-f == in both; LESS also uses space
  • page up: Ctrl-b == in both; LESS also uses b

— now q(less)

  • [3] /ctrl-R — search without metacharacters

[3] means vi receives 3 keystrokes

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s