Your SlideShare is downloading. ×
Vim 神技
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Vim 神技

3,577
views

Published on

引导新手入门篇

引导新手入门篇

Published in: Technology

1 Comment
27 Likes
Statistics
Notes
No Downloads
Views
Total Views
3,577
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
108
Comments
1
Likes
27
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 冒2011/10/14 顿
  • 2. 小调查• Vim 用户数?• Vim 龄? 3 个月+• 知识面 10 个技巧、30 个技巧+、通读 Vim doc.
  • 3. 简介• 我的故事(三遇始识君)• 编辑模式• 编码设置
  • 4. :h tutor
  • 5. 大纲• 光标移动 (motion)• 命令 (:command)• 搜索&替换 (find, subst)• 量词 [count]• 文本对象 (text-object)• 寄存器 (register)• 标记 (mark)• 列模式• 配置 (vimrc)• 插件 (plugin)
  • 6. 光标移动• j k h l• w b e• 0 ^ $• H M L• gg G 50%• :50• %• <C-f> <C-b> <C-e> <C-y>• <C-o> <Tab>• gj gk gf gd :h g• :help motion.txt
  • 7. 助记a ppend h o u ndob efore i nsert p aste v isualc hange cc j q w ordd elete dd ke nd l r eplace xf ind m ark s trike y ank yyg oto gg n ext t ill z en zz ZZ [[ ]]
  • 8. 助记A ppend H igh O UB efore I nsert P aste V isualC hange J oin Q W ordD elete K eyE nd L ow R eplace XF ind M id S trike Y ank yyG oto N ext T ill Z en zz ZZ ( ) { }
  • 9. 助记 Mode Motion Searcha ppend b efore f indi nsert e nd t illo g oto n extr eplace h * /v isual j # ?Esc k Buffer l Edit p aste w ordc hange y ank 0 , ;d elete Others ^ ( )s trike % [[ ]] m arku ndo $ { } qx z en .
  • 10. Ctrl- 助记a dd/all h o ld caret u pwardb ackward i p block v iewc ancel j q w indowd ownward ke xtra l r edo xf orward m s plit/save yg n t ags back z
  • 11. 键盘映射• .• == gg=G• >> >G 2<<• zc zo• 自定义键盘映射 ,cc <F3> ( <C-t> <M-1>• :h map.txt
  • 12. 量词• 5j 3w 2dd 3cw 2fa• 10>> 8== 4Y 4yp• 50% 100gg 100G• :h count
  • 13. 命令• :h :help• :wqa!• :cd• :setf html• :set fenc=utf8|gbk• :set [no]wrap• :bro[wser] w [file.name]• :new :vnew :tabnew• 自定义命令 – :Cal :MRU :Uisvr css• :h command
  • 14. 搜索&替换• / ? n N – 支持正则表达式 :h magic – :set hls :noh• * #• f F t T ; ,• :%s/key/word/g• :%s/key//n• :vimgrep/key/**/*.c• :h pattern.txt
  • 15. 文本对象• inner object – viw ci” di(• an object – yaw cat dap• :h text-object
  • 16. 寄存器• “add “bY “ap “bp• 无名寄存器 “”• 命名寄存器 a-z• 编号寄存器 0-9• 黑洞寄存器 _• 共享系统剪贴板 :set clipboard+=unnamed• :h registers
  • 17. 标记• ma mb• ‘a ‘b• `a `b• :h mark
  • 18. 列模式• <C-v> (for *inx)• <C-q> (for Windows)• :h ctrl-v
  • 19. 配置参考• https://github.com/vingel/vim• https://github.com/janlay/vim• https://github.com/cnruhua/macvimfiles• https://bitbucket.org/leeiio/vim• https://github.com/lilydjwg/dotvim• https://github.com/hotoo/vimrc
  • 20. 插件• https://github.com/msanders/snipmate.vim• https://github.com/scrooloose/nerdtree• http://vim-taglist.sourceforge.net/ – http://www.vim.org/scripts/script.php?script_id=273• https://github.com/majutsushi/tagbar – http://www.vim.org/scripts/script.php?script_id=3465• https://github.com/vim-scripts/mru.vim – http://www.vim.org/scripts/script.php?script_id=521• http://code.google.com/p/vimwiki/• https://github.com/hotoo/uisvr.vim• https://github.com/hotoo/template.vim• https://github.com/hotoo/more.vim
  • 21. 尾声• 宏 :h q• 持久化撤销 :h undo• 文件/版本比较 :diff• 相对行号 :h rnu• 语法高亮 :h syntax• 外观皮肤 :h colorscheme• 代码折叠 :h folds• 自动缩进 :h indent• 智能补全 :h omni-completion• 会话恢复 :h sessions• 文件自动备份与紧急恢复 :h backup• …
  • 22. 小众