-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
225 lines (176 loc) · 5.5 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
" General options {{{
set nocompatible
syntax on
set autoindent
set smartindent
set expandtab
set shiftwidth=2
set tabstop=2
set softtabstop=2
set smarttab
set nojoinspaces " always single space on J, not even after full stop
set showcmd
set showmode
set backspace=indent,eol,start
set whichwrap+=h,l
set matchpairs+=<:>
set mouse=a
set scrolloff=4
set number
set ruler " relativenumber
set conceallevel=2 concealcursor=
set hlsearch incsearch
set gdefault " replace with g flag
set foldmarker={{{,}}} foldmethod=marker foldenable
set tabpagemax=20
set linespace=0 " No extra spaces between rows
set wildmenu " Show list instead of just completing
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
set wildignore=*.o,*~,*.pyc
let completeopt='menu,menuone'
set list listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
set splitright " Puts new vsplit windows to the right of the current
" set splitbelow " Puts new split windows below the current
" backups {{{
set backup backupdir=~/.vim/backupdir
if has('persistent_undo')
set undodir=~/.vim/undodir undofile
set undolevels=1000 " Maximum number of changes that can be undone
set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
endif
" }}}
" gui-relative {{{
if has('gui_running')
set guioptions-=T " Remove the toolbar
set lines=40 " 40 lines of text instead of 24
else
if &term == 'xterm' || &term == 'screen'
set t_Co=256
endif
endif
" }}}
set colorcolumn=80,100,120
" }}}
" General mappings {{{
let mapleader = ','
let localleader = ';'
nmap Q :q<CR>
nmap j 5j
vmap j 5j
nmap k 5k
vmap k 5k
nmap = <C-W>=
nmap , <C-W><
nmap . <C-W>>
nmap h <C-W>W
nmap l <C-W>w
nmap <leader>h <C-W>h
nmap <leader>j <C-W>j
nmap <leader>k <C-W>k
nmap <leader>l <C-W>l
" Visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
nnoremap <silent> <C-l> :noh<return><C-l>
" }}}
" Position restore {{{
" Instead of reverting the cursor to the last position in the buffer, we
" set it to the first line when editing a git commit message
autocmd BufReadPost * if line("'\"") > 0 && line ("'\"") <= line("$") | exe "normal! g'\"" | endif
" }}}
" Vundle {{{
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
filetype plugin indent on
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'scrooloose/nerdcommenter'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'altercation/vim-colors-solarized'
call vundle#end()
" }}}
" appearance {{{
set background=dark
let g:solarized_termcolors=16
color solarized
" if has("conceal")
" set conceallevel=0
" au FileType * setl conceallevel=0
" endif
hi clear SignColumn
hi link SignColumn LineNr
" gitgutter {{{
hi GitGutterChange ctermfg=darkblue ctermbg=0 guifg=#bbbb00
hi GitGutterDelete ctermfg=darkred ctermbg=0 guifg=#ff2222
let g:gitgutter_map_keys = 0
let g:gitgutter_realtime = 1
let g:updatetime = 750
nmap <Leader>gg :GitGutterToggle<CR>
nmap <Leader>gs <Plug>GitGutterStageHunk
nmap <Leader>gr <Plug>GitGutterRevertHunk
" }}}
" airline {{{
let g:airline_theme = 'onedark'
let g:airline_left_sep='›' " Slightly fancier than '>'
let g:airline_right_sep='‹'
" }}}
" }}}
" spellcheck {{{
set spell
set spelllang=ru_yo,en
" }}}
" ycm {{{
let g:ycm_filetype_blacklist = {}
let g:ycm_filetype_specific_completion_to_disable = {}
let g:ycm_warning_symbol = '--'
let g:ycm_add_preview_to_completeopt = 1
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_complete_in_comments = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_global_ycm_extra_conf = '~/.ycm_complete_conf.py'
let g:ycm_confirm_extra_conf = 0
" }}}
" fugitive {{{
nnoremap <Leader>gs :Gstatus<Enter>
nnoremap <Leader>gp :Gpush<Enter>
nnoremap <Leader>gl :Glog<Enter>
nnoremap <Leader>gcc :Gcommit<Enter>
nnoremap <Leader>gcv :Gcommit -v<Enter>
nnoremap <Leader>gca :Gcommit -v -a<Enter>
nnoremap <Leader>gw :Gwrite<Enter>
nnoremap <Leader>ga :Gwrite<Enter>
" }}}
" ft-specific {{{
augroup ftSpecific
autocmd!
"Makefiles {{{
autocmd FileType make setlocal noexpandtab
" }}}
" Markdown {{{
" For en/em dashes, respectively
autocmd FileType markdown imap -- –
autocmd FileType markdown imap --- —
" }}}
augroup END
" }}}
" nerdcommenter {{{
let g:NERDSpaceDelims=1
nmap <Leader>/ <Leader>c<space>
vmap <Leader>/ <Leader>c<space>
" }}}
" Run/compile mappings {{{
map <F8> :cope<Enter>:cc<Enter>
imap <F8> <Esc><F8>i
map <S-F8> :cclo<Enter>
imap <S-F8> <Esc><S-F8>i
map <F9> :cn<Enter>
imap <F9> <Esc><F9>i
map <S-F9> :cp<Enter>
imap <S-F9> <Esc><S-F9>i
map <F10> :make<Enter>:!make tests && make view-tests<Enter>
imap <F10> <Esc><F10>
" }}}
set timeoutlen=300