VIM配置

来源:互联网 发布:淘宝中脉 编辑:程序博客网 时间:2024/06/05 11:59

"set term=linux

set nocompatible

filetype off

set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

Plugin 'VundleVim/Vundle.vim'

Plugin 'kien/ctrlp.vim'

"Plugin 'scrooloose/syntastic'

Plugin 'vim-airline/vim-airline'

Plugin 'vim-airline/vim-airline-themes'

Plugin 'tomasr/molokai'

Plugin 'jiangmiao/auto-pairs'

Plugin 'scrooloose/nerdtree'

Plugin 'altercation/vim-colors-solarized'

"Plugin '907th/vim-auto-save'

Plugin 'Valloric/YouCompleteMe'

Plugin 'Valloric/ListToggle'

call vundle#end()

filetype plugin indent on

"--------- ListToggle ----------"

let g:lt_location_list_toggle_map = '<leader>\'

let g:lt_quickfix_list_toggle_map = '<leader>q'

let g:lt_height = 5

"------- YouCompleteMe ---------"

"let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'

let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/cpp/.ycm_extra_conf.py'

let g:ycm_seed_identifiers_with_syntax = 1

let g:syntastic_cpp_include_dirs = ['/usr/include/']

let g:syntastic_cpp_remove_include_errors = 1

let g:syntastic_cpp_check_header = 1

let g:syntastic_cpp_compiler = 'clang++'

let g:syntastic_cpp_cflags = '-std=c++11 -w'

"let g:syntastic_cpp_compiler = 'g++' "change the compiler to g++ to support c++11.

"let g:syntastic_cpp_compiler_options = '-std=c++11 -stdlib=libstdc++' "set the options of g++ to suport

let g:ycm_confirm_extra_conf = 0

let g:ycm_complete_in_comments = 1

let g:ycm_complete_in_strings = 1

let g:ycm_error_symbol = '✗'

let g:ycm_warning_symbol = "!"

set updatetime=1000

let g:ycm_allow_changing_updatetime = 1

let g:syntastic_enable_balloons = 1

let g:ycm_autoclose_preview_window_after_completion = 1

let g:ycm_always_populate_location_list = 1

nnoremap <silent>gb :YcmCompleter GoToDefinitionElseDeclaration<CR>

nnoremap <F5> :YcmForceCompileAndDiagnostics<CR>

let g:ycm_key_list_select_completion = ['<Down>']

"nnoremap <leader>\ :lopen<CR> "open locationlist

"nmap <leader><ESC> :lclose<CR> "close locationlist

"let g:ycm_error_symbol = '>>'

"let g:ycm_warning_symbol = '>*'

"---------- Auto Save ----------"

"let g:auto_save = 1

"let g:auto_save_no_updatetime = 1

"let g:auto_save_in_insert_mode = 0

"let g:auto_save_events = ["CursorMoved","TextChanged"]

"let g:auto_save_events = ["InsertLeave", "TextChanged"]

"let g:auto_save_silent = 1

"---------- NERD Tree ----------"

map <F4> :NERDTreeToggle<CR>

let NERDTreeWinPos="right"

let NERDTreeWinSize=35

let NERDTreeChDirMode=2

let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']

let NERDTreeShowBookmarks=1

" Close vim if the only window left open is a NERD

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif

"--------- Auto Pairs ----------"

let g:AutoPairsFlyMode = 1

let g:AutoPairsShortcutBackInsert = '<F2>' "退回符号前的编辑处

let g:AutoPairsShortcutFastWrap = '<F3>' "将光标所在处的字符移至行尾

"------- Airline Themes --------"

set laststatus=2

let g:airline_powerline_fonts = 1

let g:airline_theme='powerlineish'

if !exists('g:airline_symbols')

let g:airline_symbols = {}

endif

let g:airline_left_sep = '⮀'

let g:airline_left_alt_sep = '⮁'

let g:airline_right_sep = '⮂'

let g:airline_right_alt_sep = '⮃'

let g:airline_symbols.branch = '⭠'

let g:airline_symbols.readonly = '⭤'

"------------ CtrlP ------------"

let g:ctrlp_map = ',,'

let g:ctrlp_open_multiple_files = 'v'

set wildignore+=*/tmp/*,*.so,*.swp,*.zip

let g:ctrlp_custom_ignore = {

\ 'dir': '\v[\/]\.(git)$',

\ 'file': '\v\.(log|jpg|png|jpeg)$',

\ }

"---------- Syntastic ----------"

"set statusline+=%#warningmsg#

"set statusline+=%{SyntasticStatuslineFlag()}

"set statusline+=%*

"let g:syntastic_always_populate_loc_list = 1

"let g:syntastic_auto_loc_list = 1

"let g:syntastic_check_on_open = 1

"let g:syntastic_check_on_wq = 0

"let g:syntastic_aggregate_errors = 1

"let g:syntastic_echo_current_error = 1

"let g:syntastic_error_symbol = "✗"

"let g:syntastic_warning_symbol = "!"

"let g:syntastic_auto_jump = 2

"let g:syntastic_auto_jump = 3

"let g:syntastic_enable_signs = 1

"let g:syntastic_loc_list_height = 5

"let g:syntastic_stl_format = '[Line:%fe Total:%e]'

"let b:syntastic_cpp_cflags = '-std=c++11 -w'

"map <L> :lopen<CR>

"-------- Global Config --------"

set ambiwidth=double

set number

set dictionary +=/usr/include

"set ts=3

syntax on

set hlsearch

set cursorline

set fileencodings=ucs-bom,utf-8,GB18030,gbk

set autoindent

set smartindent

set tabstop=4

set showmatch

set matchtime=1

filetype on

set shiftwidth=4

set foldenable

set foldmethod=syntax

set foldlevel=99

nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>

set history=1000

set completeopt=longest,menu

set completeopt=preview,menu

set cursorcolumn

"colorschem solarized

set background=dark "如果使用solarized主题,则开启此设置

"colorscheme darkblue

colorscheme molokai

"let g:molokai_original = 0

let g:rehash256 = 1

set t_Co=256

hi LineNr ctermfg=grey

"colorscheme desert " 经典配色方案

map <C-A> ggVG

map <F12> gg=G

autocmd! bufwritepost .vimrc source %

0 0