首先需要获取一个 vim 编辑器,这里以 Linux 作为前提。
使用 pathogen 插件作为插件管理,这样可以避免众多插件在目录结构集中到了一起的问题。
在Shell Terminal下的任何位置,执行如下命令:
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
配置 ~/.vimrc
文件:
execute pathogen#infect()
syntax on
filetype plugin indent on
从此以后可以安装任何插件,类似于安装 vim-sensible 插件的方法:
cd ~/.vim/bundle && \
git clone git://github.com/tpope/vim-sensible.git
cd ~/.vim/bundle \
git clone https://github.com/scrooloose/nerdtree.git
配置 ~/.vimrc
文件:
"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')
cd ~/.vim/bundle && \
git clone https://github.com/Xuyuanp/nerdtree-git-plugin.git
MiniBufExpl 插件用来导航每个打开的文件。
cd ~/.vim/bundle && \
git clone https://github.com/fholgado/minibufexpl.vim.git
配置 .vimrc
文件:
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
" MiniBufExpl Colors hi MBENormal guifg=#808080 guibg=fg hi MBEChanged guifg=#CD5907 guibg=fg hi MBEVisibleNormal guifg=#5DC2D6 guibg=fg hi MBEVisibleChanged guifg=#F1266F guibg=fg hi MBEVisibleActiveNormal guifg=#A6DB29 guibg=fg hi MBEVisibleActiveChanged guifg=#F1266F guibg=fg
(Complete)