## vi cheatsheet

  • ~~~~ command mode #roughly ranked
  • from inside q(LESS), type a single “v” to launch vi
  • Ctrl-R to re-do
  • [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
  • capital O — open new line above cursor
  • R — Overwrite each character one by one until end of line. Useful if the replacement content is similar to original?
  • C — wipe out from cursor to END of line and puts you into insert mode
  • A — to append at END of current line
  • [3] dt — “dta” delete until the next “a”

[3] means vi receives 3 keystrokes

scan codebase for a given func name

–Challenge: scan a c++ codebase for a given func name

  • A script would offer more flexibility.
  • find + perl + grep is a crude solution, without support for comments

See also the task in Outlook!

–A related challenge: suppose you have the definition of a function, how do you see all the callers?

Csmi.C: In static member function ‘static csmiparser::Csmi& csmiparser::Csmi::getInstance()’:
Csmi.C:14: warning: ‘__comp_ctor ’ is deprecated (declared at /home/vtan/tp/plugins/xtap/csmi/include/Csmi.h:33)

  • Technique — Rename the by appending _xxx and rebuild