-
Notifications
You must be signed in to change notification settings - Fork 6
/
.vimrc
684 lines (547 loc) · 28.3 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
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
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
" OS setup
let s:is_win = has('win32')
let $v = $HOME.(s:is_win ? '\vimfiles' : '/.vim')
if s:is_win
set shell=cmd.exe
set shellcmdflag=/c
set encoding=utf-8
endif
let s:bundle_dir = $v.'/bundle'
" initial setup
"==================================================================================
" use Vim settings, rather than Vi settings, required for Vundle
set nocompatible
filetype off
" initialize Vundle and rebuild helptags
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.fzf
call vundle#begin()
" Required
Plugin 'gmarik/Vundle.vim' " let Vundle manage Vundle, required
" Level 11 Vim skillz
" Plugin 'wikitopian/hardmode' " No arrow keys, +, _, or hjkl
" Level 9 Vim skills
" Plugin 'takac/vim-hardtime' " Can't use a key twice in X time
" Most important
Plugin 'scrooloose/nerdtree' " file menu
Plugin 'Xuyuanp/nerdtree-git-plugin' " Changes via git
Plugin 'ctrlpvim/ctrlp.vim' " fuzzy file finder
Plugin 'airblade/vim-gitgutter' " git diff in gutter
Plugin 'andrewRadev/switch.vim' " Swap true for false and MUCH more
Plugin 'bling/vim-airline' " nice looking footer bar
" Plugin 'mileszs/ack.vim' " searching via :Ack
Plugin 'rking/ag.vim' " Project search
Plugin 'junegunn/fzf.vim' " Fuzzy search https://github.com/junegunn/fzf#search-syntax
" Plugin 'm-kat/aws-vim' " AWS Cloudformation
" Plugin 'valloric/YouCompleteMe' " auto complete, son
" Real useful
Plugin 'wesQ3/vim-windowswap' " window swapping <leader>ww
Plugin 'dahu/vim-fanfingtastic' " Extend tT and fF to multiple lines
Plugin 'garbas/vim-snipmate' " expand code snippits with <tab>
Plugin 'tomtom/tlib_vim' " Used by snipmate
Plugin 'honza/vim-snippets' " Snippets to autocomplete from
Plugin 'ervandew/supertab' " The best autocompletion based on words in file
" Plugin 'kana/vim-textobj-user' " Allows ruby 'ir' 'ar' commands for method selection
Plugin 'marcWeber/vim-addon-mw-utils' " support tab completion snipmate functionality
" Plugin 'statox/GOD.vim' " Get vim doc link in markdown => :GOD mark
Plugin 'moll/vim-bbye' " Buffers are not so finicky when being closed
" Plugin 'mattn/emmet-vim' " Turns .grid>div*5>img into html structure <c-y><leader>
" Plugin 'idbrii/vim-mark' " Allow for multiple marks
" Plugin 'maxbrunsfeld/vim-yankstack' " Turns p and y into [stacks], nav with meta-p and meta-shift-p
" Syntax
Plugin 'nathanaelkane/vim-indent-guides' " Indent guides to keep your code aligned
Plugin 'tommcdo/vim-lion' " For more better indentation use gl and gL, gl to add space before, gL to add space after. glip= add space before = around paragraph
Plugin 'scrooloose/syntastic' " syntax checker
Plugin 'kchmck/vim-coffee-script' " Coffee support
Plugin 'mustache/vim-mustache-handlebars' " Mustache JS
Plugin 'captbaritone/better-indent-support-for-php-with-html' "Format PHP & HTML more better
Plugin 'MaxMEllon/vim-jsx-pretty'
Plugin 'prettier/vim-prettier', { 'do' : 'npm install' }
" Plugin 'jwalton512/vim-blade' " Support Blade syntax
" Plugin 'martinda/Jenkinsfile-vim-syntax' " Jenkins
" Plugin 'tfnico/vim-gradle' " gradle syntax highlighting
" Plugin 'guns/vim-sexp' " precision editing to S-expressions
" Nice to have
Plugin 'christoomey/vim-sort-motion' " Sort lines with gs, ie: gs20j => sort 20 lines, gsip => Sort the current paragraph, gsi( => Sort within parenthesis. (b, c, a) would become (a, b, c)
Plugin 'jtratner/vim-flavored-markdown' " Markdown display good
Plugin 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } }
" Plugin 'ashisha/image.vim' " Preview images with python, install with pip install Pillow
Plugin 'tommcdo/vim-exchange' " Exchange text with Visual and X
" Plugin 'tyru/open-browser-github.vim' " Open current file location on github
" Plugin 'tyru/open-browser.vim' " Open url from vim use: gx while on URL
Plugin 'wellle/targets.vim' " Additional usage for: Pair text objects, Quote text objects, Separator text objects, Argument text objects https://github.com/wellle/targets.vim/blob/master/cheatsheet.md
" Plugin 'severin-lemaignan/vim-minimap' " Minimap
" Color
Plugin 'jordwalke/flatlandia'
" Plugin 'ryanoasis/vim-devicons'
" Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' "Slows Vim WAY down
" Plugin 'KabbAmine/vCoolor.vim' " Color Picker, find with <leader>g
" Language specific
" Plugin 'nelstrom/vim-textobj-rubyblock' " Expands upon 'ir' 'ar' to be used in repatition
Plugin 'vim-ruby/vim-ruby' " ruby syntax & indent
Plugin 'othree/html5.vim' " html5 syntax & indent
Plugin 'pangloss/vim-javascript' " javascript syntax & indent
" Plugin 'Rykka/riv.vim' " RST text formtting
Plugin 'thoughtbot/vim-rspec' " Vim RSPEC runner
Plugin 'chriskempson/base16-vim' " base 16 colorscheme
" Plugin 'vim-scripts/nginx.vim' " Nginx files
Plugin '2072/PHP-Indenting-for-VIm' " PHP indentation
" Plugin 'elixir-lang/vim-elixir'
" Plugin 'hdima/python-syntax'
" Extras
" Plugin 'andrewRadev/sideways.vim' " Swap arguments with :SidewaysLeft and :SidewaysRight
" Plugin 'andrewRadev/splitjoin.vim' " Multiline to single and back gS, gJ TODO Change to new key binding
" Plugin 'andrewRadev/whitespaste.vim' " Only paste the space that is needved
" Plugin 'benmills/vimux' " Vim + Tmux Goodness
" Plugin 'christoomey/vim-conflicted' " Git conflict resolution
" Plugin 'christoomey/vim-tmux-navigator' " easy navigation b/w vim & tmux
" Plugin 'godlygeek/csapprox' " better gvim color support
" Plugin 'godlygeek/tabular' " for indentation
" Plugin 'groenewege/vim-less' " Less syntax highlighting / indentation
" Plugin 'heartsentwined/vim-emblem' " emblem syntax & indent
" Plugin 'johngrib/vim-game-code-break' " Pong for Vim, just run :VimGameCodeBreak
" https://github.com/jmoon018/PacVim " brew install pacvim
" Plugin 'justinmk/vim-sneak' " Sneaky movement s{char}{char}
" Plugin 'lifepillar/vim-cheat40' " 40 column cheat sheet, open with <leader>?
" Plugin 'mattn/emmet-vim' " emmet stuff for vim [http://emmet.io/]
" Plugin 'Rykka/InstantRst' " RST instant preview
" Plugin 'terryma/vim-multiple-cursors' " multiple cursors
" Odballs
Plugin 'uguu-org/vim-matrix-screensaver' " Type :Matrix
" The great tpope
Plugin 'tpope/vim-abolish' " Search replace with a touch of magic
Plugin 'tpope/vim-characterize' " Advanced Character info with ga
Plugin 'tpope/vim-commentary' " easily use comments => gcc
Plugin 'tpope/vim-endwise' " auto end addition in ruby
Plugin 'tpope/vim-fugitive' " Git in vim
Plugin 'tpope/vim-haml' " ERB now HAML code
Plugin 'tpope/vim-markdown' " markdown syntax & indent
Plugin 'tpope/vim-rsi' " Rails in Vim
" Plugin 'tpope/vim-rails' " Rails in Vim
Plugin 'tpope/vim-repeat' " Repeat plugin commands
Plugin 'tpope/vim-speeddating' " Use CTRL-A/CTRL-X to increment dates, times, and more
Plugin 'tpope/vim-surround' " Change Surrounding tags
Plugin 'tpope/vim-unimpaired' " Short normal mode aliases for commonly used ex commands ([<SPACE> will add space above)
" end Vundle init (required )"
call vundle#end()
filetype plugin indent on
"= Interface ======================================================================================
"- Appearance -----------------------------------------------------------------------------------
syntax on " turn on syntax highilghting
filetype plugin on " enable loading plugins for filetypes
filetype indent on " enable loading 'indent files' for filetypes
set ffs=unix,dos " File formats
set ff=unix " File format
set synmaxcol=256 " no syntax highlighting for lines longer than 256 cols
set titlestring =VIM:\ %f " Show filename as title of buffer
" backup settings
set backup
set backupext =-vimbackup
set backupdir =$v/files/backup " This folder must be created for backups
set directory =$v/files/swap// " Adding two // tells vim to use % stucture: %code%4flag%config%deploy.rb
" undo settings
set undofile
set undolevels =501 " Oops safety
set history =801 " History is important.
set undodir =$v/files/undo
set viewdir =$v/files/view
" Vim settings between close and open
set viminfo ='100,:100,@100,s10,\"100,h,n$v/files/info/viminfo
" https://stackoverflow.com/a/23036077/1418337
" https://stackoverflow.com/a/2833376/1418337
" https://vi.stackexchange.com/a/22035/8493
set laststatus=2 " show status bar
set autoread " If file is changed outside of vim reload it
set showcmd " Show (partial) command in status line.
set noerrorbells " No beeps, cause I don't need that to tell me I did something wrong
set vb t_vb= " Disable all bells. No ringing either
set visualbell " Use visual bell, that's ok feedback
set number " display line numbers
set relativenumber " display relative line numbers
set background=dark " Dark background
set laststatus=2 " Fix for statusbar toggling
set encoding=utf-8 " Fix special character encoding
scriptencoding utf-8
set t_Co=256 " MOAR COLORS
set cursorline cursorcolumn " set the crosshairs
set ruler " cursor position in the lower right corner
match ErrorMsg '\s\+$' " highlight trailing whitespace
au VimResized * :wincmd = " resize splits when window is resized
"- Interaction ----------------------------------------------------------------------------------
set ttyfast " improve screen refresh for terminal vim
set lazyredraw " don't redraw while executing macros. async window title update
set ttyscroll=3 " something about scrolling buffer size
set scrolloff=3 " start scrolling 3 lines from bottom
set sidescrolloff=6 " start scrolling 6 lines from right
let loaded_match_paren = 1 " highlight matching parens
set mouse=a " allow mouse usage
set clipboard=unnamed " set default yank register to machine clipboard
set updatetime=750 " How often vim writes to swap and 'cursorhold' event is fired
set timeoutlen=750 " Key maping timeout
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=0
" set foldnestmax=2
" set nofoldenable " disable folding
"url_for
" Notes: zM to fold all, zR to open all folds zO to open current fold
" completly
:au FocusLost * :set norelativenumber<cr>:set number<cr>
:au FocusGained * :set relativenumber
set modeline
set modelines=5
"- Wrapping -------------------------------------------------------------------------------------
set nowrap " don't softwrap text
set linebreak
set formatoptions-=t " don't automatically hardwrap text (use 'gq' to reflow text)
set wrapmargin=0 " don't wrap based on terminal size
"- Indentation ----------------------------------------------------------------------------------
set autoindent " indent next line to same level as current line
set smartindent " ↑ but do it smartly
set smarttab " <Tab> in front of a line inserts 'shiftwidth' blanks
set shiftwidth=2 " ↑ use 2 blanks for above
set shiftround " Round indent to multiple of shiftwidth
set tabstop=2 " display a <Tab> as 2 spaces
set softtabstop=2 " use 2 spaces for a <Tab>
set expandtab
" for html
if has("autocmd")
filetype indent plugin on
augroup bashalias
autocmd BufRead,BufNewFile *_aliases set filetype=sh
augroup END
endif
autocmd FileType html setlocal indentkeys-=*<Return>
autocmd FileType html.handlebars setlocal indentkeys-=*<Return>
autocmd FileType eruby setlocal indentkeys-=*<Return>
"- Searching ------------------------------------------------------------------------------------
set hlsearch " highlight searching after search complete
set ignorecase " case insensitive search
set smartcase " case insensitive search Unless using Capital Letters
set incsearch " incremental search
"- Movement
nnoremap 0 ^
vnoremap 0 ^
" nnoremap <tab> :<C-U>call <SNR>20_Match_wrapper('',1,'n') <CR>
" vnoremap <tab> :<C-U>call <SNR>20_Match_wrapper('',1,'v') <CR>m'gv``
" Write to the write protected files
" command W w !sudo tee % > /dev/null
" noremap <Leader>W :w !sudo tee % > /dev/null
"- Lazy command mode
" nnoremap ; :
"
" Unsudo my screen
nnoremap U :syntax sync fromstart<cr>:redraw!<cr>
nnoremap <silent>
\ <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
"- Theme ----------------------------------------------------------------------------------------
" More options: http://vimcolors.com/
" More colors: https://vignette.wikia.nocookie.net/vim/images/1/16/Xterm-color-table.png/revision/latest?cb=20110121055231
syntax enable
colorscheme flatlandia " flatlandia colorscheme
hi Comment guifg=#005969 guibg=NONE guisp=NONE gui=NONE ctermfg=105 ctermbg=NONE cterm=NONE
hi LineNr guifg=#515253 guibg=NONE guisp=NONE gui=NONE ctermfg=241 ctermbg=NONE cterm=NONE
hi Todo guifg=#798188 guibg=NONE guisp=NONE gui=bold ctermfg=15 ctermbg=2 cterm=bold
hi Normal guifg=NONE guibg=NONE guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi NonText guifg=NONE guibg=NONE guisp=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
" Color picker
let g:vcoolor_map = '<leader>g'
let g:vcoolor_lowercase = 1
"= Utilities ======================================================================================
set noswapfile " don't create swap files
set autowrite " write the old file out when switching between files
autocmd BufWritePre * :%s/\s\+$//e " auto strip whitespace on save
runtime macros/matchit.vim
runtime macros/
let g:auto_save = 1 " enable AutoSave on Vim startup
let g:auto_save_in_insert_mode = 0 " do not save while in insert mode
let g:auto_save_silent = 1 " do not display the auto-save notification
"= Keys ===========================================================================================
let mapleader = ',' " set <Leader>
set backspace=indent,eol,start " make backspace behave as expected
" easy splits and switches over (\v)
nnoremap <leader>v <C-w>v<C-w><C-w>
nnoremap <leader>h <C-w>s<C-w><C-w>
" map escape key to jj -- much faster, comments above b/c of Vim's interpretation of them jumping my cursor
imap jj <Esc>:w<cr>
"Dont Write
" imap jj <Esc>
" un/comment line and next line (Gemfile, fury => local)
nmap gC gcc<ESC>j<ESC>gcc
" Convert all " => ' or vise versa
nmap <leader>"' :%s/"/'/g
nmap <leader>'" :%s/'/"/g
imap <leader>end <% end %>
imap <leader>con console.log(": ")
" stupid save
" imap :w <Esc>xx:w<cr>
" use black hole register
noremap x "_x
" noremap X "_X
" Add the date
" imap <leader>xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
" Adjust splitscreen size
nmap <leader>b <C-w>11>
nmap <leader>B <C-w>11<
nmap <leader>d <C-w>11+
nmap <leader>D <C-w>11-
" Closes current buffer leaving splits as is
nnoremap <Leader>q :Bdelete<CR>
" Yank keeps spot on line
" vnoremap y myy`y
" vnoremap Y myY`y
" map escape key to ,N -- much faster
nmap <leader>N <Esc>:noh<cr>
"- Lazy macro repeat
nmap <leader>M @@
nmap <leader>. @@
" nnoremap <buffer> <leader>. :call MacroDo(input('Param: '))<CR>
" easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
" Crosshair mode
nnoremap <Leader>ch :set cursorline! cursorcolumn!<CR>
" kill the trailing whitespace
nnoremap <leader>rtw :%s/\s\+$//e<CR>
" toggle Paste mode
nnoremap <leader>p :set paste!<cr>
nnoremap <leader>np :set nopaste!<cr>
" Select the last pasted text
" nnoremap <expr> gb '`[' . strpart(getregtype(), 0, 1) . '`]'
" quick edit VIMRC
nmap <silent> <leader>ev :e $MYVIMRC<CR>
" quick reload VIMRC
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" Open file in github
nmap gtg <Plug>(openbrowser-smart-search)
vmap gtg <Plug>(openbrowser-smart-search)
" quick bundle
nmap <silent> <leader>pi :PluginInstall<CR>
" quick switch file
nnoremap <leader><leader> <c-^>
"
" quick replace word under cursor
noremap <leader>R :%s/<C-r>=expand('<cword>')<CR>/
" ruby tags
imap <C-b> binding.pry
nnoremap <leader>bp O<% binding.pry %><esc>
" Run Ag on current word
noremap <leader>A :Ag! -Q <C-r>=expand('<cword>')<CR><CR>
nnoremap <leader>H :help <C-r>=expand('<cword>')<CR><CR>
nnoremap <leader>G vy :GOD <c-r>"<CR>
" nnoremap :a<CR> :Ag! -Q <C-r>=expand('<cword>')<CR><CR>
" ,# Surround a word with #{ruby interpolation} NOT WORKING :(
" map <leader># ysiw#
" vmap <leader># c#{<C-R>"}<ESC>
"= Plugin Settings=================================================================================
" GOD
let g:god_close_help_buffer = 1
" HARD MODE
" autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode()
" nnoremap <leader>NH <Esc>:call ToggleHardMode()<CR>
" Hardtime
let g:hardtime_default_on = 1
let g:hardtime_maxcount = 6
let g:hardtime_showmsg = 1
let g:hardtime_ignore_buffer_patterns = [ "NERD.*", "*.txt", "*.json"] " Ignore NerdTree buffer, *.txt, and *.json files
let g:hardtime_ignore_quickfix = 1
let g:hardtime_timeout = 600
let g:hardtime_allow_different_key = 1
let g:list_of_normal_keys = ["<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
let g:list_of_visual_keys = ["<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
" if exists(":Tabularize")
" nmap <Leader>a= :Tabularize /=<CR>
" vmap <Leader>a= :Tabularize /=<CR>
" nmap <Leader>a: :Tabularize /:\zsl1<CR>
" vmap <Leader>a: :Tabularize /:\zsl1<CR>
" nmap <Leader>a, :Tabularize /,\zsl1<CR>
" vmap <Leader>a, :Tabularize /,\zsl1<CR>
" endif
" Python Settings
" let python_highlight_all = 1
"- Syntastic ------------------------------------------------------------------------------------
let g:syntastic_mode_map={ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['html'] } " disable checking for html
let g:syntastic_javascript_checkers = ['eslint']
"- Markdown ------------------------------------------------------------------------------------
let g:markdown_fenced_languages = ['css', 'erb=eruby', 'javascript', 'js=javascript', 'json=javascript', 'ruby', 'sass']
"- NerdTree ----------------------Use ? for info-------------------------------------------------
" toggle NerdTree (ControlK + ControlB)
nnoremap <C-k><C-b> :NERDTreeToggle<CR>
let NERDTreeShowHidden =1 " show hidden files
let NERDTreeQuitOnOpen =0 " Hide NERDTree when opening a file
let NERDTreeShowLineNumbers=1 " enable line numbers
let NERDTreeShowBookmarks =1 " Show bookmarks at top of nerd tree
let NERDTreeMarkBookmarks =1 " Mark folders with bookmarks
let NERDTreeWinSize =42
nmap <leader>O :NERDTreeFind<CR>
" make sure relative line numbers are used
autocmd FileType nerdtree setlocal relativenumber
" open on vim start and newtab open
" autocmd BufWinEnter * NERDTreeMirror
" autocmd VimEnter * NERDTree
" Go to previous (last accessed) window.
autocmd VimEnter * wincmd p
" close nerdtree if it is the only window left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"- YouCompleteMe-------------------------------------------------------------------------------------
" make" YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<c-b>"
let g:UltiSnipsJumpBackwardTrigger = "<c-z>"
let g:UltiSnipsEditSplit="vertical"
"= FZF =========================================================================
let g:fzf_buffers_jump = 1
" Open FZF
noremap <C-p> :Files<CR>
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~25%' }
let $FZF_DEFAULT_COMMAND= 'ag -U --ignore node_modules -g ""'
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
" ================ Completion =======================
set list
set listchars=tab:▸\
set wildmode=list:longest,full
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
"
" stuff to ignore when tab completing
set path+=**
set wildignore=*.o,*.obj,*~
set wildignore+=*vim/backups* " History files
set wildignore+=*sass-cache* " Sass
set wildignore+=*DS_Store* " IOS Image stores
set wildignore+=vendor/rails/**,vendor/cache/**
set wildignore+=*.gem
set wildignore+=tmp/cache/**
set wildignore+=node/**,frontend/**
set wildignore+=log/**,tmp/**
set wildignore+=*.png,*.jpg,*.gif
set wildignore+=*.min.css
set wildignore+=*.min.js
set wildignore+=node_modules/**
set wildignore+=**/node_modules/**
set wildignore+=*/tmp/*,*/bin/*,*/bower_components/*,*.so,*.swp,*.zip " MacOSX/Linux
" Filetypes -------------------------------------------------------------
" Handlebars {{{
augroup filetype_hbs
autocmd!
au BufRead,BufNewFile *.hbs,*.handlebars,*.hbs.erb,*.handlebars.erb setl ft=mustache syntax=mustache
augroup END
" }}}
" JavaScript {{{
augroup filetype_javascript
autocmd!
let g:javascript_conceal = 1
augroup END
" }}}
" JSON {{{
augroup filetype_json
autocmd!
au BufRead,BufNewFile *.json set ft=json syntax=javascript
augroup END
" }}}
" Markdown {{{
augroup filetype_markdown
autocmd!
let g:markdown_fenced_languages = ['ruby', 'html', 'javascript', 'css', 'erb=eruby.html', 'bash=sh']
augroup END
" }}}
" }}}
" XML {{{
augroup filetype_xml
autocmd!
au FileType xml exe ":silent 1,$!xmllint --format --recover - 2>/dev/null"
augroup END
" }}}
" Plugins
" ==============================================================================================
"
"- Ack ------------------------------------------------------------------------------------------
let g:ackprg = 'ag --nogroup --color --column'
"- Rspec.vim -----------------------------------------------------------------------------------
let g:rspec_command = '!bundle exec bin/rspec {spec}' " use spring w/ rspec runner
" let g:rspec_command = '!bundle exec rspec {spec}' " dont use spring w/ rspec runner
let g:rspec_runner = 'os_x_iterm'
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
" map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
"- XMPFilter ------------------------------------------------------------------------------------
" map <C-b> <Plug>(xmpfilter-mark)<Plug>(xmpfilter-run)
"- Switch ---------------------------------------------------------------------------------
let g:switch_mapping = "-"
"- Sidways---------------------------------------------------------------------------------
" map <Leader>S :SidewaysLeft<cr>
" map <Leader>R :SidewaysRight<cr>
"- Indent Guides ---------------------------------------------------------------------------------
let g:indent_guides_color_change_percent = 3 " ultra-low-contrast guides
let g:indent_guides_guide_size = 2 " between 0 and 'shiftwidth'
let g:indent_guides_start_level = 1 " don't show guides until the third indent
" Lion, glip= will reduce space to single char
let b:lion_squeeze_spaces = 1
"= File Icons =====================================================================================
" let g:WebDevIconsNerdTreeGitPluginForceVAlign on
" let g:WebDevIconsNerdTreeAfterGlyphPadding = ''
" " let g:webdevicons_enable_nerdtree = 1
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['rake'] = 'ƛ'
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['bash'] = ''
" " let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['DS_Store'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['ico'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['eot'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['svg'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['ttf'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['woff'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['otf'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['ico'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['yml'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['css'] = ''
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['gitignore'] = ''
" " to enter Unicode: (in insert mode) <ctrl-v>u(uncode)
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['md'] = 'M'
" let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['diff'] = ''
" To enter hex into [] use `ctrl-k` + u + four diget hex
" http://www.endmemo.com/unicode/unicodeconverter.php
" https://nerdfonts.com/#cheat-sheet
let g:NERDTreeHighlightFolders = 1 " enables folder icon highlighting using exact match
let g:NERDTreeHighlightFoldersFullName = 1 " highlights the folder name
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
let s:orange = "D4843E"
let g:NERDTreeExtensionHighlightColor = {} " this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['rake'] = s:orange " sets the color of css files to blue
" = Airline ----------------------------------------------------------------------------------------
" Airline.vim {{{
augroup airline_config
autocmd!
let g:airline_powerline_fonts = 1
let g:airline_enable_syntastic = 1
let g:airline#extensions#tabline#buffer_nr_format = '%s '
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamecollapse = 0
let g:airline#extensions#tabline#fnamemod = ':t'
augroup END
" }}}
"= Language Specific Settings======================================================================
"- MD
"Markdown-----------------------------------------------------------------------------------
autocmd BufNewFile,BufReadPost *.md set filetype=ghmarkdown
"- JavaScript
autocmd FileType javascript inoremap {<CR> {<CR>}<Esc><S-o>
autocmd FileType javascript inoremap (; ();<Esc>hi
"- SnipMate------------------------------------------------------------------------------------
let g:snipMate = { 'snippet_version' : 1 }
imap <tab> <Plug>snipMateNextOrTrigger
" inoremap <expr> pumvisible() ? "\<C-N>" : "\<C-R>=snipMate#TriggerSnippet()\<CR>"