Slide 1

Slide 1 text

开始 up down left right 翻页 ESC 纵览 F 全屏 下载 PDF

Slide 2

Slide 2 text

unleash your Vim Vim 常用插件分享 Created by / 张宇恒 @zyhack

Slide 3

Slide 3 text

本次分享的目的 介绍一些常用的 Vim 插件 分享一些使用心得

Slide 4

Slide 4 text

主推的几个插件 vundle -- 插件管理 airline -- 状态栏插件 ctrlp -- 文件切换插件 neosnippet -- 代码补全插件 syntastic -- 语法检查插件 gitgutter -- git 辅助插件 fugitive -- git 调用插件

Slide 5

Slide 5 text

vundle 插件的"管家" 把 github 作为插件的"源" step_1:配置中写需要安装的插件 注释后可以关闭该插件 Bundle 'scrooloose/nerdtree' Bundle 'altercation/vim-colors-solarized' Bundle 'kien/ctrlp.vim' Bundle 'terryma/vim-multiple-cursors' Bundle 'matchit.zip' Bundle 'Lokaltog/vim-powerline' Bundle 'bling/vim-airline' Bundle 'Lokaltog/vim-easymotion' Bundle 'myusuf3/numbers.vim' Bundle 'vim-scripts/restore_view.vim' Bundle 'airblade/vim-gitgutter' Bundle 'scrooloose/syntastic' Bundle 'tpope/vim-fugitive' Bundle 'scrooloose/nerdcommenter' Bundle 'godlygeek/tabular' Bundle 'majutsushi/tagbar' Bundle 'garbas/vim-snipmate' Bundle 'honza/vim-snippets' Bundle 'Shougo/neocomplcache' Bundle 'Shougo/neosnippet' Bundle 'honza/vim-snippets' Bundle 'Shougo/neocomplete.vim.git' Bundle 'Shougo/neosnippet' Bundle 'honza/vim-snippets' Bundle 'elzr/vim-json' Bundle 'pangloss/vim-javascript' Bundle 'amirh/HTML-AutoCloseTag' Bundle 'hail2u/vim-css3-syntax' Bundle 'tpope/vim-haml'

Slide 6

Slide 6 text

step_2:执行相应的命令 :BundleInstall 安装 or :BundleInstall! 安装且升级 :BundleUpdate 升级 :BundleClean 清理 or :BundleClean! 不询问用户直接删除 :BundleList 显示插件清单 :BundleSearch 在线搜索插件

Slide 7

Slide 7 text

step_3:等待插件安装、升级、卸载

Slide 8

Slide 8 text

airline 在状态栏显示有用的信息,如: 当前编辑状态 paste 是否打开 是否只读模式 git 版本信息 属于版本库的文件修改情况 语法检查报错信息

Slide 9

Slide 9 text

airline 只读 语法错误提示

Slide 10

Slide 10 text

ctrlp 在 file, buffer, mru 中模糊查询文件 可以认为是 Vim 的 finder(mac 系统工具)

Slide 11

Slide 11 text

使用方法 ctrl + p 打开 ctrlp 插件 ctrl + f 在已打开的 ctrlp 插件中切换 file/buffer/mru ctrl + c 退出 ctrlp

Slide 12

Slide 12 text

ctrlp

Slide 13

Slide 13 text

neosnippet 代码补全插件,支持多种语言,自动识别文件格式,启用相应的代码片段 tab 向下选择 ctrl + n 向下选择 ctrl + p 向上选择 ctrl + k 确认输入/使用代码插件

Slide 14

Slide 14 text

python

Slide 15

Slide 15 text

go

Slide 16

Slide 16 text

perl pod 一键生成

Slide 17

Slide 17 text

html

Slide 18

Slide 18 text

javascript

Slide 19

Slide 19 text

syntastic 在状态栏右下角提示语法错误,多语言支持 按照内置规则检查,或者调用外部程序检查源代码文件

Slide 20

Slide 20 text

gitgutter & fugitive 配合 git 使用的精良的工具

Slide 21

Slide 21 text

gitgutter 自动显示源代码哪些行作了修改,开/关高亮突出显示 修改前

Slide 22

Slide 22 text

gitgutter 修改后

Slide 23

Slide 23 text

fugitive 对 git 的完备支持 :Git [args] Run an arbitrary git command. Similar to :!git [args] but chdir to the repository tree first. *fugitive-:Git!* :Git! [args] Like |:Git|, but capture the output into a temp file, and edit that temp file. *fugitive-:Gcd* :Gcd [directory] |:cd| relative to the repository. *fugitive-:Glcd* :Glcd [directory] |:lcd| relative to the repository. *fugitive-:Gstatus* :Gstatus Bring up the output of git-status in the preview window. The following maps, which work on the cursor line file where sensible, are provided: next file previous file |:Gedit| - |:Git| add - |:Git| reset (staged files) cA |:Gcommit| --amend --reuse-message=HEAD ca |:Gcommit| --amend cc |:Gcommit| cva |:Gcommit| --amend --verbose cvc |:Gcommit| --verbose D |:Gdiff| ds |:Gsdiff| dp |:Git!| diff (p for patch; use :Gw to apply) dp |:Git| add --intent-to-add (untracked files) dv |:Gvdiff| O |:Gtabedit|

Slide 24

Slide 24 text

fugitive 输入 :gd tab补全,在 vimdiff 内预览 git diff

Slide 25

Slide 25 text

推荐安装方法 -- vim 插件集合,全自动安装 spf13

Slide 26

Slide 26 text

Thanks! happy Viming!