set encoding=utf-8
set termencoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
Bundle 'gmarik/vundle'
Bundle 'scrooloose/nerdtree'
" Bundle 'majutsushi/tagbar'
Bundle 'tmhedberg/SimpylFold'
Bundle 'vim-scripts/indentpython.vim'
Bundle 'Valloric/YouCompleteMe'
" Bundle 'scrooloose/syntastic'
Bundle 'nvie/vim-flake8'
Bundle 'jnurmine/Zenburn'
Bundle 'altercation/vim-colors-solarized'
" Bundle 'klen/python-mode'
filetype plugin indent on
" Backspace deletes like most programs in insert mode
set backspace=2
" Show the cursor position all the time
set ruler
" Display incomplete commands
set showcmd
" Set fileencodings
set fileencodings=utf-8
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Display extra whitespace
set list listchars=tab:»·,trail:·
" Make it obvious where 80 characters is
set textwidth=256
set colorcolumn=+1
" Highlight current line
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline cursorcolumn
set cursorline cursorcolumn
" Numbers
set number
set numberwidth=5
set matchpairs+=<:>
set hlsearch
" NERD tree
let NERDChristmasTree=0
let NERDTreeWinSize=25
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
let NERDTreeShowBookmarks=1
let NERDTreeWinPos="left"
" Automatically open a NERDTree if no files where specified
autocmd vimenter * if !argc() | NERDTree | endif
" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Open a NERDTree
" nmap <F5> :NERDTreeToggle<cr>
nmap <F5> :NERDTreeFocus<cr>
" Tagbar
let g:tagbar_width=25
let g:tagbar_autofocus=1
nmap <F6> :TagbarToggle<CR>
" SimplyFold
let g:SimpylFold_docstring_preview=1
" Enable folding with the spacebar
nnoremap <space> za
" set mouse=n
" colorscheme
" if has('gui_running')
" set background=dark
" colorscheme solarized
" else
" colorscheme zenburn
" endif
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=256 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix |
set completeopt=longest,menu
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
inoremap <expr> <CR> pumvisible() ? '<C-y>' : '<CR>'
inoremap <expr> <Down> pumvisible() ? '<C-n>' : '<Down>'
inoremap <expr> <Up> pumvisible() ? '<C-p>' : '<Up>'
inoremap <expr> <PageDown> pumvisible() ? '<PageDown><C-p><C-n>' : '<PageDown>'
inoremap <expr> <PageUp> pumvisible() ? '<PageUp><C-p><C-n>' : '<PageUp>'
let g:ycm_key_list_select_completion = ['<tab>']
let g:ycm_key_list_previous_completion = ['<s-tab>']
let g:ycm_confirm_extra_conf=0
let g:ycm_collect_identifiers_from_tags_files=1
let g:ycm_min_num_of_chars_for_completion=2
let g:ycm_cache_omnifunc=0
let g:ycm_seed_identifiers_with_syntax=1
nnoremap <F7> :YcmForceCompileAndDiagnostics<CR>
inoremap <leader><leader> <C-x><C-o>
let g:ycm_complete_in_comments = 1
let g:ycm_complete_in_strings = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:syntastic_cpp_compiler = 'g++'
let g:syntastic_cpp_compiler_options = '-std=c++11 -stdlib=libc++'
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
" if $DISPLAY =~ '\(\(cos\|scs\)\d\+nai\d\+\)\|\(spkpc\d\+\)\|\(tc-garyjohn\)'
set clipboard=autoselect,exclude:.*
" endif
" nnoremap <c-l> <c-v>
autocmd FileType sh nnoremap <buffer> <c-a> :w<CR>:!sh % <CR>
autocmd FileType python nnoremap <buffer> <c-a> :w<CR>:!python % <CR>
autocmd FileType cpp nnoremap <buffer> <c-a> :w<CR>:!g++ % -o %:r.bin --std=c++11; ./%:r.bin <CR>
if &term =~ '256color'
set t_ut=
endif
vimrc
最新推荐文章于 2023-03-10 13:55:38 发布