-
Notifications
You must be signed in to change notification settings - Fork 8
/
rc
504 lines (380 loc) · 9.87 KB
/
rc
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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
set nocompatible
let mapleader = "\<Space>"
" PLUGIN MANAGEMENT (VUNDLE)
" NOTE comments after Bundle command are not allowed
" ====>
" This is required
filetype off
" Initialize Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Also required
Bundle 'gmarik/vundle'
" =====
" Split Management
" ====>
set splitbelow
set splitright
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>
" ====
" GENERAL
" ====>
" Copy with highlighting to Keynote
" Bundle 'dharanasoft/rtf-highlight'
" Editor Config
Bundle 'editorconfig/editorconfig-vim'
" Interactive Shell
Bundle 'lrvick/Conque-Shell'
" Automatically reload .vimrc on save
autocmd! bufwritepost .vimrc source %
" Open folder in Terminal
nnoremap <leader>. :!open -a Terminal .<cr>
" Smart indentation
set autoindent
set smartindent
" Tab stops
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" Format
Bundle 'Chiel92/vim-autoformat'
" Whitespace
Bundle 'bronson/vim-trailing-whitespace'
" Unicode
set encoding=utf-8
" Highlight matching brace/parenthese/bracket
set showmatch
" Visual bell
set vb t_vb=
set novisualbell
" Watch for file changes
set autoread
" Line endings
set fileformats=unix
set ff=unix
" Free-range cursor in INSERT mode
" set virtualedit=all
" Keep all the temporary and backup files in one place
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set nobackup
set noswapfile
" Remap split commands
nnoremap <leader>h :split<cr>
nnoremap <leader>v :vsplit<cr>
" Undo in INSERT mode
imap <c-z> <c-o>u
" Make tabbing in VISUAL mode keep highlighting
vmap <tab> >gv
vmap <s-tab> <gv
" Remove scrollbars
if has('gui_running')
set guioptions-=l
set guioptions-=r
set guioptions-=b
end
" Persistent undo
if v:version >= 703
set undofile
set undodir=~/.vim/tmp
endif
" =====
" GENERATE BASH PROMPT
" ====>
Bundle 'edkolev/promptline.vim'
let g:promptline_theme = 'airline'
let g:promptline_preset = {
\'a' : [ promptline#slices#cwd() ],
\'b' : [ '\W' ],
\'warn' : [ promptline#slices#vcs_branch() ]}
" =====
" SPELL CHECKING
" ====>
" Turn off spell checking (colors made text unreadable)
set nospell
set spelllang=en
" Show only 9 suggestions for misspelled words
set spellsuggest=9
" =====
" SEARCH
" ====>
" Incremental search with ignore case (except explicit caps)
set incsearch
set ignorecase
set smartcase
set showmatch
set hlsearch
" Clear search highlighting
nnoremap <leader><space> :noh<cr>
" Search highlighting
set hls
"set nohls
" Ruby-ish regular expressions
map / /\v
" Center search results while browsing
map N Nzz
map n nzz
" =====
" Languages
" ====>
" Swift
" Bundle 'toyamarinyon/vim-swift'
" Arduino
" Bundle 'kingbin/vim-arduino'
" LaTeX
" Bundle 'vim-scripts/TeX-PDF'
" au BufWritePost *.tex silent :!pdflatex "%"<CR>
" =====
" EDITING
" ====>
" Writing
Bundle 'reedes/vim-pencil'
" Splitting / Joining
Bundle 'AndrewRadev/splitjoin.vim'
" Bash command color
Bundle 'AnsiEsc.vim'
" Fix syntax highlighting for .md files
au BufRead,BufNewFile *.md set filetype=markdown
" C++ better highlighting
" Bundle 'octol/vim-cpp-enhanced-highlight'
" Multiple cursors
Bundle 'terryma/vim-multiple-cursors'
" Distraction Free
Bundle 'junegunn/goyo.vim'
nnoremap <leader>z :Goyo<CR>
Bundle 'bufexplorer.zip'
map <C-b> :BufExplorer<CR>
map <C-x> :bp\|bd #<CR>
Bundle 'taskpaper.vim'
" Syntastic
" Bundle 'scrooloose/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_javascript_checkers = ['eslint']
" Go
" au FileType go nmap <leader>r <Plug>(go-run)
" au FileType go nmap <leader>b <Plug>(go-build)
" au FileType go nmap <leader>t <Plug>(go-test)
" au FileType go nmap <leader>c <Plug>(go-coverage)
" let g:go_highlight_functions = 1
" let g:go_highlight_methods = 1
" let g:go_highlight_structs = 1
" let g:go_highlight_interfaces = 1
" let g:go_highlight_operators = 1
" let g:go_highlight_build_constraints = 1
" let g:go_highlight_extra_types = 1
" Bundle 'fatih/vim-go'
" Elixir
" Bundle 'elixir-lang/vim-elixir'
" Bundle 'mattreduce/vim-mix'
" Bundle 'mmorearty/elixir-ctags'
" nnoremap <leader>t :!mix test --no-color %<CR>
" Elm
" Bundle 'lambdatoast/elm.vim'
" Surround
Bundle 'tpope/vim-surround'
" React/JSX
Bundle 'mxw/vim-jsx'
let g:jsx_ext_required = 0
" Python
Bundle 'hdima/python-syntax'
let python_highlight_all = 1
" Run tests
Bundle 'vim-test/vim-test'
nmap <silent> <leader>tn :TestNearest<CR>
nmap <silent> <leader>tf :TestFile<CR>
nmap <silent> <leader>ts :TestSuite<CR>
nmap <silent> <leader>tl :TestLast<CR>
nmap <silent> <leader>tg :TestVisit<CR>
Bundle 'benmills/vimux'
Bundle 'voldikss/vim-floaterm'
Bundle 'tpope/vim-dispatch'
" LiveScript
" Bundle 'gkz/vim-ls'
" au BufNewFile,BufRead *.ls set ft=ls
" CoffeeScript
" au BufNewFile,BufRead *.coffee set ft=coffee
" Jade
" Bundle 'digitaltoad/vim-jade'
" au BufNewFile,BufRead *.jade set ft=jade
" HTML5
Bundle 'othree/html5.vim'
" LESS
" Bundle 'groenewege/vim-less'
" au BufNewFile,BufRead *.less set ft=less
" Handlebars
" Bundle 'nono/vim-handlebars'
" Align text
Bundle 'godlygeek/tabular'
" Bundle 'vim-coffee-script'
" Cool tab completion stuff
Bundle 'ervandew/supertab'
set wildmenu
set wildmode=list:longest,full
" toggle comments with \\\
Bundle 'tpope/vim-commentary'
" toggle comments with <leader>c<space>
"Bundle 'scrooloose/nerdcommenter'
" Create empty line and stay in NORMAL mode
nnoremap <silent> zj o<Esc>
nnoremap <silent> zk O<Esc>
" Autoclose blocks
Bundle 'tpope/vim-endwise'
" =====
" FOLDING
" ====>
" Enable indent folding
set foldenable
set fdm=indent
" Turn off folding by default
set foldlevel=100
" Set space to toggle a fold
nnoremap <space> za
" =====
" DECORATION
" ====>
" Some nice themes
Bundle 'gmarik/ingretu'
Bundle 'wombat256.vim'
Bundle 'croaker/mustang-vim'
Bundle 'morhetz/gruvbox'
Bundle 'adlawson/vim-sorcerer'
Bundle 'vim-scripts/strange'
Bundle 'rcdilorenzo/vim-colors-pencil'
Bundle 'chriskempson/base16-vim'
" Turn on line numbering
set number
" Width reserved for line numbers
set numberwidth=1
" Relative numbering in NORMAL mode
" Absolute numbering in INSERT mode
Bundle 'myusuf3/numbers.vim'
nnoremap <F3> :NumbersToggle<CR>
" Highlight current line
set cursorline
" Font (download for compatility with airline)
" set guifont=Sauce\ Code\ Powerline:h13
set guifont=Fira\ Code:h13
" Theme
set background=dark
" Color Scheme
colorscheme gruvbox
" colorscheme wombat256mod
" colorscheme sorcerer
if has('gui_running')
set guifont=Sauce\ Code\ Powerline:h13
" colorscheme pencil
colorscheme base16-twilight
let s:light_red = { "gui": "#DC577E", "cterm": "1" }
endif
" Remove gui toolbar
if has('gui_running')
set guioptions-=T
end
" =====
" STATUSBAR
" ====>
" Turn on statusbar
set ruler
" Always show the statusline
set laststatus=2
" Allow ]-b and [-b to switch buffers
Bundle 'tpope/vim-unimpaired'
Bundle 'vim-airline/vim-airline'
Bundle 'vim-airline/vim-airline-themes'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_theme = 'tomorrow'
" Nice themes: hybrid, ubaryd, zenburn, tomorrow
" =====
" SAVING
" ====>
" Save with ctrl+s
map <c-s> <esc>:w<cr>
imap <c-s> <c-o><c-s>
imap <c-s> <esc><c-s>
" Make saving less annoying
map :W :w
" =====
" PROJECT MANAGEMENT
" ====>
Bundle 'ravinggenius/vim-open'
" Projects Directory
let g:project_dir = '~/workspaces/'
let g:open_dir_auto_open_nerdtree = 0
let g:open_dir_callback = 'NERDTree'
Bundle 'scrooloose/nerdtree'
set guioptions-=L
set autochdir
let NERDTreeIgnore = ['^_build', '\.lock$']
let NERDTreeChDirMode=2
map <F9> :NERDTreeToggle<CR>
map <leader>a :NERDTreeToggle<CR>
set noautochdir
" =====
" QUICK OPEN
" ====>
" http://kien.github.com/ctrlp.vim/
Bundle 'kien/ctrlp.vim'
"nmap <leader>o :CtrlP<CR>
let g:ctrlp_working_path_mode = 'ra'
" set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
" set wildignore+=*/.sass-cache/*,*/tmp/*,*/.tmp/*,*.so
" set wildignore+=*/vendor/*
let g:ctrlp_custom_ignore = 'node_modules\|bower_components\|coverage$'
Bundle 'ack.vim'
" =====
" MOTIONS
" ====>
" Move a line of text using ALT+[jk] (Comamnd+[jk] on mac)
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
" Move up and down by screen lines, not file lines
nnoremap j gj
nnoremap k gk
" Keep at least 3 lines above/below
set scrolloff=3
" Keep at least 2 lines left/right
set sidescrolloff=2
" =====
" GIT
" ====>
" Syntax highlighting for git-specific files and stuff
Bundle 'tpope/vim-git'
" Run git commands from vim
Bundle 'tpope/vim-fugitive'
" Git gutter/status
" Bundle 'airblade/vim-gitgutter'
" GitGutterSignsDisable
" Syntax highlighting for slim
" Bundle 'slim-template/vim-slim'
" =====
" INTEGRATION (ELIXIR)
" ====>
" au BufRead,BufNewFile *.ex set filetype=elixir
" au BufRead,BufNewFile *.exs set filetype=elixir
" =====
" INTEGRATION (MARKDOWN)
" ====>
Bundle 'plasticboy/vim-markdown'
" =====
" INTEGRATION (RUBY)
" ====>
" Bundle 'tpope/vim-rails.git'
" =====
" Detect file formats
" Keep at end - vundle wants this to be off when calling Bundle '...'
syntax on
filetype indent plugin on