the5fire的技术博客

关注python、vim、linux、web开发和互联网--life is short, we need python.


最近的vim配置

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

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

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

Traceback (most recent call last):
  File "/Users/the5fire/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/server_utils.py", line 95, in CompatibleWithCurrentCore
    ycm_core = ImportCore()
  File "/Users/the5fire/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/server_utils.py", line 87, in ImportCore
    import ycm_core as ycm_core
ImportError: No module named ycm_core

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

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

最新的配置如下:

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()
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'
let g: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'


"
" 一些基本配置
"
set anti enc=utf-8
set guifont=Source_Code_Pro:h12

filetype plugin indent on     " required!
" Set to auto read when a file is changed from the outside
set autoread
let mapleader = ','
let g:mapleader = ','
let &termencoding=&encoding
set fileencodings=utf-8,gb18030,gbk,gb2312,big5
set number

set guifont=Courier_New:h16
set guifontwide=STXihei:h16
let g:syntastic_python_checkers=['flake8']
let g:syntastic_python_checker_args='--ignore=W501,E225'
let syntastic_python_checker_args='--ignore=E501,E225'
" Ignore case when searching
set ignorecase smartcase
" Highlight search results
set hlsearch incsearch
" Use spaces instead of tabs
set expandtab smarttab shiftwidth=4 tabstop=4
"Always show current position
set ruler

let g:pymode_breakpoint_cmd = 'import pdb; pdb.set_trace()  # XXX BREAKPOINT'

"" Height of the command bar
set cmdheight=2
"禁止生成临时文件
set nobackup
set noswapfile

set wrap

" golang
set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
"autocmd BufferWritePost,FileWritePost *.go execute 'go fmt'
"autocmd BufWritePre *.go '!go fmt'
autocmd FileType go autocmd BufWritePre <buffer> Fmt

vmap <c-c> :w !pbcopy<CR><CR>

" 状态栏配置
set laststatus =2 "always has status line

syntax enable
set background=dark
colorscheme solarized


" NERDTree=====
nmap <leader>n :NERDTreeToggle<CR>
let NERDTreeWinSize=24
let NERDTreeIgnore=['\.pyc', '\.swp', '\~']
"switch window
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l

" tagbar
nmap <F4> :TagbarToggle<CR>
let g:tagbar_ctags_bin='/usr/local/bin/ctags'  " Proper Ctags locations
let g:tagbar_width=26                          " Default is 40, seems too wide
noremap <Leader>y :TagbarToggle<CR>       " Display panel with y (or ,y)

" LustyBufferExplorer=====
"nnoremap <leader>lb :LustyBufExplorer<CR>
set hidden

"let g:syntastic_go_checkers=['go', 'govet', 'golint']
let g:Powerline_symbols = 'fancy'
let g:Powerline_colorscheme='solarized256_dark'
set t_Co=256                   " 在终端启用256色

let g: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.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
let g:ctrlp_custom_ignore = {
  \ 'dir':  'node_modules',
  \ }

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype 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


----EOF-----

扫码关注,或者搜索微信公众号:码农悟凡


其他分类: