the5fire

关注Python、Django、Vim、Linux、Web开发、团队管理和互联网--Life is short, we need Python.


最近的vim配置

作者:the5fire | 标签:       | 发布:2016-09-07 6:48 a.m. | 阅读量: 10220, 9875

前段时间调整了vim配置,尝试了下python-mode这个集成的配置。最终还是以体验太差告终,主要在性能方面,可能是我的Air配置太Low了。经常出现噼里啪啦打完一堆代码,发现屏幕没反应,延时一段时间(可能是1、2秒)时候屏幕开始自动出现字符。当然除了性能问题之外,其他的PyMode已经处理的很好了。省去了装很多插件的麻烦。但问题是会帮你装上很多你用不到的插件。

于是又重新回到了自己动手的年代,毕竟性能在这摆着,最好还是按需安装。今天又把所有的插件都梳理了一遍,该升级的升级一下。其中关于YouCompleteMe的一个问题需要说下,具体就是

Traceback(mostrecentcalllast):File"/Users/the5fire/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/server_utils.py",line95,inCompatibleWithCurrentCoreycm_core=ImportCore()File"/Users/the5fire/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/server_utils.py",line87,inImportCoreimportycm_coreasycm_coreImportError:Nomodulenamedycm_core

问题原因是Python解释器的问题,增加如下配置即可:

let g:ycm_server_python_interpreter = '/usr/local/bin/python'

最新的配置如下:

setnocompatible" be iMproved, requiredfiletype off                  " required" set the runtime path to include Vundle and initializesetrtp+=~/.vim/bundle/Vundle.vim" call vundle#begin()call vundle#rc()" let Vundle manage Vundle" required! 
Plugin 'VundleVim/Vundle.vim'

Plugin 'tpope/vim-sensible'
Plugin 'scrooloose/nerdtree'   
Plugin 'kien/ctrlp.vim'        
Plugin 'tpope/vim-fugitive'    
Plugin 'scrooloose/syntastic' 
Plugin 'hynek/vim-python-pep8-indent'
Plugin 'scrooloose/nerdcommenter'   
Plugin 'Valloric/YouCompleteMe'letg:ycm_server_python_interpreter ='/usr/local/bin/python'
Plugin 'majutsushi/tagbar'     
Plugin 'mileszs/ack.vim'       
Plugin 'rking/ag.vim'" 文档编辑" restructtext"Plugin 'Rykka/riv.vim'
Plugin 'tommcdo/vim-exchange'
Plugin 'terryma/vim-multiple-cursors'       
Plugin 'Lokaltog/vim-easymotion'
Plugin 'Flowerowl/ici.vim'" 状态栏
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'" 配色
Plugin 'altercation/vim-colors-solarized'" golang
Plugin 'jnwhiteh/vim-golang'
Plugin 'dgryski/vim-godef'
Plugin 'nsf/gocode', {'rtp': 'vim/'}

" vim-scripts repos
Plugin 'L9'" Java Conf"Plugin 'Vim-JDE'"Plugin 'JavaBrowser'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'"" 一些基本配置"setantienc=utf-8setguifont=Source_Code_Pro:h12

filetype plugin indent on" required!" Set to auto read when a file is changed from the outsidesetautoreadlet mapleader =','letg:mapleader =','let &termencoding=&encodingsetfileencodings=utf-8,gb18030,gbk,gb2312,big5
setnumbersetguifont=Courier_New:h16
setguifontwide=STXihei:h16
letg:syntastic_python_checkers=['flake8']
letg:syntastic_python_checker_args='--ignore=W501,E225'let syntastic_python_checker_args='--ignore=E501,E225'" Ignore case when searchingsetignorecasesmartcase" Highlight search resultssethlsearchincsearch" Use spaces instead of tabssetexpandtabsmarttabshiftwidth=4tabstop=4"Always show current positionsetrulerletg:pymode_breakpoint_cmd ='import pdb; pdb.set_trace()  # XXX BREAKPOINT'"" Height of the command barsetcmdheight=2"禁止生成临时文件setnobackupsetnoswapfilesetwrap" golangsetrtp+=$GOPATH/src/github.com/golang/lint/misc/vim"autocmd BufferWritePost,FileWritePost *.go execute 'go fmt'"autocmd BufWritePre *.go '!go fmt'
autocmd FileTypego autocmd BufWritePre<buffer> Fmt

vmap <c-c> :w!pbcopy<CR><CR>" 状态栏配置setlaststatus=2"always has status linesyntax enable
setbackground=darkcolorscheme solarized


" NERDTree=====
nmap <leader>n :NERDTreeToggle<CR>let NERDTreeWinSize=24let NERDTreeIgnore=['\.pyc','\.swp','\~']
"switch windownnoremap<c-h><c-w>hnnoremap<c-j><c-w>jnnoremap<c-k><c-w>knnoremap<c-l><c-w>l" tagbar
nmap <F4> :TagbarToggle<CR>letg:tagbar_ctags_bin='/usr/local/bin/ctags'" Proper Ctags locationsletg:tagbar_width=26" Default is 40, seems too widenoremap<Leader>y :TagbarToggle<CR>" Display panel with y (or ,y)" LustyBufferExplorer====="nnoremap <leader>lb :LustyBufExplorer<CR>sethidden"let g:syntastic_go_checkers=['go', 'govet', 'golint']letg:Powerline_symbols ='fancy'letg:Powerline_colorscheme='solarized256_dark'sett_Co=256" 在终端启用256色letg:ycm_path_to_python_interpreter ='/usr/bin/python'" Track the engine.
Plugin 'SirVer/ultisnips'" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'" Trigger configuration. Do not use <tab> if you use" https://github.com/Valloric/YouCompleteMe.letg:UltiSnipsExpandTrigger="<tab>"letg:UltiSnipsJumpForwardTrigger="<c-b>"letg:UltiSnipsJumpBackwardTrigger="<c-z>"" If you want :UltiSnipsEdit to split your window.letg:UltiSnipsEditSplit="vertical"letg:ctrlp_custom_ignore = {
  \ 'dir':  'node_modules',
  \ }

" All of your Plugins must be added before the following linecall vundle#end()" requiredfiletype plugin indent on" required"" Brief help" :BundleList          - list configured bundles" :BundleInstall(!)    - install(update) bundles" :BundleSearch(!) foo - search(or refresh cache first) for foo" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles" 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

vim

- from the5fire.com
----EOF-----

微信公众号:Python程序员杂谈


其他分类: