Quick Start

已经实现了一个非常基本的自动化脚本,可以输入如下命令进行自动化安装,如果是OSX,需要提前安装brew:

  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

之后运行:

  1. wget -qO- https://raw.github.com/matthewgao/MyVim/master/setup.sh | sh

当所有安装完成,就得到了一个包含如下插件的Vim:

  • Bundle

  • FuzzyFinder

  • L9

  • tagslist

  • ctags

  • NERDtree

  • NERD-Commenter

  • Auto-pair

  • Ctrlp

  • ctrlp-funky

  • airline

  • powerline

  • translate

  • vim chinese doc

  • calendar

  • molokai colorscheme

项目托管在github上 MyVim

自动安装包含如下过程:

  • 检查系统,yum or apt-get or brew

  • 安装组件

  • 安装MyVim

  • 复制vim到.vim

  • 复制vimrc到.vimrc

  • 安装Bundle

  • 执行BundleInstall

Powerline font

  1. git clone https://github.com/powerline/fonts.git
  2. fonts/install.sh

安装中文Help doc

下载vimdoc包猛击下载,下载的 tar.gz 包括所有翻译过的 vim 文档 (.cnx 文件) 先将其解压缩:

  1. tar zxvf vimcdoc-<version>.tar.gz

然后进入 vimcdoc- 目录并执行

  1. ./vimcdoc.sh -i

就可以了。该安装程序会自动识别 Vim 的安装路径,将中文的文档拷贝 到相应的地方。原有的英文文档不受影响。

插件简介

NERDtree

在nerdtree窗口常用操作:

  1. x.......Close the current nodes parent收起当前目录树
  2. R.......Recursively refresh the current root刷新根目录树
  3. r.......Recursively refresh the current directory刷新当前目录
  4. P.......Jump to the root node
  5. p.......Jump to current nodes parent
  6. K.......Jump up inside directories at the current tree depth 到同目录第一个节点
  7. J.......Jump down inside directories at the current tree depth 最后一个节点
  8. o.......Open files, directories and bookmarks
  9. i.......Open selected file in a split window上下分屏
  10. s.......Open selected file in a new vsplit左右分屏

配置解析

  1. set nocompatible " be iMproved
  2. set shell=/bin/sh
  3. set tabstop=4
  4. set softtabstop=4
  5. set shiftwidth=4
  6. " FIXME
  7. set expandtab
  8. set autoindent
  9. set nu
  10. set ruler
  11. colorscheme molokai
  12. set showcmd
  13. " 高亮搜索
  14. set hlsearch
  15. " 跟随搜索
  16. set incsearch
  17. set mouse=a
  18. set linebreak
  19. set mousemodel=popup
  20. set autowrite
  21. set cmdheight=2
  22. " 去掉输入错的提示音
  23. set noeb
  24. set ignorecase
  25. set wildmenu
  26. "FIXME 允许backspace和光标跨越行边界
  27. set backspace=eol,start,indent
  28. set whichwrap+=<,>,h,l
  29. set linespace=0
  30. set wildmenu
  31. set completeopt=preview,menu
  32. set completeopt=longest,menu "tab替换成空格
  33. if version>=603
  34. set helplang=cn
  35. set encoding=utf-8
  36. endif
  37. filetype on
  38. filetype plugin on
  39. filetype plugin indent on " required!
  40. syntax on
  41. syntax enable
  42. set rtp+=~/.vim/bundle/vundle/
  43. call vundle#rc()
  44. " let Vundle manage Vundle
  45. " required!
  46. "这是vundle本身的设置
  47. Bundle 'gmarik/vundle'
  48. " My Bundles here:
  49. "这里是设置你自己自定义的插件的设置vundle设置,注意:下载
  50. "的插件git为:https://github.com/godlygeek/tabular.git,则设置为Bundle
  51. "'godlygeek/tabular';https://github.com/gmarik/vundle.git设置则为
  52. " Bundle 'gmarik/vundle'
  53. " original repos on github
  54. Bundle 'godlygeek/tabular'
  55. " vim-scripts reposvim-scripts的访问地址,格式则如下:
  56. Bundle 'L9'
  57. Bundle 'FuzzyFinder'
  58. " non github repos ,非git的访问地址的,格式如下:
  59. Bundle 'git://git.wincent.com/command-t.git'
  60. Bundle 'Auto-Pairs'
  61. Bundle 'The-NERD-Commenter'
  62. "Bundle 'ctrlp.vim'
  63. Plugin 'ctrlp.vim'
  64. Plugin 'scrooloose/nerdtree'
  65. "
  66. " Brief help
  67. " :BundleList - list configured bundles
  68. " :BundleInstall(!) - install(update) bundles
  69. " :BundleSearch(!) foo - search(or refresh cache first) for foo
  70. " :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
  71. "
  72. " see :h vundle for more details or wiki for FAQ
  73. " NOTE: comments after Bundle command are not allowed..
  74. nmap tt :%s/\t/ /g<CR>
  75. map <F3> :NERDTreeToggle<CR>
  76. imap <F3> <ESC> :NERDTreeToggle<CR>
  77. map <silent> <F9> :TlistToggle <CR>
  78. let Tlist_Auto_Open=1
  79. let Tlist_Exit_OnlyWindow=1
  80. let Tlist_Use_Right_Window=1
  81. let NERDTreeIgnore=['\.pyc']
  82. " crtlp setting
  83. set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.png,*.jpg,*.gif " Mac/Linux