-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
155 lines (128 loc) · 4.17 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
set nocompatible " not vi compatible
"------------------
" Syntax and indent
"------------------
syntax on " turn on syntax highlighting
set showmatch " show matching braces when text indicator is over them
" support 256 colors
set t_Co=256
" colorscheme
" colorscheme desert
" solarized, awesome colorscheme
set background=dark
colorscheme solarized
filetype plugin indent on " enable file type detection
set autoindent
set pastetoggle=<F9> " set toggle for pasting code indent
"---------------------
" Basic editing config
"---------------------
set shortmess+=I " disable startup message
set nu " number lines
set rnu " relative line numbering
set incsearch " incremental search (as string is being typed)
set hls " highlight search
set listchars=tab:>>,nbsp:~ " set list to see tabs and non-breakable spaces
set lbr " line break
set scrolloff=5 " show lines above and below cursor (when possible)
set noshowmode " hide mode
set laststatus=2
set backspace=indent,eol,start " allow backspacing over everything
set hidden " allow auto-hiding of edited buffers
set history=8192 " more history
" use 4 spaces instead of tabs during formatting
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
" smart case-sensitive search
set ignorecase
set smartcase
" tab completion for files/bufferss
set wildmode=longest,list
set wildmenu
set mouse+=a " enable mouse mode (scrolling, selection, etc)
set signcolumn=yes
"--------------------
" Misc configurations
"--------------------
" disable audible bell
set noerrorbells visualbell t_vb=
" open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" ; -> <leader>
let mapleader=";"
"---------------------
" Plugin configuration
"---------------------
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
Plugin 'preservim/nerdtree'
Plugin 'Valloric/YouCompleteMe'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'altercation/vim-colors-solarized'
Plugin 'mileszs/ack.vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'preservim/nerdcommenter'
Plugin 'mbbill/undotree'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'jiangmiao/auto-pairs'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" undotree
nnoremap <F5> :UndotreeToggle<cr>
set undofile
set undodir=$HOME/.vim/undo " make sure this dir exists
" ack.vim
map <c-e> :Ack!<space>
" let g:ackprg = 'ag --nogroup --nocolor --column'
if executable('ag')
" let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
let g:ackprg = 'ag --vimgrep'
endif
" highlight key word
let g:ackhighlight = 1
let g:ack_qhandler = "botright copen 15"
let g:ack_autoclose = 1
let g:ack_use_cword_for_empty_search = 1
" ctrlp
let g:ctrlp_map = '<c-p>'
" nerdtree
map <C-n> :NERDTreeToggle<CR>
" not show hidden files
let g:NERDTreeHidden=0
" close nerdtree if the last file closed
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" nerdcommenter
let g:NERDSpaceDelims = 1
" ultisnips
let g:UltiSnipsExpandTrigger="<leader><tab>"
let g:UltiSnipsJumpForwardTrigger="<leader><tab>"
let g:UltiSnipsJumpBackwardTrigger="<leader><s-tab>"
" ycm
map <F12> :YcmCompleter FixIt<CR>
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
let g:ycm_confirm_extra_conf = 0
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_min_num_identifier_candidate_chars = 2
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_complete_in_comments = 1
let g:ycm_complete_in_strings=1
" ctrl+j jump to definition or declaration
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>|