-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.vimrc
375 lines (303 loc) · 12.6 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
" For iterm2
set t_Co=256
"
" **************************************
" * Plug plugin package manager
" **************************************
set nocompatible
filetype off
" Install Plug by default
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'vimwiki/vimwiki'
let g:vimwiki_list = [{'path': '~/aeonneo/content',
\ 'syntax': 'markdown', 'ext': '.md',
\ 'index': 'about'}]
Plug 'jiangmiao/auto-pairs'
" Don't jump to close bracket on different line
let g:AutoPairsMultilineClose = 0
" Plugin indentLine - show matching indents
Plug 'Yggdroot/indentLine'
"let g:indentLine_color_term = 8
"let g:indentLine_char = '»'
let g:indentLine_char = '|'
"let g:indentLine_leadingSpaceChar = '·'
"let g:indentLine_leadingSpaceChar = ' '
"let g:indentLine_leadingSpaceEnabled = 1
let g:indentLine_faster = 1
let g:tex_conceal = ""
" On markdown files, where indentLine doesn't apply anyway, set conceallevel
" to 0 to show asterisks and special characters
autocmd BufNewFile,BufRead *.md let g:indentLine_setConceal = 0
autocmd BufNewFile,BufRead *.json let g:indentLine_setConceal = 0
autocmd BufNewFile,BufRead *.json let g:indentLine_enabled = 0
" end indentLine
" Plugin vim-css-color
Plug 'ap/vim-css-color'
" Plugin ConqueTerm
Plug 'vim-syntastic/syntastic'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': ['c'],'passive_filetypes': [] }
let g:syntastic_quiet_messages={'level':'warnings'}
" Syntastic is auto-disabled by YCM
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
"highlight SyntasticErrorLine ctermbg=160 " change the color of error line
"hi SpellBad ctermfg=255 ctermbg=160 guifg=#yyyyyy guibg=#zzzzzz
"hi SpellCap ctermfg=255 ctermbg=016 guifg=#yyyyyy guibg=#zzzzzz
" change color of (gutter) Sign Column from gray to no color
highlight SignColumn ctermbg=none
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --tern-completer' }
" Close complete buffer after choosing option
"autocmd CompleteDone * pclose
"let g:ycm_python_binary_path = '/Library/Frameworks/Python.framework/Versions/3.4/bin/python3'
"let g:ycm_global_ycm_extra_conf = '~/.vim/plugged/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
"let g:ycm_register_as_syntastic_checker = 0
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
"highlight YcmErrorSection cterm=none ctermbg=red ctermfg=black
"highlight YcmWarningSection cterm=none ctermbg=yellow ctermfg=black
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" Vimproc - async vim; needed for vdebugger
"Plugin 'Shougo/vimproc.vim'
" Vim debugger
"Plugin 'idanarye/vim-vebugger'
" Dark mode Unite - fuzzy search through files/contents
"Plugin 'Shougo/denite.nvim'
"nnoremap <C-P> :Denite -buffer-name=files -start-insert file_rec/async:!<cr>
"nnoremap <space>/ :Denite -no-empty -no-resize grep<cr>
"nnoremap <space>s :Denite -quick-match buffer<cr>
Plug 'tpope/vim-fugitive'
" more bundles here
call plug#end()
" **************************************
" **************************************
" * COMMANDS THAT MUST COME AFTER VUNDLE
" **************************************
" **************************************
" * VARIABLES
" **************************************
" map xdate to fill in date
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
" **************************************
" * ESSENTIAL REMAPS
" **************************************
" Enable jk becomes es
imap jk <Esc>
" Use l; to save and quit
noremap l; :wq<CR>
" set shortcut delay time - first is mapping delay, second is key code delay
set timeout timeoutlen=250 ttimeoutlen=100
" Mapleader
" make space do nothing
" make space the leader
nnoremap <SPACE> <Nop>
let mapleader = "\<Space>"
" **************************************
" **************************************
" * Leader shortcuts
" **************************************
" Fast saving
noremap <leader>w :w<cr>
" Let '<leader>b' toggle between this and the last accessed buffer
noremap <leader><SPACE> :b#<cr>
" Let '<leader>q' save and quit all
noremap <leader>q :wqa<cr>
" Toggle paste mode on and off
noremap <leader>p :setlocal paste!<cr>
" Turn off highlighting until next search
noremap <leader>/ :noh<cr>
" Fast Align
" Further references: http://stackoverflow.com/questions/235839/indent-multiple-lines-quickly-in-vi
noremap <leader>a mzgg=G`z:delmarks z<cr>
" Convert all tabs to spaces
noremap <leader>t :exe '%!expand -t ' . &shiftwidth
" Rotate buffers
noremap <leader>j :bn<cr>
noremap <leader>k :bp<cr>
" Vertical and horizontal splitting
noremap <leader>v :vs<cr>
noremap <leader>h :sp<cr>
" Toggle fold
noremap <leader>f za
" vimdiff shortcuts
" http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/
noremap <leader>l :diffg LO<cr>
noremap <leader>r :diffg RE<cr>
noremap <leader>b :diffg BA<cr>
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
"
nnoremap <leader>g :YcmCompleter GoTo<cr>
" **************************************
" **************************************
" * Nice General Settings
" **************************************
set term=screen-256color
set nocompatible " get rid of strict vi compatibility!
set nu " line numbering on
set autoindent " autoindent on
set noerrorbells " bye bye bells :)
set visualbell " Since IntelliJ doesn't understand noerrorbells it will understand to switch to visualbells.
set modeline " show what I'm doing
set showmode " show the mode on the dedicated line
set nowrap " no text wrapping
set ignorecase " search without regards to case
set backspace=indent,eol,start " backspace over everything
set fileformats=unix,dos,mac " open files from mac/dos
set exrc " open local config files
set nojoinspaces " don't add white space when I don't tell
set ruler " which line am I on?
set showmatch " ensure Dyck language; show matching {()} or as typed.
set incsearch " incremental searching
set hlsearch " highlight searches (can be turned off with <leader>/)
set bs=2 " fix backspacing in insert mode
set cursorline " highlights current line
set formatoptions+=r " auto add askerus for comments
set rnu " Set relative numbers
set clipboard^=unnamed " Use system copy/paste keyboard for yank and delete
set colorcolumn=120 " Mark the 120th column
set confirm " Prompt if unsaved changes in buffer
set splitbelow " More natural file splitting
set splitright
" vertical/horizontal scroll settings
set scrolloff=3 " keep this many lines between cursor and top/bottom when scrolling
set sidescrolloff=7 " if <7 columns from end or beginning, scroll
set sidescroll=1 " scroll by 1 char at a time (0 for half a string)
" sets tab to fill wildchars for buffers
set wildchar=<tab> wildmenu wildmode=full
" Swap return to line and return to position
nnoremap ' `
nnoremap ` '
" Easier split navigations - remap left and right, up and down
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" **************************************
" Show syntax colors
syntax on
" **************************************
" * Folding
set foldnestmax=2 " only fold up to method headers
set foldlevel=2
set foldmethod=syntax
set nofoldenable " don't fold on file open
" persistent save folds
au BufWinLeave ?* mkview
au BufWinEnter ?* silent loadview
" On save, remove trailing whitespace
" autocmd BufWritePre * %s/\s\+$//e
"set foldmarker={,}
" **************************************
" **************************************
" * Intelligent Indenting
" **************************************
set softtabstop=4 " backspace will backspace a tab if possible
set tabstop=4 " Smart indenting
set shiftwidth=4 " 1 tab == 4 spaces
set expandtab " Use spaces instead of tabs
set nosmartindent
" switch tabs on for makefiles (they won't work with spaces):
au BufRead,BufNewfile Makefile set ts=4 sw=4 noexpandtab
" **************************************
" **************************************
" * COLOR HIGHLIGHTING
" **************************************
"Themes
colorscheme zellner
" Highlight color of Matching parentheses
highlight MatchParen cterm=underline ctermbg=none ctermfg=white
" Line number highlight
"highlight LineNr ctermfg=white
highlight CursorLineNr ctermfg=white
" Highlight color of VISUAL mode
highlight Visual ctermbg=darkblue
highlight Visual ctermfg=white
" DiffAdd - line was added
highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
" DiffDelete - line was removed
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
" DiffChange - part of line was changed (highlights whole line)
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
" DiffText - exact part of the line that changed
highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red
highlight SignColumn ctermbg=none
" YCM Highlighting
highlight YcmErrorSection cterm=none ctermbg=red ctermfg=black
highlight YcmWarningSection cterm=none ctermbg=yellow ctermfg=black
" **************************************
" * Format statusline
" **************************************
" Format statusline coloring to change on insert/normal
if version >= 700
highlight statusline cterm=bold ctermfg=black ctermbg=red
au InsertLeave * highlight Statusline cterm=bold ctermfg=black ctermbg=red
au InsertEnter * highlight Statusline cterm=bold ctermfg=black ctermbg=white
endif
function! HighlightSearch()
if &hls
return '_H'
else
return ''
endif
endfunction
set statusline=
set statusline+=%7*\[%n] "buffernr
set statusline+=%1*\ %<%F\ "File+path
set statusline+=%2*\ %y\ "FileType
set statusline+=%3*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding
set statusline+=%3*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
set statusline+=%4*\ %{&ff}\ "FileFormat (dos/unix..)
set statusline+=%5*\ %{&spelllang}\%{HighlightSearch()}\ "Spellanguage & Highlight on?
set statusline+=%{v:register} " Current paste buffer
set statusline+=%8*\ %=\ row:%l/%L\ (%03p%%)\ "Rownumber/total (%)
set statusline+=%9*\ col:%03c\ "Colnr
set statusline+=%0*\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot.
highlight StatusLineNC ctermbg=0 cterm=none gui=none
highlight Search ctermbg=27
set laststatus=2 " always show statusline
" **************************************
" Remove background/foreground flipping by italic style
highlight htmlItalic term=NONE cterm=NONE gui=NONE
highlight htmlBold term=NONE cterm=NONE gui=NONE
" **************************************
" Disable htmlBold and htmlItalic in
" /usr/local/Cellar/vim/8.0.0503/share/vim/vim80/syntax/html.vim
hi link htmlBold Storage
hi link htmlItalic Identifier
" **************************************
" * => Turn persistent undo on
" * means that you can undo even when you close a buffer/VIM
" **************************************
try
set undodir=~/.vim/undodir
set undofile
catch
endtry
" **************************************
" **************************************
" * Uncomment the following to have Vim jump to the last position when reopening a file
" **************************************
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" **************************************
set showcmd " show commands
set whichwrap +=>,l
set whichwrap +=<,h " let l and h wrap around.
" load ftplugins and indent files
filetype plugin indent on
" **************************************
"set shortmess+=c " https://github.com/Valloric/YouCompleteMe/issues/1562
" After vimdiff; or use diffoff!
set foldcolumn=0