-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvimrc
executable file
·933 lines (772 loc) · 28.1 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
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
" yeah.... use space as the leader
let mapleader = "\<Space>"
if has('vim_starting')
set nocompatible
let plug_vim=expand('~/.vim/autoload/plug.vim')
if !filereadable(plug_vim)
silent !mkdir -p ~/.vim/autoload
silent !curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/bb48508c3eb474ad2213f733104d1f33a7bbe5e5/plug.vim
autocmd VimEnter * PlugInstall| so ~/.vimrc
endif
endif
call plug#begin('~/.vim/bundle')
let g:plug_timeout=1200
let g:plug_window='tabnew'
" Required:
" call neobundle#rc(expand('~/.vim/bundle/'))
command! PlugTakeSnapshot PlugSnapshot ~/.vim_plug_snapshot.sh
command! PlugRestoreSnapshot !~/.vim_plug_snapshot.sh
" Fugitive - Git wrapper
Plug 'tpope/vim-fugitive'
nnoremap <Leader>ga :Git add . --all<CR>
nnoremap <Leader>gbl :Gblame<CR>
nnoremap <Leader>gbra :Git! branch -a<CR>
nnoremap <Leader>gbrl :Git! branch --list<CR>
nnoremap <Leader>gcb :Git checkout -b
nnoremap <Leader>gco :Git checkout
nnoremap <Leader>gcm :Git commit -m ""<left>
nnoremap <Leader>gca :Gcommit --amend --reuse-message=HEAD<CR>
nnoremap <Leader>gf :Git fetch<CR>
nnoremap <Leader>ge :Gedit<CR>
nnoremap <Leader>gg :wall<CR>:Gstatus<CR>
nnoremap <Leader>gt :tab split +Gstatus<CR>
nnoremap <Leader>gpp :Git push<CR>
nnoremap <Leader>gpa :Git push --all<CR>
nnoremap <Leader>gpf :Git push --force<CR>
nnoremap <Leader>grh :Git reset --hard<CR>
nnoremap <Leader>gsl :Git! stash list<CR>
nnoremap <Leader>gsp :Git stash pop<CR>
nnoremap <Leader>gss :Git stash<CR>
nnoremap <Leader>gu :Git pull<CR>
nnoremap <Leader>gd :Gvdiff<CR>
nnoremap <Leader>gre :Gread<CR>
au FileType gitcommit nmap <buffer> U :Git checkout -- <c-r><c-g><cr>
" usefull when merging, you can pull from left (2) or right (3)
nnoremap <Leader>g2 :diffget //2<CR>
nnoremap <Leader>g3 :diffget //3<CR>
" git searches, after you search, check the quicklist
" seach in the index
nnoremap <Leader>gri :Git --cached
" search in the commit diffs with the pixaxe option
nnoremap <Leader>grD :Glog -S --<Left><Left><Left>
" search in the commit diffs with the pixaxe option in the current file
nnoremap <Leader>grd :Gllog -S -- %<Left><Left><Left><Left><Left>
" load in quickfix all the log
nnoremap <Leader>gL :silent Glog --<CR>:redraw!<CR>:copen<CR>
" load in the location list the
nnoremap <Leader>glf :silent Gllog -- %<CR>:redraw!<CR>:lopen<CR>
" load in quickfix all the commits that contain the text message
nnoremap <Leader>glM :silent Glog --grep= --<left><left><left>
" load in the location list the commits that contain the text message for the
" current file
nnoremap <Leader>glm :silent Gllog --grep= -- %<left><left><left><left><left>
Plug 'kablamo/vim-git-log'
nnoremap <Leader>gll :GitLog<CR>
nnoremap <Leader>grr :Ribbon<CR>
nnoremap <Leader>gru :RibbonSave<CR>:Git pull<CR>
nnoremap <Leader>grs :RibbonSave<CR>
" Gitv - a git log vizualizer
" depends on tpope/vim-fugitive
Plug 'gregsexton/gitv'
nnoremap <Leader>gv :Gitv<CR>
Plug 'int3/vim-extradite'
nnoremap <Leader>gE :Extradite<CR>
if has('persistent_undo')
Plug 'sjl/gundo.vim'
if !isdirectory(expand("~/.vim/tmp/undo/"))
silent !mkdir -p ~/.vim/tmp/undo
endif
set undofile
set undodir=~/.vim/tmp/undo//
set noswapfile
set history=20
set undolevels=20
noremap <Leader>gn :GundoToggle<CR>
endif
Plug 'mbbill/undotree'
noremap <Leader>gN :UndotreeToggle<CR>
" Fast buffer, change, search navigation
Plug 'tpope/vim-unimpaired'
nnoremap ]g do]c:wall<CR>
nnoremap [g do[c:wall<CR>
nnoremap ]r dp]c:wall<CR>
nnoremap [r dp[c:wall<CR>
Plug 'tpope/vim-surround'
Plug 'tpope/vim-abolish'
nnoremap <Leader>\ff yiw:%S/<C-R>0/<C-R>0/gc<left><left><left><left>
nnoremap <Leader>\fw yiw:%S/<C-R>0/<C-R>0/gc<left><left><left>
nnoremap <Leader>\fW yiW:%S/<C-R>0/<C-R>0/gc<left><left><left>
nnoremap <Leader>\f0 :%S/<C-R>0/<C-R>0/gc<left><left><left><left>
nnoremap <Leader>\ yiw:%S/<C-R>0//gc<left><left><left><left>
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-endwise'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-rbenv'
Plug 'tpope/vim-haml'
" Fast navigation
Plug 'Lokaltog/vim-easymotion'
let g:EasyMotion_keys = 'hjklasdf'
let g:EasyMotion_grouping=1
map <Leader>w <Plug>(easymotion-w)
map <Leader>W <Plug>(easymotion-W)
map <Leader>b <Plug>(easymotion-b)
map <Leader>B <Plug>(easymotion-B)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
Plug 'mattn/emmet-vim'
" Working with tabular data
Plug 'godlygeek/tabular'
if exists(":Tabularize")
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
nmap <Leader>a^ :Tabularize /^\zs<CR>
vmap <Leader>a^ :Tabularize /^\zs<CR>
endif
Plug 'vim-scripts/tComment'
Plug 'vim-scripts/scons.vim'
" Plug 'brookhong/cscope.vim'
" Plug 'Rip-Rip/clang_complete', {'do': 'make install'}
" Plug 'justmao945/vim-clang'
" git submodule update --init --recursive
" Plug 'Valloric/YouCompleteMe', { 'do': 'git submodule update --init --recursive && ./install.sh --clang-completer' }
" let g:clang_complete_copen=1
" let g:clang_periodic_quickfix=1
" let g:clang_snippets=1
" let g:clang_close_preview=1
" let g:clang_use_library=1
" let g:clang_user_options='-std=c++11'
" let g:neocomplcache_enable_at_startup = 1
" let g:clang_library_path='/usr/lib/llvm-3.4/lib/'
" let g:clang_auto_select=1
" let g:clang_complete_auto=0
" let g:clang_complete_copen=1
" let g:clang_hl_errors=1
" let g:clang_periodic_quickfix=0
" let g:clang_snippets=1
" let g:clang_snippets_engine="clang_complete"
" let g:clang_conceal_snippets=1
" let g:clang_exec="clang"
" let g:clang_user_options=""
" let g:clang_auto_user_options="path, .clang_complete"
" let g:clang_use_library=1
" let g:clang_library_path="/usr/lib/"
" let g:clang_sort_algo="priority"
" let g:clang_complete_macros=1
" let g:clang_complete_patterns=0
" let g:clang_debug=1
"
Plug 'andreicristianpetcu/vim-modokay', { 'do': 'rm -rf ~/.vim/colors/modokay.vim && mkdir -p ~/.vim/colors && ln -s ~/.vim/bundle/vim-modokay/colors/modokay.vim ~/.vim/colors/modokay.vim' }
Plug 'altercation/vim-colors-solarized'
" snip mate and it's dependencyes
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
" Optional
Plug 'andreicristianpetcu/vim-snippets'
Plug 'andreicristianpetcu/argarg.vim'
" autocmd VimEnter * ArgArgLoadGitArgs
" added ctags support that works
Plug 'szw/vim-tags'
let g:vim_tags_auto_generate = 1
let g:vim_tags_use_vim_dispatch = 1
set tags=./.tags,.tags,./tags,tags
autocmd FileType javascript let g:vim_tags_project_tags_command = 'ctags --languages=js -f ./js.tags 2>/dev/null'
command! GlobalTagsClean !rm -rf ~/.tags
command! JSONFormat %!python -m json.tool
" tagbar, cool outline viewer
Plug 'majutsushi/tagbar'
let g:tagbar_autoclose='1'
nnoremap <Leader>o :TagbarToggle<CR>
let g:tagbar_type_javascript = {
\ 'ctagsbin' : '~/.local/bin/jsctags'
\ }
if executable('coffeetags')
let g:tagbar_type_coffee = {
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : '',
\ 'kinds' : [
\ 'f:functions',
\ 'o:object',
\ ],
\ 'sro' : ".",
\ 'kind2scope' : {
\ 'f' : 'object',
\ 'o' : 'object',
\ }
\ }
endif
let g:tagbar_type_puppet = {
\ 'ctagstype' : 'puppet',
\ 'kinds' : [
\ 'n:node',
\ 'c:class',
\ 's:site',
\ 'd:define'
\ ]
\ }
" let g:tagbar_type_angularjs = {
" \ 'ctagstype' : 'angularjs',
" \ 'kinds' : [
" \ 'c:controller',
" \ 'd:directive',
" \ 's:service',
" \ 'f:factory',
" \ 'm:module',
" \ 'r:route'
" \ ]
" \ }
Plug 'jaredly/vim-debug'
" crazy fast searching
Plug 'rking/ag.vim'
" Ag.vim script for easy search
function! SilverSearch(word)
let @s = expand(a:word)
let l:ag_cmd = "Ag -Q " . shellescape(@s) . " ."
call histadd("cmd", l:ag_cmd)
set hidden
execute l:ag_cmd
endfunction
" silver searcher
let g:agprg="ag -Q --column"
" Search with ag for the content of register s
noremap <Leader>/: :Ag -Q ""<Left>
noremap <Leader>/ yiw:call SilverSearch(expand(@0))<CR>
noremap <Leader>/W yiW:call SilverSearch(expand(@0))<CR>
noremap <Leader>/0 :call SilverSearch(expand(@0))<CR>
noremap <Leader>/a' ya':call SilverSearch(expand(@0))<CR>
noremap <Leader>/a" ya":call SilverSearch(expand(@0))<CR>
noremap <Leader>/' yi':call SilverSearch(expand(@0))<CR>
noremap <Leader>/" yi":call SilverSearch(expand(@0))<CR>
" greplace
Plug 'skwp/greplace.vim'
" set grepprg=ag
" let g:grep_cmd_opts = '--line-numbers --noheading'
set grepprg=ack
let g:grep_cmd_opts = '--noheading'
nnoremap <Leader>\rq :Gqfopen<CR>
nnoremap <Leader>\rg :Greplace<CR>
" map find replace
nnoremap <Leader>\: :%S///gc<left><left><left><left>
nnoremap <Leader>\\ yiw:%s/<C-R>0/<C-R>0/gc<left><left><left>
nnoremap <Leader>\W yiW:%s/<C-R>0/<C-R>0/gc<left><left><left>
nnoremap <Leader>\0 :%s/<C-R>0/<C-R>0/gc<left><left><left>
nnoremap <Leader>\s :%s///gc<left><left><left><left>
" Plug 'edkolev/tmuxline.vim'
" Airline, pretty ui plugin
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline#extensions#tabline#tab_min_count = 2
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
let conn=$CONN
if conn != 'sshd'
let g:airline_theme='ubaryd'
let g:airline_powerline_fonts = 1
endif
" fugitive integration
let g:airline#extensions#branch#enabled = 1
" disable syntastic integration
let g:airline#extensions#syntastic#enabled = 1
" enable tagbar integration
let g:airline#extensions#tagbar#enabled = 1
Plug 'edkolev/promptline.vim'
if v:version >= 703
Plug 'Shougo/vimfiler.vim'
let g:vimfiler_as_default_explorer = 1
let g:vimfiler_safe_mode_by_default = 0
" Disable netrw.vim
let g:loaded_netrwPlugin = 1
nnoremap <Leader>ff :VimFilerExplorer -find -winwidth=80<CR>
nnoremap <Leader>fd :VimFilerDouble -tab<CR>
" edit files with double ckick
autocmd FileType vimfiler
\ nmap <buffer> <2-LeftMouse> <Plug>(vimfiler_edit_file)
autocmd FileType vimfiler
\ nmap <buffer> <CR> <Plug>(vimfiler_edit_file)
let g:vimfiler_tree_leaf_icon = ' '
let g:vimfiler_tree_opened_icon = '▾'
let g:vimfiler_tree_closed_icon = '▸'
let g:vimfiler_file_icon = '-'
let g:vimfiler_marked_file_icon = '*'
Plug 'myusuf3/numbers.vim'
Plug 'Shougo/vimshell.vim'
" Unite - for searching stuff
Plug 'Shougo/unite.vim'
autocmd FileType unite call s:unite_my_settings()
function! s:unite_my_settings()
" Overwrite settings.
imap <silent><buffer><expr> <C-v> unite#do_action('vsplit')
imap <silent><buffer><expr> <C-h> unite#do_action('split')
imap <silent><buffer><expr> <C-t> unite#do_action('tabopen')
endfunction
noremap <leader>pf :Unite -start-insert file_rec<CR>
noremap <leader>pd :Unite -start-insert directory<CR>
noremap <leader>pw yiw:Unite -start-insert file_rec<CR><C-R>0
noremap <leader>p" yi":Unite -start-insert file_rec<CR><C-R>0
noremap <leader>p' yi':Unite -start-insert file_rec<CR><C-R>0
noremap <leader>p< yi<:Unite -start-insert file_rec<CR><C-R>0
noremap <leader>/T :Unite -start-insert tab<CR>
nnoremap <Leader>/m :Unite -start-insert mapping<CR>
nnoremap <Leader>/j :Unite -start-insert jump<CR>
nnoremap <Leader>/e :Unite -start-insert change<CR>
nnoremap <Leader>/r :UniteResume -start-insert<CR>
noremap <Leader>ss :Unite -start-insert line -auto-highlight<CR>
noremap <Leader>/ :Unite -start-insert line:args -auto-preview -winheight=40 -no-split<CR>
noremap <Leader>/b :Unite -start-insert line:buffers -auto-preview -winheight=40 -no-split<CR>
noremap <Leader>/lw yiw:Unite -start-insert line -auto-preview -winheight=40 -no-split<CR><C-R>0<ESC>
noremap <Leader>/lW yiW:Unite -start-insert line -auto-preview -winheight=40 -no-split<CR><C-R>0<ESC>
let g:unite_source_grep_max_candidates = 200
if executable('ag')
" Use ag in unite grep source.
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts =
\ '-i --line-numbers --nocolor --nogroup --hidden --ignore --literal' .
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
let g:unite_source_grep_recursive_opt = ''
endif
nnoremap <space>/2 :Unite grep:. -start-insert<cr>
" Angular.js stuff
noremap <leader>ac :Unite -start-insert file_rec<CR>!bower_components !node_modules app scripts controller .js<left><left><left><left>
noremap <leader>as :Unite -start-insert file_rec<CR>!bower_components !node_modules app scripts service .js<left><left><left><left>
noremap <leader>ad :Unite -start-insert file_rec<CR>!bower_components !node_modules app scripts directive .js<left><left><left><left>
noremap <leader>am :Unite -start-insert file_rec<CR>!bower_components !node_modules app !controller !service !directive .js<left><left><left><left>
noremap <leader>av :Unite -start-insert file_rec<CR>!bower_components !node_modules app views .html<left><left><left><left><left><left>
noremap <leader>aS :Unite -start-insert file_rec<CR>!bower_components !node_modules app styles .css<left><left><left><left><left>
noremap <leader>atc :Unite -start-insert file_rec<CR>!bower_components !node_modules test controller .js<left><left><left><left>
noremap <leader>ats :Unite -start-insert file_rec<CR>!bower_components !node_modules test service .js<left><left><left><left>
noremap <leader>atd :Unite -start-insert file_rec<CR>!bower_components !node_modules test directive .js<left><left><left><left>
noremap <leader>ab :Unite -start-insert file_rec<CR>bower_components
noremap <leader>an :Unite -start-insert file_rec<CR>node_modules
" most recent files
Plug 'Shougo/neomru.vim'
nnoremap <Leader>/R :Unite -start-insert file_mru<CR>
" Unite for help
Plug 'tsukkee/unite-help'
nnoremap <Leader>/h :Unite -start-insert help<CR>
" Unite for outline
Plug 'Shougo/unite-outline'
nnoremap <Leader>/o :Unite -start-insert outline -vertical<CR>
endif
Plug 'kien/ctrlp.vim'
let g:ctrlp_max_height='55'
let g:ctrlp_mruf_case_sensitive = 0
let g:ctrlp_regexp = 0
set wildignore+=*.avi,*.m3u,*.mp3,*.mp4,*.mpg,*.sfv,*.wmv,*.mov
set wildignore+=*.doc,*.numbers,*.pages,*.pdf,*.ppt,*.pptx,*.docx,*.xls,*.xlsx
set wildignore+=*.dmg,*.gz,*.rar,*.tbz,*.zip
set wildignore+=*/tmp/*,*.db,.DS_Store,*.log
set wildignore+=*.bmp,*.gif,*.jpeg,*.jpg,*.png,*.tif
set wildignore+=*.so,*.sw?
set wildignore+=*.pyc
set wildignore+=*.woff
set wildignore+=*.odt,*.odp,*.ods,*.eot,*.svg,*.tff
set wildignore+=*.pem,*.crt,*.key,*keystore,*truststore,*.p12
set wildignore+=*.war,*.jar,*.zip,*.tar,*.gz
nnoremap <Leader>/L :CtrlPLine<CR>
Plug 'junegunn/fzf'
command! FZFLines call fzf#run({
\ 'source': BuffersLines(),
\ 'sink': function('LineHandler'),
\ 'options': '--extended --nth=3..,',
\ 'tmux_height': '60%'
\})
function! LineHandler(l)
let keys = split(a:l, ':\t')
exec 'buf ' . keys[0]
exec keys[1]
normal! ^zz
endfunction
function! BuffersLines()
let res = []
for b in filter(range(1, bufnr('$')), 'buflisted(v:val)')
call extend(res, map(getbufline(b,0,"$"), 'b . ":\t" . (v:key + 1) . ":\t" . v:val '))
endfor
return res
endfunction
" Unite for command history
Plug 'thinca/vim-unite-history'
nnoremap <Leader>/c :Unite -buffer-name=commands -default-action=execute history/command command -start-insert<CR>
Plug 'andreicristianpetcu/vim-superman'
nnoremap <Leader>/M :Unite manpage -start-insert<CR>
" Unite for ctags
Plug 'tsukkee/unite-tag'
noremap <leader>t :Unite -start-insert tag<CR>
noremap <leader>tt :Unite -start-insert tag<CR>
noremap <leader>tw yiw:Unite -start-insert tag<CR><C-R>0
noremap <leader>t" yi":Unite -start-insert tag<CR><C-R>0
noremap <leader>t' yi':Unite -start-insert tag<CR><C-R>0
noremap <leader>t< yi<:Unite -start-insert tag<CR><C-R>0
autocmd BufEnter *
\ if empty(&buftype)
\| nnoremap <buffer> <C-]> yiw:Unite -start-insert tag<CR><C-R>0
\| nnoremap <buffer> <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
\| endif
let g:unite_source_tag_max_name_length=30
let g:unite_source_tag_max_fname_length=140
" unite rails
Plug 'basyura/unite-rails'
nnoremap <Leader>rm :Unite rails/model -start-insert<CR>
nnoremap <Leader>rM :Unite rails/mailer -start-insert<CR>
nnoremap <Leader>rc :Unite rails/controller -start-insert<CR>
nnoremap <Leader>rv :Unite rails/view -start-insert<CR>
nnoremap <Leader>rh :Unite rails/helper -start-insert<CR>
nnoremap <Leader>rl :Unite rails/lib -start-insert<CR>
nnoremap <Leader>rd :Unite rails/db -start-insert<CR>
nnoremap <Leader>rC :Unite rails/config -start-insert<CR>
nnoremap <Leader>rL :Unite rails/log -start-insert<CR>
nnoremap <Leader>rj :Unite rails/javascript -start-insert<CR>
nnoremap <Leader>rs :Unite rails/stylesheet -start-insert<CR>
nnoremap <Leader>rb :Unite rails/bundle -start-insert<CR>
nnoremap <Leader>rge :Unite rails/bundled_gem -start-insert<CR>
nnoremap <Leader>rro :Unite rails/route -start-insert<CR>
Plug 'rhysd/unite-ruby-require.vim'
nnoremap <Leader>re ggO<Esc>:Unite ruby/require -start-insert<CR>
Plug 'ujihisa/unite-rake'
nnoremap <Leader>ra :Unite rake -start-insert<CR>
Plug 'ujihisa/unite-colorscheme'
Plug 'tpope/vim-bundler'
nnoremap <Leader>rgo :Bopen<CR>
nnoremap <Leader>rgi :Bundle install<CR>
Plug 'tpope/vim-rake'
Plug 'tpope/gem-ctags'
Plug 'tpope/gem-browse'
" Rails plugin
Plug 'tpope/vim-rails'
" Edit routes
command! Rroutes :e config/routes.rb
command! Rschema :e db/schema.rb
Plug 'thoughtbot/vim-rspec'
Plug 'tpope/vim-cucumber'
Plug 'tpope/vim-dispatch'
Plug 'asux/vim-capybara'
Plug 'burnettk/vim-angular'
let g:angular_source_directory = 'uwezo-presentation/yo/app'
let g:angular_test_directory = 'uwezo-presentation/yo/app/test/spec'
"Autocomplete plugin
" Plug 'Shougo/neocomplcache.vim'
" if has('nvim')
" Plug 'Shougo/neocomplcache.vim'
" let g:neocomplcache_enable_at_startup = 1
" else
" if has('if_lua')
" Plug 'Shougo/neocomplete'
" let g:neocomplete#enable_at_startup = 1
" endif
" endif
"
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
"Plug 'Shougo/neosnippet'
"Plug 'Shougo/neosnippet-snippets'
"" Plugin key-mappings.
"imap <C-k> <Plug>(neosnippet_expand_or_jump)
"smap <C-k> <Plug>(neosnippet_expand_or_jump)
"xmap <C-k> <Plug>(neosnippet_expand_target)
"" SuperTab like snippets behavior.
"imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)"
"\: pumvisible() ? "\<C-n>" : "\<TAB>"
"smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)"
"\: "\<TAB>"
"" For snippet_complete marker.
"if has('conceal')
" set conceallevel=2 concealcursor=i
"endif
"" Tell Neosnippet about the other snippets
"let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets'
"let g:neosnippet#enable_snipmate_compatibilit = 1
"
"if &diff
" " diff mode
" set diffopt+=iwhite
"endif
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
nnoremap <Leader>fn :NERDTreeFind<CR>
Plug 'Shougo/neossh.vim'
Plug 'rodjek/vim-puppet'
au FileType puppet setlocal isk+=:
" ruby refactoring
Plug 'ecomba/vim-ruby-refactoring'
nnoremap <leader>rfap :RAddParameter<cr>
nnoremap <leader>rfcpc :RConvertPostConditional<cr>
nnoremap <leader>rfel :RExtractLet<cr>
vnoremap <leader>rfec :RExtractConstant<cr>
vnoremap <leader>rfelv :RExtractLocalVariable<cr>
nnoremap <leader>rfit :RInlineTemp<cr>
vnoremap <leader>rfrlv :RRenameLocalVariable<cr>
vnoremap <leader>rfriv :RRenameInstanceVariable<cr>
vnoremap <leader>rfem :RExtractMethod<cr>
" Syntastic - simple error checking
Plug 'scrooloose/syntastic'
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_javascript_jshint_args = '--config ~/.jshintrc.js'
let g:syntastic_mode_map = { 'mode': 'active',
\ 'passive_filetypes': ['java'] }
" GitGutter, easy diff
Plug 'airblade/vim-gitgutter'
nmap ]h <Plug>GitGutterNextHunk
nmap [h <Plug>GitGutterPrevHunk
nmap <Leader>ha <Plug>GitGutterStageHunk
nmap <Leader>hr <Plug>GitGutterRevertHunk
nmap <Leader>hh :GitGutterToggle<CR>
"copy paths in a easy way
Plug 'vim-scripts/copypath.vim'
let g:copypath_copy_to_unnamed_register = 1
" Plug 'vim-scripts/OmniCppComplete'
" nice nodejs plugin
Plug 'moll/vim-node'
"css colors
Plug 'ap/vim-css-color'
"closes quotes and other stuff
Plug 'Raimondi/delimitMate'
" Vim screen - GNU Screen/Tmux integration
Plug 'ervandew/screen'
noremap <Leader>SS V:ScreenSend<CR>
let g:ScreenImpl = 'Tmux'
" making friends with tmux
Plug 'benmills/vimux'
noremap <Leader>xx :call VimuxRunCommand(getline('.'))<CR>j
noremap <Leader>xp :call VimuxRunCommand(expand(@0))<CR>`>j
" easy marks
Plug 'kshenoy/vim-signature'
noremap <Leader>m :SignatureToggle<CR>
let g:SignatureMap = {
\ 'PurgeMarks' : "<Space>",
\ 'PurgeMarkers' : "<BS>",
\ 'GotoNextLineByPos' : "]'",
\ 'GotoPrevLineByPos' : "['",
\ 'GotoNextSpotByPos' : "]`",
\ 'GotoPrevSpotByPos' : "[`",
\ 'ListLocalMarks' : "'?",
\ }
" required by vim-text-object
runtime macros/matchit.vim
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-indent'
Plug 'kana/vim-textobj-line'
Plug 'kana/vim-textobj-entire'
nmap <Leader>= mavae='a
" Qdo and Qargs commands
Plug 'MarioRicalde/vim-qargs'
" vim expand region
Plug 'terryma/vim-expand-region'
" Extend the global default (NOTE: Remove comments in dictionary before sourcing)
"//todo//andrei//bring it back
" call expand_region#custom_text_objects({
" \ 'a]' :1,
" \ 'ab' :1,
" \ 'aB' :1,
" \ 'ii' :0,
" \ 'ai' :0,
" \ })
" generate docs for javascript
Plug 'heavenshell/vim-jsdoc'
" toggle lists
Plug 'milkypostman/vim-togglelist'
nmap <script> <silent> <leader>vl :call ToggleLocationList()<CR>
nmap <script> <silent> <leader>vq :call ToggleQuickfixList()<CR>
" docker file syntax
Plug 'honza/dockerfile.vim'
" sneak
Plug 'justinmk/vim-sneak'
Plug 'glts/vim-textobj-comment'
" support for coffeescript
Plug 'kchmck/vim-coffee-script'
Plug 'kana/vim-textobj-indent'
Plug 'junkblocker/patchreview-vim'
Plug 'codegram/vim-codereview'
Plug 'Valloric/MatchTagAlways'
Plug 'junegunn/goyo.vim'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-lua-inspect'
Plug 'xolox/vim-lua-ftplugin'
Plug 'editorconfig/editorconfig-vim'
Plug 'chase/vim-ansible-yaml'
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'andreicristianpetcu/vim-auto-save'
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:vim_tags_auto_generate = 1
let g:auto_save_postsave_hook = 'TagsGenerate'
Plug 'severin-lemaignan/vim-minimap'
Plug 'kana/vim-textobj-diff'
Plug 'wellle/targets.vim'
" In ~/.vim/ftplugin/mql.vim
let b:vimpipe_command="mongo"
let b:vimpipe_filetype="javascript"
" alternate for header files
Plug 'vim-scripts/a.vim'
" Plug 'vim-scripts/refactor'
" vim-scripts repos
Plug 'L9'
Plug 'chrisbra/NrrwRgn'
let g:nrrw_rgn_nohl = 1
" open man pages in vim
runtime ftplugin/man.vim
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
set hlsearch
endif
if $COLORTERM == 'gnome-terminal' || $TERM == 'xterm' || $TERM == 'screen'
set t_Co=256
endif
try
colorscheme modokay
" set cursorline
augroup CursorLineOnlyInActiveWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
" set cursorcolumn
catch /^Vim\%((\a\+)\)\=:E185/
colorscheme desert
endtry
" Switch wrap off for everything
" set nowrap
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Set File type to 'text' for files ending in .txt
autocmd BufNewFile,BufRead *.txt setfiletype text
" Enable soft-wrapping for text files
autocmd FileType text,markdown,html,xhtml,eruby setlocal wrap linebreak nolist
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
" autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
" Always display the status line
set laststatus=2
" reload .vimrc
command! Reloadvimrc :so $MYVIMRC
command! Editvimrc :e $MYVIMRC
nnoremap <Leader>vn :tabnew<CR>
nnoremap <Leader>vc :tabclose<CR>
nnoremap <Leader>vo :tabonly<CR>
nnoremap <Leader>ve :tabedit %<CR>
nnoremap <Leader>vh :split<CR>
nnoremap <Leader>vv :vsplit<CR>
nnoremap <Leader>vr :Reloadvimrc<CR>
nnoremap <Leader>vR :redraw!<CR>
nnoremap <Leader>v<CR> :<UP><CR>
nnoremap ]t :tabnext<CR>
nnoremap [t :tabprevious<CR>
" Inserts the path of the currently edited file into a command
" Command mode: Ctrl+P
cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
" Duplicate a selection
" Visual mode: D
vmap D y'>p
" Press Shift+P while in visual mode to replace the selection without
" overwriting the default register
vmap P p :call setreg('"', getreg('0')) <CR>
" For Haml
au! BufRead,BufNewFile *.haml setfiletype haml
" No Help, please
nmap <F1> <Esc>
" Press ^F from insert mode to insert the current file name
imap <C-F> <C-R>=expand("%")<CR>
imap <C-L> <Space>=><Space>
" Use Ack instead of Grep when available
if executable("ack")
set grepprg=ack\ -H\ --nogroup\ --nocolor\ --ignore-dir=tmp\ --ignore-dir=coverage
endif
" Numbers
set number
set numberwidth=5
" Tab completion options
" (only complete to the longest unambiguous match, and show a menu)
set completeopt=longest,menu
set wildmode=list:longest,list:full
set complete=.,t
" case only matters with mixed case expressions
set ignorecase
set smartcase
" Write file
nnoremap ZW :w!<CR>
nnoremap ZA :wall!<CR>
" Minimize and maximize
nnoremap <C-W>O :call MaximizeToggle()<CR>
nnoremap <C-W>o :call MaximizeToggle()<CR>
nnoremap <C-W><C-O> :call MaximizeToggle()<CR>
function! MaximizeToggle()
if exists("s:maximize_session")
exec "source " . s:maximize_session
call delete(s:maximize_session)
unlet s:maximize_session
let &hidden=s:maximize_hidden_save
unlet s:maximize_hidden_save
else
let s:maximize_hidden_save = &hidden
let s:maximize_session = tempname()
set hidden
exec "mksession! " . s:maximize_session
only
endif
endfunction
nnoremap <C-W>x :only<CR>
" You complete me disabled for tab, only for control space
" let g:ycm_auto_trigger = 0
let g:ycm_key_list_select_completion = ['<C-j>', '<C-Space>']
let g:ycm_key_list_previous_completion = ['<C-k']
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
" NeoBundleCheck
" set the system cliboard as the default yank source
set clipboard=unnamedplus
" Map F2 to toggle paste
nnoremap <F7> <C-c>:set paste<CR>i<C-R>+<ESC>:set nopaste<CR>
imap <C-C> <ESC>:set nopaste<CR>
imap fd <ESC>:set nopaste<CR>
imap <C-C><C-C> <ESC>:wq<CR>
autocmd InsertLeave * set nopaste
" Map command W to write with sudo
command! W write !sudo tee %
command! Q quitall!
" added easy jump to next and previous paragraps
noremap <Leader>} }}(
noremap <Leader>{ {{)
" Enable mouse use in all modes
set mouse=a
"be lazy
set lazyredraw
set exrc " enable per-directory .vimrc files
set secure " disable unsafe commands in local .vimrc files
call plug#end()