-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
391 lines (290 loc) · 10.2 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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
" FILE: .vimrc
" DESCRIPTION: Vim configuration file
" AUTHOR: Matt Schreck <[email protected]>
""" Startup Checks ························································{
if has("win32") || has('win64')
"This is from vim wiki. Needs to be before plugins and will set folders on windows
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif
""" }
""" Plugin Management ·····················································{
call plug#begin('~/.vim/plugged')
" Sensible vim defaults from Mr. Pope
Plug 'tpope/vim-sensible'
" Creates a 'tab' buffer displaying open buffers
Plug 'weynhamz/vim-plugin-minibufexpl'
" File system navigation sidebar
Plug 'vim-scripts/The-NERD-tree', {'on':'NERDTreeToggle'}
" Code navigation sidebar
Plug 'vim-scripts/taglist.vim', {'on':'Tlist'}
" Status line modification
Plug 'itchyny/lightline.vim'
" Do git from inside Vim
Plug 'tpope/vim-fugitive'
" File indentation detection
Plug 'Raimondi/YAIFA'
" Context aware pasting
Plug 'sickill/vim-pasta'
" Keeps a history of yanks, changes, and deletes. Like emacs killring.
Plug 'vim-scripts/YankRing.vim'
" Syntax checking through external checkers.
"Plug 'scrooloose/syntastic'
" Comment and uncomment code.
"Plug 'tomtom/tcomment_vim'
" make parens more visible
Plug 'luochen1990/rainbow'
" Colors
Plug 'chriskempson/vim-tomorrow-theme'
" Special icons for plugins
Plug 'ryanoasis/vim-devicons'
" Language plugins
"Plug 'stephpy/vim-yaml', {'for':'yaml'}
Plug 'elixir-lang/vim-elixir'
call plug#end()
""" }
""" Plugin Settings ·······················································{
"""" Rainbow
let g:rainbow_conf = {
\ 'guifgs': ['steelblue2', 'darkmagenta', 'chartreuse3', 'hotpink3', 'royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
\ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
\ 'operators': '_,_',
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
\ 'separately': {
\ '*': {},
\ 'vim': {
\ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'],
\ },
\ 'html': {
\ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=#</\z1># fold'],
\ },
\ 'css': 0,
\ }
\}
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
"""" Lightline
if has("win32") || has('win64')
let g:lightline = {
\ 'active': {
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype', 'charvaluehex' ] ],
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component': {
\ 'charvaluehex': '0x%B'
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head'
\ },
\ 'separator': { 'left': '}', 'right': '{' },
\ 'subseparator': { 'left': '›', 'right': '‹' }
\ }
else
let g:lightline = {
\ 'component': {
\ 'lineinfo': '%-2v',
\ },
\ 'component_function': {
\ 'readonly': 'LightlineReadonly',
\ 'fugitive': 'LightlineFugitive',
\ 'filetype': 'MyFiletype',
\ 'fileformat': 'MyFileformat',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
endif
function! LightlineReadonly()
return &readonly ? '' : ''
endfunction
function! LightlineFugitive()
if exists('*fugitive#head')
let branch = fugitive#head()
return branch !=# '' ? ''.branch : ''
endif
return ''
endfunction
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : '') : ' '
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ' '
endfunction
" Hide mode below status line
"set noshowmode
"""" Tlist
" For some reason this doesn't work when --remote flag is used
silent! let Tlist_Auto_Open = 0
" close all folds except for current file
let Tlist_File_Fold_Auto_Close = 1
" make tlist pane active when opened
let Tlist_GainFocus_On_ToggleOpen = 0
" quit if taglist is the only window left
let Tlist_Exit_OnlyWindow = 1
" remap F8 to toggle the Tlist window
nnoremap <silent> <F8> :Tlist<CR>
"""" NERDTree
" remap F9 to toggle NERD Tree window
nnoremap <F9> :NERDTreeToggle<CR>
" Show menu on right-hand side
let g:NERDTreeWinPos = "right"
"""" YankRing
nnoremap <silent> <F11> :YRShow<CR>
"""" MiniBufExpl
" Mouseclick on buffer focuses it
let g:miniBufExplUseSingleClick = 1
" Only require one buffer to open MBE
let g:miniBufExplBuffersNeeded = 1
" Keyboard mappings
noremap <C-J> <C-W>j
noremap <C-K> <C-W>k
noremap <C-H> <C-W>h
noremap <C-L> <C-W>l
noremap <C-TAB> :bn<CR>
noremap <C-S-TAB> :bp<CR>
map <Leader>t :MBEToggle<cr>
map <Leader>w :MBEbd!<cr>
" map <Leader>e :MBEOpen<cr>
" map <Leader>c :MBEClose<cr>
""" }
""" General Settings ······················································{
" here's some stuff for spell correcting:
" this jumps to the previous spelling error and chooses the first suggestion,
" then jumps us back to where we are
" <c-g>u inserts an undo-break, so we can undo this with <esc>u
" when we undo, it jumps us to the start of that word! Handy!
imap <c-f> <c-g>u<Esc>[s1z=`]a<c-g>u
nmap <c-f> [s1z=<c-o>
" Use shared clipboard if available
set clipboard=unnamed
" only redraw when needed. supposedly makes macros faster.
set lazyredraw
" be able to handle my common filetypes. GBK still seems broken
set encoding=utf-8
set fileencodings+=prc
" I use this on non-English systems, so set gvim menu to EN
set langmenu=en_US.UTF-8
" Auto read externally modified files.
set autoread
" Auto write before certain commands.
set autowrite
" Keep a backup file
set backup
" Do not back up temporary files.
set backupskip=/tmp/*,/private/tmp/*"
" Store backup files in one place.
set backupdir^=$HOME/.vim/backup//
" Store swap files in one place.
set dir^=$HOME/.vim/swap//
" Store undo files in one place.
set undodir^=$HOME/.vim/undo//
" Store view files in one place.
set viewdir=$HOME/.vim/view//
" Save undo tree.
set undofile
" Save battery by letting OS flush to disk.
set nofsync
" keep 1000 undo levels
set undolevels=1000
""" }
""" Presentation ··························································{
" display incomplete commands
set showcmd
"shows line numbers
set nu
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
" Turn mouse on
set mouse=a
" Hide the mouse when typing text
set mousehide
endif
" Lets you navigate away from unsaved buffers
set hidden
" Show hidden characters by default
set list!
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Never let a window be less than 1px.
set winminheight=1
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:›₋,eol:¬,trail:·,extends:»,precedes:«
set textwidth=0
set wrapmargin=0
" Highlight search matches
set hlsearch
" Remove toolbar if available
set guioptions-=T "remove toolbar
if has('osx')
set guifont=Knack\ Regular\ Nerd\ Font\ Complete:h12
endif
if has('win32') || has('win64')
" Set font
set guifont=consolas:h10
" Set window size to something bigger. This feels good on windows
set lines=50 columns=120
endif
""" }
""" Color Schemes ·························································{
" Silent so that Vim won't complain if plugins haven't been loaded yet
if has('win32') || has('win64')
" Change colorscheme to something that looks better on windows
silent! colorscheme Tomorrow-Night-Eighties
else
silent! colorscheme Tomorrow-Night
endif
""" }
""" System Specific Tweaks ················································{
"if has("unix")
" let s:uname = system("uname")
" if s:uname == "darwin\n"
" " do mac stuff here
" endif
" if s:uname == "linux\n"
" " do linux stuff here
" endif
"endif
if has('win32') || has('win64')
" CTRL-X and SHIFT-Del are Cut
vnoremap <C-X> "+x
vnoremap <S-Del> "+x
" CTRL-C and CTRL-Insert are Copy
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
" CTRL-V and SHIFT-Insert are Paste
map <C-V> "+gP
map <S-Insert> "+gP
cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+
" Pasting blockwise and linewise selections is not possible in Insert and
" Visual mode without the +virtualedit feature. They are pasted as if they
" were characterwise instead.
" Uses the paste.vim autoload script.
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
imap <S-Insert> <C-V>
vmap <S-Insert> <C-V>
" Use CTRL-Q to do what CTRL-V used to do
noremap <C-Q> <C-V>
" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG
endif
""" }
""" Deprecated Stuff ······················································{
" good for perl
"set softtabstop=4 shiftwidth=4 expandtab
" set a more convinient map leader
" let mapleader=','
" fast exit from insert mode by pressing jk simultaneously
"inoremap kj <esc>
"inoremap jk <esc>
" don't move your fingers to arrow keys for history
"cnoremap <c-k> <up>
"cnoremap <c-j> <down>
""" }