-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path.vimrc
executable file
·1148 lines (939 loc) · 42.9 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
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
" vim:fdm=marker
" file: .vimrc
" author: ryanoasis (Ryan L McIntyre)
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" License {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" MIT
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Leader shortcuts {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ','
let g:mapleader = ','
" source: http://amix.dk/vim/vimrc.html
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Package management (Vundle) and plugins {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/Dropbox/vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'joonty/vdebug'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-abolish'
Plugin 'othree/javascript-libraries-syntax.vim'
Plugin 'maksimr/vim-jsbeautify'
Plugin 'beautify-web/js-beautify'
Plugin 'scrooloose/nerdcommenter'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'marijnh/tern_for_vim'
Plugin 'ramitos/jsctags'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'sjl/gundo.vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'Valloric/YouCompleteMe'
Plugin 'airblade/vim-gitgutter'
Plugin 'StanAngeloff/php.vim'
Plugin 'chrisbra/csv.vim'
Plugin 'tpope/vim-unimpaired'
Plugin 'gorodinskiy/vim-coloresque'
Plugin 'justinmk/vim-gtfo'
Plugin 'vim-scripts/text-object-left-and-right'
Plugin 'mattn/gist-vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'scrooloose/syntastic'
Plugin 'KabbAmine/vCoolor.vim'
Plugin 'heavenshell/vim-jsdoc'
Bundle 'ervandew/supertab'
" Track the engine.
Bundle 'SirVer/ultisnips'
Bundle 'terryma/vim-smooth-scroll'
Bundle 'itchyny/lightline.vim'
Plugin 'kshenoy/vim-signature'
Plugin 'Shougo/vimproc.vim'
Plugin 'Shougo/unite.vim'
Plugin 'Shougo/denite.nvim'
Plugin 'Shougo/vimfiler.vim'
Plugin 'mhinz/vim-startify'
Plugin 'ryanoasis/vim-devicons'
Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
Plugin 'shawncplus/phpcomplete.vim'
Plugin 'mxw/vim-jsx'
Plugin 'csscomb/vim-csscomb'
Plugin 'dracula/vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
filetype plugin on " for nerdcommenter
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General settings {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" set color term to 256 colors
" need to use with CSApprox script to work (huh?)
set t_Co=256
"syntax enable
syntax on
"set term=xterm-256color
set background=dark
"set t_Co=256
"set t_Co=16
colorscheme dracula
" working directory always where the active buffer is located
"set autochdir
augroup vimrc_set_working_dir
au!
autocmd BufEnter * silent! lcd %:p:h
augroup end
" source: http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file
" breaks load session?
set ruler
set hidden
" source: http://nvie.com/posts/how-i-boosted-my-vim/
" Sets the percent transparency
" causes error
" set transparency=10
" Turn on line numbers
set number
" Tabbing settings
" http://stackoverflow.com/questions/3682582/how-to-use-only-tab-not-space-in-vim
set autoindent
set noexpandtab
set tabstop=3
set shiftwidth=3
"set expandtab
"set tabstop=2
"set shiftwidth=2
"let g:indentLine_color_term = 239
"let g:indentLine_char = 'c'
" Visualize listchars (white space, tabs, etc)
"set listchars=tab:>-,trail:~,extends:>,precedes:<
" good tab indicator characters: ¦, ┆, ︙ or │
"set listchars=tab:\|\ ,trail:~,extends:>,precedes:<
set listchars=tab:\\ ,trail:~,extends:>,precedes:<
" http://stackoverflow.com/questions/1675688/make-vim-show-all-white-spaces-as-a-character
set list
" set visual thin vertical lines at each indentation level (no plugin needed!)
" keep the SPACE character at the end of the next line:
" set list lcs=tab:\|\
" setting above as the whole list so it doesnt overwrite the trailing etc.
" source: https://github.com/Yggdroot/indentLine
" redraw only when we need to.
set lazyredraw
" source: http://dougblack.io/words/a-good-vimrc.html
" set relative number makes doing selections
" and modifications MUCH easier (d 20 j, v 20 j, etc)
set relativenumber
" source: http://stevelosh.com/blog/2010/09/coming-home-to-vim/
" automatically switch to absolute line numbers whenever Vim loses focus
":au FocusLost * :set number
":au FocusGained * :set relativenumber
" the above dont seem to be working and also seem to break syntax
" highlighting?
" Tell Vim to automatically use absolute line numbers when we’re in insert mode
" and relative numbers when we’re in normal mode:
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set relativenumber
" source:
" http://jeffkreeftmeijer.com/2012/relative-line-numbers-in-vim-for-super-fast-movement/
" Move a line of text using ALT+[jk]
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
" source: http://amix.dk/vim/vimrc.html
" offset vertical for context: keep at least 3 lines above/below
set scrolloff=3
" source: http://stackoverflow.com/questions/164847/what-is-in-your-vimrc
" Highlight every other line
map <leader><Tab> :set hls<CR>/\n.*\n/<CR>
" source: http://stackoverflow.com/questions/164847/what-is-in-your-vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" JsDoc config {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:jsdoc_input_description = 1
let g:jsdoc_allow_input_prompt = 1
let g:jsdoc_return_description = 0
let g:jsdoc_additional_descriptions = 0
let g:jsdoc_access_descriptions = 2
let g:jsdoc_underscore_private = 1
let g:jsdoc_func_name_description_default = 0
if !exists('g:jsdoc_input_description')
let g:jsdoc_input_description = 0
endif
" Prompt user for function description
if !exists('g:jsdoc_additional_descriptions')
let g:jsdoc_additional_descriptions = 0
endif
" Prompt user for return type
if !exists('g:jsdoc_return')
let g:jsdoc_return = 1
endif
" Prompt user for return description
if !exists('g:jsdoc_return_description')
let g:jsdoc_return_description = 1
endif
" Allow prompt to input
if !exists('g:jsdoc_allow_input_prompt')
let g:jsdoc_allow_input_prompt = 0
endif
" override default mapping:
"nmap <silent> <C-l> <Plug>(jsdoc)
nmap <silent> <leader>d <Plug>(jsdoc)
"nmap ,d :<C-u>call AddJSDoc()<CR>
" use some synonyms
let g:jsdoc_tags = {}
let g:jsdoc_tags['returns'] = 'return'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" JavaScript Libraries Syntax config {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:used_javascript_libs = 'jquery,underscore,react,angularjs,requirejs'
let g:ycm_seed_identifiers_with_syntax = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Syntastic config {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:syntastic_style_error_symbol = '⚡'
let g:syntastic_error_symbol = '✗'
" '⚡' '😱' '✗' '➽'
" other cool characters:
" ⚑ ⚐ ♒ ⛢ ❕ ❗
let g:syntastic_warning_symbol = '⚠'
" This does what it says on the tin. It will check your file on open too, not just on save.
let g:syntastic_check_on_open=0
" using instead to run manually: SyntasticToggleMode
" source: https://github.com/scrooloose/syntastic/issues/689
" source: http://oli.me.uk/2013/06/29/equipping-vim-for-javascript/
" custom jshint rules
let g:syntastic_javascript_jshint_args = ' --config /home/ryan/dotfiles/.jshintrc'
let g:syntastic_javascript_jscs_args = ' --fix --config /home/ryan/dotfiles/.jscsrc --reporter text --force'
" for troubleshooting:
"let g:syntastic_debug=3
" Q. Syntastic supports several checkers for my filetype - how do I tell it
" which one(s) to use?
"let g:syntastic_javascript_checkers = ['jshint', 'jscs', 'jsxhint']
let g:syntastic_javascript_checkers = ['jsxcs', 'jsxhint']
" source: https://github.com/scrooloose/syntastic
" How can I display together the errors found by all checkers enabled for the
" current file?
let g:syntastic_aggregate_errors = 1
" Q. I run a checker and the location list is not updated...
let g:syntastic_always_populate_loc_list = 1
" You can also run checkers explicitly by calling :SyntasticCheck <checker>
" e.g. to run phpcs and phpmd:
" :SyntasticCheck phpcs phpmd
" :SyntasticCheck jscs
let g:syntastic_vim_checkers = ['vint']
let g:syntastic_text_checkers = ['proselint']
let g:syntastic_sh_checkers = ['shellcheck', 'sh']
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" YouCompleteMe (YCM) config {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" When this option is set to 1, YCM's identifier completer will also collect
" identifiers from strings and comments. Otherwise, the text in comments and
" strings will be ignored.
let g:ycm_collect_identifiers_from_comments_and_strings = 1
" source: https://github.com/Valloric/YouCompleteMe
" disable preview window on auto-complete:
set completeopt-=preview
let g:ycm_add_preview_to_completeopt = 0
" try to fix random freeze on autocomplete:
let g:ycm_register_as_syntastic_checker = 0
" source: https://github.com/Valloric/YouCompleteMe#i-get-a-weird-window-at-the-top-of-my-file-when-i-use-the-semantic-engine
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" YouCompleteMe (YCM), SuperTab, and UltiSnips config {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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 = "<S-tab>"
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
" from ultisnips help:
" Supertab - UltiSnips has built-in support for Supertab. Just use a recent
" enough version of both plugins and <tab> will either expand a snippet or defer
" to Supertab for expansion.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-airline {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" fixes statusline only appearing in split windows mode
set laststatus=2
" source: https://github.com/Lokaltog/vim-powerline
" dont need showmode indicator now because using awesome Powerline :D
set noshowmode
"let g:airline_powerline_fonts = 1
"let g:airline_theme = 'powerlineish'
let g:airline_theme = 'dracula'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#whitespace#enabled = 0
"let g:airline#extensions#tabline#fnamemod = 'abcd :p'
" define the set of text to display for each mode. >
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I ',
\ 'R' : 'R',
\ 'c' : 'C',
\ 'v' : 'ಠ',
\ 'V' : 'V-LINE',
\ '' : 'V-BLOCK',
\ 's' : 'S',
\ 'S' : 'S',
\ '' : 'S-BLOCK',
\ }
"let g:airline#extensions#tabline#formatter = 'unique_tail'
" Just show the filename (no path) in the tab
let g:airline#extensions#tabline#fnamemod = ':t'
" source: https://github.com/vim-airline/vim-airline/issues/372
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" lightline.vim {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:lightline = {
\ 'component_function': {
\ 'filetype': 'MyFiletype',
\ 'fileformat': 'MyFileformat',
\ }
\ }
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
endfunction
" disable loading:
let g:loaded_lightline = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-markdown (plasticboy) {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:vim_markdown_folding_disabled = 1
" source: https://github.com/plasticboy/vim-markdown/issues/162
let g:vim_markdown_initial_foldlevel = 1
" disable conceal in markdown
let g:vim_markdown_conceal = 0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CtrlP settings {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
" ctrlp extensions:
" CtrlP for filetype
"let g:ctrlp_extensions = ['filetype']
" silent! nnoremap <unique> <silent> <Leader>f :CtrlPFiletype<CR>
" source: https://github.com/endel/ctrlp-filetype.vim
" Faster searching if 'ag' present
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
" ag is fast enough that CtrlP doesn't need to cache
"let g:ctrlp_use_caching = 0 " are we sure???
endif
" source: http://dougblack.io/words/a-good-vimrc.html#ctrlp-section
" ctrlp (Ctrl + k) launch at project root:
"nnoremap <C-k> :CtrlP ~/www/some/path/<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ctrlspace {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has('gui_running')
" Settings for MacVim and Inconsolata font
let g:CtrlSpaceSymbols = { 'File': '◯', 'CTab': '▣', 'Tabs': '▢' }
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" gundo {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" toggle gundo
nnoremap <leader>u :GundoToggle<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CtrlP {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" by default <c-p> command open in MRU mode
let g:ctrlp_cmd = 'CtrlPMRU'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" tabular {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" custom mapping shortcuts
"if exists(':Tabularize')
nmap <Leader>t= :Tabularize /=<CR>
vmap <Leader>t= :Tabularize /=<CR>
"nmap <Leader>t| :Tabularize /|<CR>
"vmap <Leader>t| :Tabularize /|<CR>
nmap <Leader>t: :Tabularize /:<CR>
vmap <Leader>t: :Tabularize /:<CR>
"endif
" e.g. If you were in normal or visual mode, you could type ,t= to align
" equals signs
" source: http://vimcasts.org/episodes/aligning-text-with-tabular-vim/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" GitGutter {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:gitgutter_max_signs = 500
" attempt to make gitgutter update faster
"set updatetime=50
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-javascript {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set cole=0
" source: https://github.com/pangloss/vim-javascript/issues/101#issuecomment-45543789
" change to 1 to enable concealing
let g:javascript_conceal = 1
let g:javascript_conceal_function = 'ƒ'
let g:javascript_conceal_null = 'ø'
let g:javascript_conceal_this = '@'
let g:javascript_conceal_return = '⇚'
let g:javascript_conceal_undefined = '¿'
let g:javascript_conceal_NaN = 'ℕ'
let g:javascript_conceal_prototype = '¶'
" fix conceal color
highlight Conceal guifg=#ffb964
"highlight link Conceal SpellCap
"highlight link Conceal comment
" source: https://github.com/pangloss/vim-javascript/issues/151
" Enables HTML/CSS syntax highlighting in your JavaScript file.
let g:javascript_enable_domhtmlcss = 1
" source: https://github.com/pangloss/vim-javascript
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" color tweaks {{{1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"hi Comment guibg=#212121
"hi jsDocParam guibg=#212121
"hi jsDocTags guibg=#212121
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" colorizer {{{1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" attempt to improve vim performance:
"let g:colorizer_startup = 0
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" smooth-scroll {{{1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" temporarily disabling to see if it is causing performance issues with
" minimap:
"noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 10, 1)<CR>
"noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 10, 1)<CR>
"noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
"noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Annoyance fixes {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set visualbell " don't beep
set noerrorbells " don't beep
" Startup message is irritating
set shortmess+=I
" Accidentally hitting unwanted keys in normal mode:
nnoremap <F1> <nop>
" lets do the same for insert mode!!!
inoremap <F1> <nop>
" Allow more uses of backspace key:
" Can't backspace past start of operation:
set backspace=indent,eol,start
" source: http://blog.sanctum.geek.nz/vim-annoyances/
" source:
" http://stackoverflow.com/questions/5419848/backspace-doesnt-work-in-gvim-7-2-64-bit-for-windows
" Session tweaks:
" " fix annoying when you've changed your vimrc after you've saved the
" session
" set ssop-=options " do not store global and local values in a session
" set ssop-=folds " do not store folds
" " source:
" http://stackoverflow.com/questions/1642611/how-to-save-a-session-in-vim
" one less key to hit every time I want to save a file
nnoremap ; :
" source: http://stevelosh.com/blog/2010/09/coming-home-to-vim/
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has('autocmd')
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
" source: http://stackoverflow.com/questions/774560/in-vim-how-do-i-get-a-file-to-open-at-the-same-line-number-i-closed-it-at-last
" disable continuation of comments to the next line
autocmd BufNewFile,BufRead * setlocal formatoptions-=cro
" source:
" http://superuser.com/questions/271023/vim-can-i-disable-continuation-of-comments-to-the-next-line
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Editing behaviour {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ignorecase " needed for smartcase setting to work
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set hlsearch " highlight search terms
set incsearch " show search matches as you type
" makes it easy to clear out a search by typing ",<space>"
nnoremap <leader><space> :noh<cr>
" source: http://stevelosh.com/blog/2010/09/coming-home-to-vim/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding rules & setting {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set foldenable " enable folding
set foldcolumn=4 " add a fold column
set foldmethod=marker " detect triple-{ style fold markers
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 foldlevelstart=99
" source: http://stackoverflow.com/questions/2861627/vim-paste-in-insert-mode
" enable code folding add the following to your .vimrc.
" au FileType javascript call JavaScriptFold()
" Disabled for now, I don't like the way it highlights words in commented code!
" source: https://github.com/jelera/vim-javascript-syntax
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" filetype & encoding {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" set scriptencoding after 'encoding' and when using multibyte chars
scriptencoding utf-8
" source: http://rbtnn.hateblo.jp/entry/2014/12/28/010913
" source: http://stackoverflow.com/questions/5477565/how-to-setup-vim-properly-for-editing-in-utf-8
setglobal fileencoding=utf-8 " change default file encoding when writing new files
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Tab path completion like bash
set wildmenu
set wildmode=list:longest
" sources:
" http://nvie.com/posts/how-i-boosted-my-vim/
" http://amix.dk/vim/vimrc.html
" http://superuser.com/questions/40378/how-to-make-vims-auto-complete-behave-like-bashs-default-auto-complete
" change the working directory to something sensible
" cd / " seems to be set multiple times?
" however change it to match directory of buffer after that:
" autocmd BufEnter * lcd %:p:h
" use spaces for php (and even when tabbing insert 4 spaces [expandtab])
" autocmd FileType php setlocal shiftwidth=4 tabstop=4 expandtab
" until vim implements leading whitespace (particularly space) highlighting or a better way to do:
" define custom group:
"highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
highlight link ExtraWhitespace SpellCap
highlight ExtraWhitespace ctermfg=237 guifg=#444444 gui=undercurl cterm=undercurl guisp=#444444
" define autocmd for group:
"autocmd BufWinEnter * match ExtraWhitespace /^\s* \s*/
"autocmd BufWinEnter * match ExtraWhitespace / {2, }/
" do 2 or more leading spaces to avoid highlighting some comment doc
augroup vimrc_extra_whitespace_source_files
au!
autocmd FileType c,cpp,java,php,ruby,python,javascript,js,css autocmd BufWinEnter <buffer> match ExtraWhitespace /^[ ]\{2,}/
augroup end
nnoremap <Leader>ho :match ExtraWhitespace /^[ ]\{2,}/<CR>
nnoremap <Leader>hn :match<CR>
" sources:
" http://vim.wikia.com/wiki/Highlight_unwanted_spaces
" http://www.openlogic.com/wazi/bid/188101/Create-Your-Own-Syntax-Highlighting-in-Vim
" http://stackoverflow.com/questions/7342441/how-would-i-have-vim-highlight-redundant-white-space-and-all-tabs
" http://rayninfo.co.uk/vimtips.html
" File types to setup space indentation:
augroup vimrc_file_type_indentation
au!
autocmd FileType markdown setlocal shiftwidth=2 tabstop=2 expandtab
autocmd FileType python setlocal shiftwidth=2 tabstop=2 expandtab
autocmd FileType vim setlocal shiftwidth=2 tabstop=2 expandtab
autocmd FileType sh setlocal shiftwidth=2 tabstop=2 expandtab
augroup end
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NERDTree tabs {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:nerdtree_tabs_open_on_gui_startup = 0
let g:nerdtree_tabs_open_on_new_tab = 0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NERDTree tweaks {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" sets the working directory to the current file's directory:
"autocmd BufEnter * lcd %:p:h
" source: http://superuser.com/questions/195022/vim-how-to-synchronize-nerdtree-with-current-opened-tab-file-path
map <F1> :NERDTreeToggle %:p:h<CR>
" open Nerd Tree in folder of file in active buffer
map <Leader>nt :NERDTreeToggle %:p:h<CR>
" source: http://stackoverflow.com/questions/5800840/nerdtree-load-particular-directory-automatically
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
"call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
"call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
"call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
"call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
"call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
"call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
"call NERDTreeHighlightFile('jsx', 'Red', 'none', '#ffa500', '#151515')
"call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
"call NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#151515')
"call NERDTreeHighlightFile('gitconfig', 'Gray', 'none', '#686868', '#151515')
"call NERDTreeHighlightFile('gitignore', 'Gray', 'none', '#686868', '#151515')
"call NERDTreeHighlightFile('bashrc', 'Gray', 'none', '#686868', '#151515')
"call NERDTreeHighlightFile('bashprofile', 'Gray', 'none', '#686868', '#151515')
" source: https://github.com/scrooloose/nerdtree/issues/201#issuecomment-9954740
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Tagbar plugin tweaks {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <F8> :TagbarToggle<CR>
" this is only for exuberant-ctags:
"let g:tagbar_ctags_bin = 'jsctags'
let g:tagbar_ctags_bin = '/usr/bin/ctags'
" this is WORKING and calling jsctags! unfortunately jsctags not generating
" good enough for modern js or our current architecture :(
"let g:tagbar_type_javascript = {
" \ 'ctagsbin' : 'jsctags'
"\ }
"let g:tagbar_type_javascript = {
" \ 'ctagsbin': '/usr/bin/ctags',
" \ 'ctagstype' : 'JavaScript',
" \ 'kinds' : [
" \ 'o:object',
" \ 'v:variable',
" \ 'n:number',
" \ 'f:function',
" \ 'a:array',
" \ 's:string',
" \ 'b:boolean'
" \ ]
"\ }
"let g:tagbar_type_javascript = {
" \ 'ctagsbin' : 'jsctags',
" \ 'ctagstype' : 'JavaScript',
" \ 'ctagsargs' : '%'
"\ }
"let g:tagbar_type_javascript = {
" \ 'ctagsbin' : '/usr/bin/jsctags',
" \ 'ctagstype' : 'JavaScript',
" \ 'kinds' : [
" \ 'o:objects',
" \ 'f:functions',
" \ 'a:arrays',
" \ 's:strings'
" \ ]
"\ }
" does this work??
":help tags-option
"set tags=./tags,tags,/wamp/www/proto/tags,/wamp/www/proto/jsctags
"set tags=/wamp/www/proto/tags,/wamp/www/proto/jsctags
"set tags=/wamp/www/proto/jsctags
" trying jsdoc-tags:
let g:tagbar_type_javascript = {
\ 'ctagsbin': 'node',
\ 'ctagsargs': '/usr/local/lib/node_modules/jsdoc-tags/bin/jsdoc-tags -aq',
\ 'kinds': [
\ 'c:classes',
\ 'n:namespaces',
\ 'p:properties:0:1',
\ 'f:functions:0:1',
\ 'e:event',
\ ],
\ 'kind2scope': {
\ 'n' : 'namespace',
\ 'c' : 'class'
\ },
\ 'scope2kind': {
\ 'namespace': 'n',
\ 'class': 'c'
\ },
\ 'sro': '.',
\ 'replace': 1
\ }
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vdebug {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:command! Bp Breakpoint
" per: C:\Users\Ryan\vimfiles\doc\Vdebug.txt ; *VdebugTroubleshooting*
" <F5> resulting in error: E488: Trailing characters
"let g:vdebug_keymap['run'] = '<C-s>'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Custom mappings and command shortcuts {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Fast saving
nmap <leader>w :w!<cr>
" source: http://amix.dk/vim/vimrc.html
" ,t (disabled because of conflict with command t plugin)
" cmap ,t <Esc>:tabnew<CR>
" source: http://superuser.com/questions/376213/in-vi-how-do-i-map-t-equal-to-tabnew
" Map Ctrl+Shift+l to Insert current date and time
imap <C-S-l> <C-R>=strftime("%d/%m/%Y (%b %d) @ %H:%M")<CR>
nmap <C-S-l> "=strftime("%d/%m/%Y (%b %d) @ %H:%M")<CR>p
" command line mode (SWEEEET!)
cmap <C-S-l> <C-R>=strftime("%m-%d-%Y_")<CR>
" source: http://vim.wikia.com/wiki/Insert_current_date_or_time
" Map Ctrl+Backspace to Ctrl+W (for word deletion)
cmap <C-BS> <C-W>
" source: http://stackoverflow.com/questions/6039405/using-altbackspace-key-in-vim-command-line-to-delete-by-words
" Map Ctrl+Shift+x to checkmark insert
imap <C-S-x> ✓<CR>
" @todo WIP: make work in normal mode:
" nmap <C-S-x> "✓<CR>p
" pandoc /home/ryan/Acronym/meetings/11-19-2014_Weekly_strategy_meeting.md -t mediawiki -o /home/ryan/Acronym/meetings/11-19-2014_Weekly_strategy_meeting.wiki2
function! PandocFileToMediaWiki()
execute '!pandoc ' . buffer_name('%') . ' -t mediawiki -o ' . expand('%:r') . '.wiki'
endfunction
" convert markdown to mediawiki
:command! PandocMediaWiki :call PandocFileToMediaWiki()<CR>
" tabnew (:T)
:command! -nargs=* T tabnew <args>
" source: http://superuser.com/questions/376213/in-vi-how-do-i-map-t-equal-to-tabnew
" Convert slashes to backslashes for Windows.
if has('win32')
nmap ,ws :let @*=substitute(expand("%"), "/", "\\", "g")<CR>
nmap ,wl :let @*=substitute(expand("%:p"), "/", "\\", "g")<CR>
nmap ,fs :let @*=expand("%")<CR>
nmap ,fl :let @*=expand("%:p")<CR>
" " This will copy the path in 8.3 short format, for DOS and Windows 9x
" nmap ,c8 :let @*=substitute(expand("%:p:8"), "/", "\\", "g")<CR>
"endif
else
nmap ,fs :let @+=expand("%").':'.line(".")<CR>
nmap ,fl :let @+=expand("%:p").':'.line(".")<CR>
endif
" source: http://vim.wikia.com/wiki/Copy_filename_to_clipboard
" Allow saving of files as sudo when I forgot to start vim using sudo. (:w!!)
" was (:w , but when type 'w' there was a noticable lag, changed to 's', so
" now (:s!!)
" 15/10/2014 (Oct 15) @ 21:21 update: noticable delay even just typing 's',
" disabling for now:
"cmap ss!! w !sudo tee > /dev/null %
" lets try it again, w causes hanging on long file, lets use 'z'
cmap z!! w !sudo tee > /dev/null %
" source: http://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work
" Shortcut to rapidly toggle numbers
nmap <leader>n :set number!<CR>
" source: ME! based on setlist similar: http://vimcasts.org/episodes/show-invisibles/
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" source: http://vimcasts.org/episodes/show-invisibles/
" no highlight on Escape key press
"nnoremap <Esc> :noh<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CSS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map ctrl+f to run CSScomb
autocmd FileType css noremap <buffer> <c-f> :CSScomb<CR>
" Automatically comb your CSS on save
autocmd BufWritePre,FileWritePre *.css,*.less,*.scss,*.sass silent! :CSScomb
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" HTML
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:vnoremap <leader>x :!tidy -q -i --show-errors 0 --markup no --indent auto<CR>
:nnoremap <leader>x :!tidy -q -i --show-errors 0 --markup no --indent auto %<CR>
" source: http://vim.wikia.com/wiki/Cleanup_your_HTML
imap <C-Return> <CR><CR><C-o>k<C-t>
" source:
" http://stackoverflow.com/questions/4477031/vim-auto-indent-with-newline
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Custom Functions {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"function! FormatJSON() :%!python -m json.tool endfunction
com! FormatJSON %!python -m json.tool
" usage
" :FormatJSON
" source: https://coderwall.com/p/faceag
" remove trailing whitespace in vim automatically when saving!
fun! <SID>StripTrailingWhitespaces()
let l = line('.')
let c = col('.')
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd FileType c,cpp,java,php,ruby,python,javascript,js,css,md,mkd,html autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
" source: http://stackoverflow.com/questions/356126/how-can-you-automatically-remove-trailing-whitespace-in-vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" OS Differences {{{1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" set shell to something other than Windows Command Prompt
if has('win32')
set shellcmdflag=--login\ -c
set shellxquote=\"
set shell=/Development/Cygwin/bin/bash
endif
" source: http://vim.wikia.com/wiki/Use_cygwin_shell
" backup to ~/.tmp
"set backup
"set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
"set backupskip=/tmp/*,/private/tmp/*
"set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
"set writebackup
" OR (disable swap files):
set noswapfile
" source: http://stackoverflow.com/questions/821902/disabling-swap-files-creation-in-vim
set shellslash
" sources:
" http://nvie.com/posts/how-i-boosted-my-vim/
" http://amix.dk/vim/vimrc.html
" Set column right margin
" to help when to know to break code onto next lines
"set colorcolumn=100
" Vim 7.3 introduced colorcolumn
" source:
" http://stackoverflow.com/questions/2182427/right-margin-in-vim
"hi Search cterm=NONE ctermfg=grey ctermbg=blue
" http://stackoverflow.com/questions/7103173/vim-how-to-change-the-highlight-color-for-search-hits-and-quickfix-selection
" attempt to maximize gVim window (not exactly but better)
"set lines=999 columns=999
" source: http://superuser.com/questions/140419/how-to-start-gvim-maximized
" attempt Maximize window completely:
" au GUIEnter * simalt x " x on an English Windows version. n on a French one
" source: http://vim.wikia.com/wiki/Maximize_or_set_initial_window_size
" always show tab bar:
set showtabline=2
" source: http://vim.1045645.n5.nabble.com/Always-show-tab-bar-in-MacVim-td1215150.html
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" JSbeautify settings {{{1
" https://github.com/maksimr/vim-jsbeautify
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" see .editorconfig for configuration settings
" ctrl+f
map <c-f> :call JsBeautify()<cr>
autocmd FileType javascript vnoremap <buffer> <c-f> :call RangeJsBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify() <bar> execute 'normal gg=G'<cr>
autocmd FileType php noremap <buffer> <c-f> :call HtmlBeautify() <bar> execute 'normal gg=G'<cr>
autocmd FileType html vnoremap <buffer> <c-f> :call RangeHtmlBeautify() <bar> execute 'normal gg=G'<cr>
autocmd FileType php vnoremap <buffer> <c-f> :call RangeHtmlBeautify() <bar> execute 'normal gg=G'<cr>
" sources
" http://stackoverflow.com/questions/815548/how-do-i-tidy-up-an-html-files-indentation-in-vi
" https://github.com/maksimr/vim-jsbeautify