mac vim IDE插件安装

一、插件集

本次安装的插件集共有16种,这些插件足以调出IDE的界面。慢慢摸索吧!

Plugin 'VundleVim/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-dispatch'
Plugin 'szw/vim-tags'
Plugin 'majutsushi/tagbar'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'Shougo/neocomplete.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'Raimondi/delimitMate'
Plugin 'ntpeters/vim-better-whitespace'

二、安装插件管理器

和在sublime text中安装插件前要安装package control插件管理器一样,要在vim中安装插件也要安装相应的插件管理器(当然不安装插件管理器也行,只是每次要安装插件时都要自己手动下载并配置,并且插件更新,删除也很麻烦,所以还是要借助插件管理器),本文中介绍的vim插件管理器为Vundle.vim。

Vundle.vim插件管理器工程托管在github上,链接为:
https://github.com/VundleVim/Vundle.vim
所以安装起来很方便,只要在终端下运行如下git命令即可:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

三、修改.vimrc文件

该文件配置示意如下,不可复制(有些内容被markdown编辑器转义),该文件可在本人资源页中下载。

” File: .vimrc
” Source: http://blog.jez.io/2015/03/03/vim-as-an-ide/
” Author: Jake Zimmerman [email protected]
” Modifier: Yan Facai [email protected]

” How I configure Vim :P

” Gotta be first
set nocompatible

filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

“” 插件管理
Plugin ‘VundleVim/Vundle.vim’

” —– Making Vim look good ——————————————
“” 色彩方案
Plugin ‘altercation/vim-colors-solarized’

“” 状态栏
Plugin ‘vim-airline/vim-airline’
Plugin ‘vim-airline/vim-airline-themes’

” —– Vim as a programmer’s text editor —————————–
“” 路径目录
Plugin ‘scrooloose/nerdtree’
“”” making NERDTree feel like a true panel, independent of tabs.
Plugin ‘jistr/vim-nerdtree-tabs’

“” 语法检查
Plugin ‘scrooloose/syntastic’

“” 异步编译
Plugin ‘tpope/vim-dispatch’

“” 标签
“”” 自动生成标签
Plugin ‘szw/vim-tags’
“”” 标签侧栏
Plugin ‘majutsushi/tagbar’

“” 模糊文件检索
Plugin ‘ctrlpvim/ctrlp.vim’

“” 自动补全
Plugin ‘Shougo/neocomplete.vim’

” —– Working with Git ———————————————-
“” 显示变动行
Plugin ‘airblade/vim-gitgutter’
“” 绑定git命令
Plugin ‘tpope/vim-fugitive’

” —– Other text editing features ———————————–
“” 配对符号补全
Plugin ‘Raimondi/delimitMate’

” Highlight and strip trailing whitespace
Plugin ‘ntpeters/vim-better-whitespace’

” Latex
“Plugin ‘VOoM’

call vundle#end()

filetype plugin indent on
syntax on

set textwidth=79 ” Maximum width of text that is being inserted. A longer
” line will be broken after white space to get this width.

“set formatoptions=tcqmM ” line break can follow an Asian Char and DO NOT insert space before
” or after an Asian Char

“vimdiff auto wrap long line
“autocmd FilterWritePre * if &diff | setlocal wrap< | endif
au VimEnter * if &diff | execute ‘windo set wrap linebreak nolist’ | endif

” — General settings —
set tabstop=4
set shiftwidth=4 ” numbers of spaces to (auto)indent
set softtabstop=4 ” backspace del 4 charac
set backspace=2 ” make backspace could del line breaks, indentation and so on
” make “tab” insert indents instead of tabs at the beginning of a line
set smarttab

” always uses spaces instead of tab characters
set expandtab

set scrolloff=3
set history=500
set showcmd
set ruler
set encoding=utf-8
set fileencodings=utf-8,gb2312,gbk,gb18030,iso-2022-jp,euc-jp,cp932,ucs-bom
set ffs=unix,dos

set hlsearch
set incsearch
set showmatch ” match when indicator is over them

set autoindent

set autoread

set number

set title ” change the terminal’s title

set visualbell ” don’t beep
set noerrorbells ” don’t beep

” Disable swap file
set nobackup
set noswapfile

“Custom key binding
” change the mapleader from \ to ,
let mapleader=”,”

” Toggle paste mode on and off
set pastetoggle=p

