Vi & Vim Tutorial

cite:
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html


:set wrap
:set nowrap

Replace all string in document



  • : %s / ______________ /\ ________________/ g

Set tab spaces

1. vim /etc/vim/vimrc
2. set ts=4


利用字串取代('^M' 要用 Ctrl+V 不要放開 Ctrl 再按 M 才能打出來喔!)
   :%s/^M/\r/g


Display the line number in vim



  1. vim /etc/vim/vimrc
  2. :set number


Foreground and Background Switch

1) Ctrl + z
2) fg ....
http://arjanvandergaag.nl/blog/foreground-and-background-processes.html

Set current line highlight

set cursorline
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white
hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white

lightmagenta darkgray lightgrey darkgrey lightgreen lightgray darkmagenta gray white red grey darkred brown darkblue darkgreen lightblue yellow cyan

Folding codes in vim

1. visual select the codes (v) (ctrl+v)
2. zf
3. za

相關文件