Vim - Amazing Editor for DBAs

6,865 views
6,781 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
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,865
On SlideShare
0
From Embeds
0
Number of Embeds
5,587
Actions
Shares
0
Downloads
93
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 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

    ×