vimrc

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  :NERDTreeToggle
nmap  :NERDTreeFocus

" Tagbar
let g:tagbar_width=25
let g:tagbar_autofocus=1
nmap  :TagbarToggle

" SimplyFold
let g:SimpylFold_docstring_preview=1
" Enable folding with the spacebar
nnoremap  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         pumvisible() ? '' : ''

inoremap       pumvisible() ? '' : ''
inoremap         pumvisible() ? '' : ''
inoremap   pumvisible() ? '' : ''
inoremap     pumvisible() ? '' : ''

let g:ycm_key_list_select_completion = ['']
let g:ycm_key_list_previous_completion = ['']
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  :YcmForceCompileAndDiagnostics

inoremap  

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 jd :YcmCompleter GoToDefinitionElseDeclaration
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 -l> 
autocmd FileType sh nnoremap  -a> :w:!sh % 
autocmd FileType python nnoremap  -a> :w:!python % 
autocmd FileType cpp nnoremap  -a> :w:!g++ % -o %:r.bin --std=c++11; ./%:r.bin 

if &term =~ '256color'
  set t_ut=
endif

你可能感兴趣的:(linux,vim)