” Clear highlight text
nmap h :nohlsearch

” Reload vimrc
“nmap r :source ~/.vimrc

” move by rows, not linenumber
nnoremap j gj
nnoremap k gk

” Command + c, copy to system clipboard
vmap “+yi

” —– Plugin-Specific Settings ————————————–

” —– altercation/vim-colors-solarized settings —–
set t_Co=256 ” 256 color support
” use solarized color scheme
set background=dark
colorscheme solarized

” —– bling/vim-airline settings —–
” Always show statusbar
set laststatus=2

” Fancy arrow symbols, requires a patched font
” To install a patched font, run over to
” https://github.com/abertsch/Menlo-for-Powerline
” download all the .ttf files, double-click on them and click “Install”
” Finally, uncomment the next line
let g:airline_powerline_fonts = 0

” Show PASTE if in paste mode
let g:airline_detect_paste=1

” Show airline for tabs too
“let g:airline#extensions#tabline#enabled = 1

” —– jistr/vim-nerdtree-tabs —–
” Open/close NERDTree Tabs
map n NERDTreeTabsToggle
” NERDTree close on startup
let g:nerdtree_tabs_open_on_console_startup = 0

” —– scrooloose/syntastic settings —–
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_loc_list_height = 5
let g:syntastic_auto_loc_list = 1
“let g:syntastic_auto_jump = 3

let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0

” —– tpope/vim-dispatch settings —–
” Compiler

” —– szw/vim-tags settings —–
let g:vim_tags_use_vim_dispatch = 1

” —– majutsushi/tagbar settings —–
” Open/close tagbar with \b
nmap b :TagbarToggle
” Uncomment to open tagbar automatically whenever possible
“autocmd BufEnter * nested :call tagbar#autoopen(0)

” ctrlp settings
let g:ctrlp_map = ‘’
let g:ctrlp_cmd = ‘CtrlP’
let g:ctrlp_working_path_mode = ‘ra’
let g:ctrlp_root_markers = [‘pom.xml’, ‘.p4ignore’]

” eclim
let g:EclimCompletionMethod = ‘omnifunc’

” neocomplete setting
” Disable AutoComplPop.
let g:acp_enableAtStartup = 0
” Enable at startup
let g:neocomplete#enable_at_startup = 1
” Use smartcase.
let g:neocomplete#enable_smart_case = 1
” Minimum syntax keyword length
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = ‘*ku*’

“” use eclim as backend
if !exists(‘g:neocomplete#sources#omni#input_patterns’)
let g:neocomplete#sources#omni#input_patterns = {}
endif
let g:neocomplete#sources#omni#input_patterns.java = ‘\k.\k*’

” 自动关闭预览
let g:neocomplete#enable_auto_close_preview = 1

” —– airblade/vim-gitgutter settings —–
” Required after having changed the colorscheme
“hi clear SignColumn
” In vim-airline, only display “hunks” if the diff is non-zero
let g:airline#extensions#hunks#non_zero_only = 1

” vim-fugitive

” —– Raimondi/delimitMate settings —–
let delimitMate_expand_cr = 1
augroup mydelimitMate
au!
au FileType markdown let b:delimitMate_nesting_quotes = [“"]
au FileType tex let b:delimitMate_quotes = ""
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},
:’”
au FileType python let b:delimitMate_nesting_quotes = [‘”’, “’”]
augroup END

” VOoM
“nmap l :Voom latex

” vim-better-whitespace
” strip all trailing whitespace everytime you save the file for all file types.
“autocmd BufWritePre * StripWhitespace

四、安装前的最后准备:检查vim lua

本次安装的很多插件都需要lua的支持,检查vim是否支持lua有两种方式:

  1. 在vim命令模式下执行命令echo has("lua"),如果返回值为1则说明vim已经支持了lua。
  2. 在终端下执行如下命令:
    vim --version | grep "lua"
    如果返回如下结果则说明vim已经支持了lua:
    +dialog_con +lua +rightleft +windows
    Linking: clang -L. -L/usr/local/lib -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa -L/usr/local/lib -llua -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python -lruby.2.0.0 -lobjc

如果vim中没有支持lua,需要重新安装vim,运行如下命令即可:
brew update
brew install vim --with-lua

五、利用插件管理器安装插件

在终端下执行如下命令即可:
vim +PluginInstall +qall

你可能感兴趣的:(Vim,Shell)