vimrc

4 篇文章 0 订阅
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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值