Sheet1

VIM Cheat Sheet
COMMAND vi filename :wq :q! :sav newfilename :w! newfile :e c:\temp\filestopen.txt :n,m w! newfile :help ESC :help reference_toc What is it ? start editing filename, create it if necessary write the file to disk and quit quit without saving any changes save as ... write all lines from the entire current file into the file 'newfile', overwriting any existing newfile open file on the specified directory. write the lines from n to m, inclusive, into the file newfile, overwriting any existing newfile Display help quit from editing / cancel the command. very helpful command. for displaying table of content. you can search the manual very fast Editing Command Close window Move between active window Equal size for active window Maximize the window Blank tab Openfile in new tab Open help in new tab Move to tab number x cycling to other tab Run cmd in console Run xxx (as window command) in console Control Command Scroll to top Scroll to bottom Scroll to line X matching parenthesis (ex: ( will match with ) list all buffers same as above (list all buffers) open buffer in new window go to next buffer go to previous buffer go to the first buffer go to the last buffe delete buffer no x delete all unlisted buffer display all unlisted (closed buffer) type gf after you select a specific file, vi will search the file for you. (for example gf.php) search filename

^wc ^ww ^w= ^w_ :tabnew :tab newtabfile :tabe help :tabn x CTRL-PGUP/PGDOWN :!cmd :!xxx

gg G xG % :ls :buffers :sbuffer x :bnext :bprevious :bfirst :blast :bdelete x :bwipe :buffers! gf :find filename

/string

Regular Expression (Search and Replace) /search for string

Page 1

Sheet1 /[a-zA-Z]*\.exe/ :%s/pattern/string/flags g c i I s:\(\w\+\)\(\s\+\)\(\w\+\):\3\2\1: Regex Operator Precedence \(\) \=,\+,*,\{n} etc. abc\t\.\w \| will match everything that has .exe Replace pattern with string according to flags. Notes % = for all file. while 8,10 means range line 8-10 only flag: replace all flag: confirm replace flag: ignore case flag: dont ignore case – case sensitive \1 = (\w\+) , \2 = (\s\+\) \3=(\w\+\) thus this will reorder the string grouping quantifiers sequence of characters/ metacharacters, not containing quantifiers or grouping operators alternation

^x^p ^x^o :vimgrep texttosearch ../*.php :pwd :cd c:\test\blablbla\ :!dir :find filename :helptags c:\vim\_vimfiles\doc

code completion when you type only part of the word omnifunc code completion (on version 7.0) – must have omnixxx installed search text in all file and directory Misc Stuff where are you now ? this will display your current directory go to directory specified dir command search the file in current directory add local help on help

Vi Resources http://rayninfo.co.uk/vimtips.html Tips and tricks about Vi http://www.geocities.com/volontir/ Tips and tricks http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/ VIM Color scheme http://www.vim.org/scripts/index.php VIM Script collection http://www.vim.org/tips/index.php tips frim vim

Page 2