Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
YUNHE ENMO (BEIJING) TECHNOLOGY CO.,LTD       数据驱动 成就客户未来                      云和恩墨 成就所托
YUNHE ENMO (BEIJING) TECHNOLOGY CO.,LTD       数据驱动 成就客户未来                      云和恩墨 成就所托
You need vim• http://www.vim.org/download.php• Linux: alias vi=vim• Mac OS X: MacVim• Windows: gVim
the Basic• :help• Ctrl+], Ctrl+o• j, k, h, l, Ctrl+f, Ctrl+b• i, a, o, O, x• Esc• :wq, :x• :q!
Open Files• :e• :tabnew • :tabnext to switch• :sp • Ctrl+ww to switch• Always try TAB key.
Move Cursor• gg, :0• G• : <n>, <n>%• 0• $• w, b
Find• /• ?• n, N• /<yourstring>• :set ignorecase• :%s/yourstring//gn
Edit• u, .• dd, 3dd, dG• cG• r, 5r• yep, yyp, yyGp, yyggP• ddp
Format• guu• gUU, gUw• :g/SYS/d• :v/SYS/d• :.,$v/SYS/d
Replace• :s/MALL/TEST/g• :%s/MALL/TEST/g• :.,$s/MALL/TEST/g• :%s#/oradata#+DATADG#g• :%s/<Ctrl-V><Ctrl-M>//g
Virtual Mode• v, V, Ctrl+v• Ctrl+v -> I -> yourstrings -> Esc• Ctrl+v -> A -> yourstrings -> Esc
Macros!• qq• ...... your commands• q• @q• http://vim.wikia.com/wiki/Macros
Macros Sample• insert into t values (1);• ESC• qq• yyp• $hh• Ctrl+a• q• 8@q• :w t.sql
Plugins!!• SearchComplete • http://www.vim.org/scripts/   script.php?script_id=474• SQLUtilities • http://www.vim.org/scri...
Install Plugin• Just cp all the files into ~/.vim/• Restart Vim Kamus-MBP:.vim Kamus$ pwd /Users/Kamus/.vim Kamus-MBP:.vim ...
Install Local Help• :helptags $HOME/.vim/doc• :h SQLU
Chinese Support• UTF-8, no setting needed• Chinese File from Windows • :e ++enc=cp936 • Or put line into .vimrc  let &filee...
Keep Using• I’m still learning• Keep on using it, or you’ll forget it• Think Free
Upcoming SlideShare
Loading in …5
×

Vim - Amazing Editor for DBAs

7,077 views

Published on

A very simple training slide for Vim/MacVim, maybe you have been familiar with all the commands in the slide, maybe you don't.

Published in: Technology
  • Be the first to comment

Vim - Amazing Editor for DBAs

  1. 1. YUNHE ENMO (BEIJING) TECHNOLOGY CO.,LTD 数据驱动 成就客户未来 云和恩墨 成就所托
  2. 2. YUNHE ENMO (BEIJING) TECHNOLOGY CO.,LTD 数据驱动 成就客户未来 云和恩墨 成就所托
  3. 3. You need vim• http://www.vim.org/download.php• Linux: alias vi=vim• Mac OS X: MacVim• Windows: gVim
  4. 4. the Basic• :help• Ctrl+], Ctrl+o• j, k, h, l, Ctrl+f, Ctrl+b• i, a, o, O, x• Esc• :wq, :x• :q!
  5. 5. Open Files• :e• :tabnew • :tabnext to switch• :sp • Ctrl+ww to switch• Always try TAB key.
  6. 6. Move Cursor• gg, :0• G• : <n>, <n>%• 0• $• w, b
  7. 7. Find• /• ?• n, N• /<yourstring>• :set ignorecase• :%s/yourstring//gn
  8. 8. Edit• u, .• dd, 3dd, dG• cG• r, 5r• yep, yyp, yyGp, yyggP• ddp
  9. 9. Format• guu• gUU, gUw• :g/SYS/d• :v/SYS/d• :.,$v/SYS/d
  10. 10. Replace• :s/MALL/TEST/g• :%s/MALL/TEST/g• :.,$s/MALL/TEST/g• :%s#/oradata#+DATADG#g• :%s/<Ctrl-V><Ctrl-M>//g
  11. 11. Virtual Mode• v, V, Ctrl+v• Ctrl+v -> I -> yourstrings -> Esc• Ctrl+v -> A -> yourstrings -> Esc
  12. 12. Macros!• qq• ...... your commands• q• @q• http://vim.wikia.com/wiki/Macros
  13. 13. Macros Sample• insert into t values (1);• ESC• qq• yyp• $hh• Ctrl+a• q• 8@q• :w t.sql
  14. 14. Plugins!!• SearchComplete • http://www.vim.org/scripts/ script.php?script_id=474• SQLUtilities • http://www.vim.org/scripts/ script.php?script_id=492
  15. 15. Install Plugin• Just cp all the files into ~/.vim/• Restart Vim Kamus-MBP:.vim Kamus$ pwd /Users/Kamus/.vim Kamus-MBP:.vim Kamus$ ls -l total 0 drwxr-xr-x 8 Kamus staff 272 Mar 7 18:39 autoload drwxr-xr-x 9 Kamus staff 306 Mar 7 18:44 doc drwxr-xr-x 8 Kamus staff 272 Mar 7 18:39 plugin
  16. 16. Install Local Help• :helptags $HOME/.vim/doc• :h SQLU
  17. 17. Chinese Support• UTF-8, no setting needed• Chinese File from Windows • :e ++enc=cp936 • Or put line into .vimrc let &fileencodings = substitute(&fileencodings, latin1, cp936,0, )
  18. 18. Keep Using• I’m still learning• Keep on using it, or you’ll forget it• Think Free

×