安装vim
pkg install vim
提供对于python的支持
pkg install vim-python
vim插件管理
这里使用的插件管理器是vundle
安装git
pkg install git
安装插件管理器
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim配置
以下是个人配置
autocmd BufWritePost $MYVIMRC source $MYVIMRC
set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936 ,latin1
set enc=utf8
set fencs=utf8,gbk,gb2312,gb18030
set number
syntax on
set hlsearch
set bg=dark
set shortmess=atI 10 set nobackup
set ruler
set showmode
set nobackup
set nowritebackup
set noswapfile
set cursorline
set cursorcolumn
set mouse=a
set showmatch
set tabstop=4
set shiftwidth=4
set autoindent
set laststatus=2
set nocompatible
set history=100
filetype on
filetype plugin on
filetype indent on
syntax enable
set cursorline
hi cursorline guibg=#00ff00
hi CursoColumn guibg=#00ff00
set softtabstop=4
set smarttab
set wildmenu
set cmdheight=2 37 set magic
set novisualbell
set noerrorbells
set mat=2
set clipboard=unnamed
set ignorecase
set smartindent
set cin
set showmatch
set vb t_vb=
set laststatus=2
au BufNewFile,BufRead *.py set tabstop=4
set softtabstop=4
set shiftwidth=4
set textwidth=79
set expandtab
set autoindent
set fileformat=unix
au BufNewFile,BufRead *.js, *.html, *.css
set tabstop=2
set softtabstop=2
set shiftwidth=2
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'majutsushi/tagbar'
Plugin 'EasyMotion'
Plugin 'neocomplcache'
Plugin 'https://github.com/Lokaltog/vim-powerline.git'
Plugin 'nine2/vim-copyright'
Plugin 'Yggdroot/indentLine'
Plugin 'godlygeek/tabular'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'justinmk/vim-syntax-extra'
Plugin 'hdima/python-syntax'
Plugin 'Raimondi/delimitMate'
Plugin 'docunext/closetag.vim'
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'nvie/vim-flake8'
Plugin 'w0rp/ale'
call vundle#end()
filetype plugin indent on
"neocomplcache
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_min_keyword_length = 3
let g:neocomplcache_enable_smart_case = 1
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
if !exists('g:neocomplcache_force_omni_patterns')
let g:neocomplcache_force_omni_patterns = {}
endif
let g:neocomplcache_force_omni_patterns.ruby = '[^. *\t]
\.\w*\|\h\w*::'
"powerline
set nocompatible
set laststatus=2
set encoding=utf-8
let g:Powerline_symbols = 'unicode'
let g:Powerline_colorscheme = 'solarized256'
let g:Powerline_stl_path_style = 'short'
set t_Co=256
"Nerdtree
map <C-n> :NERDTreeToggle<CR>
let g:nerdtree_tabs_smart_startup_focus = 1
let NERDTreeAutoCenter=1
let NERDTreeWinPos = 'left'
"vim-copyright
let g:file_copyright_name = "Liu Yukun"
let g:file_copyright_email = "3495712538@qq.com"
"Yggdroot/indentLine
let g:indentLine_noConcealCursor = 1
let g:indentLine_color_term = 239
let g:indentLine_char = '|' 140
"rainbow_parentheses.vim "complcache_start_auto_complete)6;16M
let g:rbpt_colorpairs = [ \ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['black', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 8
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound au Syntax * RainbowParenthesesLoadSquare au Syntax * RainbowParenthesesLoadBraces
au Syntax * RainbowParenthesesLoadChevrons
"python-syntax
let python_highlight_all = 1
"delimitMate
au FileType python let b:delimitMate_nesting_quotes = [' "']
"closetag.vim
let g:closetag_html_style=1
"copyright
let g:file_copyright_auto_filetypes = ['sh', 'plx', 'pl' , 'pm', 'py', 'python', 'h', 'hpp', 'c', 'cpp', 'java' , 'txt']
"tagbar
let g:tagbar_ctags_bin='ctags'
let g:tagbar_width=21
map <C-t> :Tagbar<CR>
"ale
"始终开启标志列
let g:ale_sign_column_always = 1
let g:ale_set_highlights = 0
"显示Linter名称,出错或警告等相关信息
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
nmap <C-a> :ALEToggle<CR>
nmap <C-s> :ALEDetail<CR>
let g:ale_linters = {
\ 'c++': ['clang'],
\ 'c': ['clang'],
\ 'python': ['pylint'],
\}
网友评论