Vundle

Vundle 是一个 Vim 的插件管理工具,类似于 Bundle 的功能。它可以让你通过配置 .vimrc 文件来安装多个 Vim 插件。

安装 Vundle

Vundle 代码 直接下载到你的 ~/.vim/bundle/ 目录下,通过脚本就是:

(mkdir -p ~/.vim/bundle; git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim)

配置 Vundle

其实也是配置你的 Vim 如何起用 Vundle 以及安装哪些 Vim 插件。可以参考 Read Me 文档:https://github.com/VundleVim/Vundle.vim

我的配置文件(前端开发)

使用说明

随后补充 …

配置文件

重要的东西都在 Plugin 'xxxx/xxxx' 这样的依赖上,只要配置好这些依赖,再重新打开 ~/.vimrc 文件,执行 :PluginInstall 命令,就可以安装 Vim 依赖了,待完成后会有 Done! 字样显示在 Vim 状态栏内。

这是我的 ~/.vimrc 文件全集:

" Update: 2017-07-05 11:25

" ------------------------------------------------------------
"  Settings
" ------------------------------------------------------------

set expandtab
set ts=2
set sw=2
colo darkblue

" ------------------------------------------------------------
"  Bundle
" ------------------------------------------------------------
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" Plugins
Plugin 'scrooloose/nerdtree'
Plugin 'fholgado/minibufexpl.vim'
Plugin 'Shutnik/jshint2.vim'
Plugin 'leshill/vim-json'
Plugin 'kchmck/vim-coffee-script'
Plugin 'mislav/vimfiles'
Plugin 'leafgarland/typescript-vim'
Plugin 'tpope/vim-markdown'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'marijnh/tern_for_vim'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'ctrlpvim/ctrlp.vim'

" vim actions
Plugin 'easymotion/vim-easymotion'

" React
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'

" Vue
Plugin 'posva/vim-vue'

" Es6
Plugin 'tomtom/tlib_vim'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'garbas/vim-snipmate'
Plugin 'isRuslan/vim-es6'


" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

" ------------------------------------------------------------
" Common
" ------------------------------------------------------------
syntax on

" ------------------------------------------------------------
" NERDTree
" ------------------------------------------------------------
"NERDTree: autoload when startup vim
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

"NERDTree: C-n to open NERDTree
map <C-n> :NERDTreeToggle<CR>

" NERDTree: File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
 exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
 exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction

call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')

" ------------------------------------------------------------
"    vim-easymotion 
" ------------------------------------------------------------
" ref - https://github.com/easymotion/vim-easymotion

"" By Robin 
let g:EasyMotion_smartcase = 1
"let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
map <Leader><Leader>j <Plug>(easymotion-j)
map <Leader><Leader>k <Plug>(easymotion-k)
map <Leader><leader>h <Plug>(easymotion-linebackward)
map <Leader><leader>l <Plug>(easymotion-lineforward)
map <Leader><leader>. <Plug>(easymotion-repeat)
nmap s <Plug>(easymotion-s)


" ------------------------------------------------------------
"  vim-jsx
" ------------------------------------------------------------
let g:jsx_ext_required = 0
"let g:jsx_pragma_required = 1

" ------------------------------------------------------------
"  vim-vue
" ------------------------------------------------------------
autocmd FileType vue syntax sync fromstart
autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css

" ------------------------------------------------------------
" CtrlP
" ------------------------------------------------------------
" ref - https://github.com/ctrlpvim/ctrlp.vim
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_root_markers = ['pom.xml', '.p4ignore', 'package.json']
set wildignore+=*/node_modules/*,*/.git/*,*.so,*.swp,*.zip

" ------------------------------------------------------------
" 
" ------------------------------------------------------------

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