-
Notifications
You must be signed in to change notification settings - Fork 89
/
.vimrc
799 lines (591 loc) · 20.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
"--------------------------------------------------
" NeoBundle Init
" Use 256 colors in vim
" some plugins not work without it
set t_Co=256
" Turn off filetype plugins before bundles init
filetype off
" Auto installing NeoNeoBundle
let isNpmInstalled = executable("npm")
" Default path for node-modules
let s:defaultNodeModules = '~/.vim/node_modules/.bin/'
let iCanHazNeoBundle=1
let neobundle_readme=expand($HOME.'/.vim/bundle/neobundle.vim/README.md')
if !filereadable(neobundle_readme)
if !isNpmInstalled
echo "==============================================="
echo "Your need to install npm to enable all features"
echo "==============================================="
endif
echo "Installing NeoBundle.."
silent !mkdir -p $HOME/.vim/bundle
silent !git clone https://github.com/Shougo/neobundle.vim $HOME/.vim/bundle/neobundle.vim
let iCanHazNeoBundle=0
endif
" Call NeoBundle
if has('vim_starting')
set runtimepath+=$HOME/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand($HOME.'/.vim/bundle/'))
" Determine make or gmake will be used for making additional deps for Bundles
let g:make = 'gmake'
if system('uname -o') =~ '^GNU/'
let g:make = 'make'
endif
"--------------------------------------------------
" Bundles
" Let NeoNeoBundle manage NeoNeoBundle
NeoBundle 'Shougo/neobundle.vim'
" Install vimrpoc. is uses by unite and neocomplcache
" for async searches and calls
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'mac' : 'make -f make_mac.mak',
\ 'unix': g:make
\ },
\ }
" Some support functions used by delimitmate, and snipmate
NeoBundle 'vim-scripts/tlib'
" Improve bookmarks in vim
" Allow word for bookmark marks, and nice quickfix window with bookmark list
" NeoBundle 'AndrewRadev/simple_bookmarks.vim'
" Plugin for fuzzy file search, most recent files list
" and much more
NeoBundle 'Shougo/unite.vim'
" Snippet engine
NeoBundle 'SirVer/ultisnips'
" Default snippets
NeoBundle 'honza/vim-snippets'
" Dirr diff
NeoBundle 'vim-scripts/DirDiff.vim'
" Colorscheme solarazied for vim
NeoBundle 'altercation/vim-colors-solarized'
" Allow autoclose paired characters like [,] or (,),
" and add smart cursor positioning inside it,
NeoBundle 'Raimondi/delimitMate'
" Add code static check on write
" need to be properly configured.
" I just enable it, with default config,
" many false positive but still useful
" NeoBundle 'scrooloose/syntastic'
NeoBundle 'w0rp/ale'
" Install jshint and stylelint for syntastic
" Path to jshint if it not installed, then use local installation
if isNpmInstalled
if !executable(expand(s:defaultNodeModules . 'jshint'))
silent ! echo 'Installing jshint' && npm --prefix ~/.vim/ install jshint
endif
if !executable(expand(s:defaultNodeModules . 'tslint'))
silent ! echo 'Installing tslint' && npm --prefix ~/.vim/ install tslint
endif
if !executable(expand(s:defaultNodeModules . 'stylelint'))
silent ! echo 'Installing stylelint' && npm --prefix ~/.vim/ install stylelint
endif
endif
" Great file system explorer, it appears when you open dir in vim
" Allow modification of dir, and may other things
" Must have
NeoBundle 'scrooloose/nerdtree'
" Add smart commands for comments like:
" gcc - Toggle comment for the current line
" gc - Toggle comments for selected region or number of strings
" Very useful
NeoBundle 'tomtom/tcomment_vim'
" Show code coverage in vim
NeoBundle 'L0stsoul/coverage.vim'
" Best git wrapper for vim
" But with my workflow, i really rarely use it
" just Gdiff and Gblame sometimes
NeoBundle 'tpope/vim-fugitive'
" Fix-up dot command behavior
" it's kind of service plugin
NeoBundle 'tpope/vim-repeat'
" Add usefull hotkey for operation with surroundings
" cs{what}{towhat} - inside '' or [] or something like this allow
" change surroundings symbols to another
" and ds{what} - remove them
NeoBundle 'tpope/vim-surround'
" Add aditional hotkeys
" Looks like i'm not using it at all
"NeoBundle 'tpope/vim-unimpaired'
" HTML5 + inline SVG omnicomplete funtion, indent and syntax for Vim.
NeoBundle 'othree/html5.vim'
" Improve javascript syntax higlighting, needed for good folding,
" and good-looking javascript code
NeoBundle 'jelera/vim-javascript-syntax'
" Improved json syntax highlighting
NeoBundle 'elzr/vim-json'
" Syntax highlighting for .jsx (js files for react js)
NeoBundle 'maxmellon/vim-jsx-pretty'
" Syntax highlighting for typescript
NeoBundle 'leafgarland/typescript-vim'
" Add Support css3 property
NeoBundle 'hail2u/vim-css3-syntax'
" Syntax highlighting for mustache & handlebars
NeoBundle 'mustache/vim-mustache-handlebars'
" Syntax highlighting for Stylus
NeoBundle 'wavded/vim-stylus'
" Add support for taltoad/vim-jadeumarkdown
NeoBundle 'gabrielelana/vim-markdown'
" Highlights the matching HTML tag when the cursor
" is positioned on a tag.
NeoBundle 'gregsexton/MatchTag'
" Automatically add closing tags in html-like formats
NeoBundle 'alvan/vim-closetag'
" Smart indent for javascript
" http://www.vim.org/scripts/script.php?script_id=3081
NeoBundle 'lukaszb/vim-web-indent'
" Plugin for changing cursor when entering in insert mode
" looks like it works fine with iTerm Konsole adn xerm
" Applies only on next vim launch after NeoBundleInstall
NeoBundle 'jszakmeister/vim-togglecursor'
" Nice statusline/ruler for vim
NeoBundle 'vim-airline/vim-airline'
NeoBundle 'vim-airline/vim-airline-themes'
" Code-completion for jquery, lodash e.t.c
NeoBundle 'othree/javascript-libraries-syntax.vim'
" Most recent files source for unite
NeoBundle 'Shougo/neomru.vim'
" Autocompletion engine
NeoBundle 'Valloric/YouCompleteMe', {
\ 'build' : {
\ 'unix' : './install.sh --js-completer && git submodule update --init --recursive',
\ 'windows' : './install.sh --js-completer && git submodule update --init --recursive',
\ 'cygwin' : './install.sh --js-completer && git submodule update --init --recursive'
\ }
\ }
" uses globally installed typescript for compeltion
if isNpmInstalled && !executable('tsc')
silent ! echo 'Installing typescript' && npm install -g typescript
endif
" Yank history for unite
NeoBundle 'Shougo/neoyank.vim'
" Plugin for chord mappings
NeoBundle 'kana/vim-arpeggio'
" JShint :)
" But not necessary with syntastics
" NeoBundle 'walm/jshint.vim'
call neobundle#end()
" Enable Indent in plugins
filetype plugin indent on
" Enable syntax highlighting
syntax on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
" Disable annoying prompt on initial bundle install
set nomore
" Fix issue when github refuse connections on initial install
let g:neobundle#install_max_processes=2
" Fix issue for long builds during initial install
let g:neobundle#install_process_timeout=180
" Install all bundles on first launch
if !iCanHazNeoBundle
NeoBundleInstall
endif
" Check new bundles on startup
NeoBundleCheck
"--------------------------------------------------
" Bundles settings
"-------------------------
" ultsnips
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
let g:UltiSnipsExpandTrigger="<nop>"
let g:ulti_expand_or_jump_res = 0
" Smart snippet expanding on CR
function! <SID>ExpandSnippetOrReturn()
let snippet = UltiSnips#ExpandSnippetOrJump()
if g:ulti_expand_or_jump_res > 0
return snippet
else
return "\<CR>"
endif
endfunction
inoremap <expr> <CR> pumvisible() ? "<C-R>=<SID>ExpandSnippetOrReturn()<CR>" : "\<CR>"
"-------------------------
" Unite
" Set unite window height
let g:unite_winheight = 10
" Start unite in insert mode by default
let g:unite_enable_start_insert = 1
" Display unite on the bottom (or bottom right) part of the screen
let g:unite_split_rule = 'botright'
" Set short limit for max most recent files count.
" It less unrelative recent files this way
let g:unite_source_file_mru_limit = 100
" Enable history for yanks
let g:unite_source_history_yank_enable = 1
" Make small limit for yank history,
let g:unite_source_history_yank_limit = 40
" Grep options Default for unite + supress error messages
let g:unite_source_grep_default_opts = '-iRHns'
let g:unite_source_rec_max_cache_files = 99999
" If ack exists use it instead of grep
if executable('ack-grep')
" Use ack-grep
let g:unite_source_grep_command = 'ack-grep'
" Set up ack options
let g:unite_source_grep_default_opts = '--no-heading --no-color -a -H'
let g:unite_source_grep_recursive_opt = ''
endif
" Hotkey for open window with most recent files
nnoremap <silent><leader>m :<C-u>Unite file_mru <CR>
" Hotkey for open history window
nnoremap <silent><leader>h :Unite -quick-match -max-multi-lines=2 -start-insert history/yank<CR>
" Quick tab navigation
nnoremap <silent><leader>' :Unite tab<CR>
"-------------------------
" coverage
"
let g:coverage_json_report_pathes = ['.coverage/coverage-final.json', 'coverage/coverage-final.json']
let g:coverage_sign_covered = '⦿'
let g:coverage_show_covered = 1
"-------------------------
" NERDTree
" Tell NERDTree to display hidden files on startup
let NERDTreeShowHidden=1
" Disable bookmarks label, and hint about '?'
let NERDTreeMinimalUI=1
" Display current file in the NERDTree ont the left
nmap <silent> <leader>f :NERDTreeFind<CR>
"-------------------------
" Ale
"
" Always open sign column, it's annoying if its jumping
let g:ale_sign_column_always = 1
let g:ale_sign_error = '😱'
let g:ale_sign_warning = '😨'
" Integrate Ale in airline
let g:airline#extensions#ale#enabled = 1
nmap <silent> [ <Plug>(ale_previous_wrap)
nmap <silent> ] <Plug>(ale_next_wrap)
"-------------------------
" Fugitive
" Blame on current line
nmap <silent> <leader>b :.Gblame<cr>
" Blame on all selected lines in visual mode
vmap <silent> <leader>b :Gblame<cr>
" Git status
nmap <silent> <leader>gst :Gstatus<cr>
" like git add
nmap <silent> <leader>gw :Gwrite<cr>
" git diff
nmap <silent> <leader>gd :Gdiff<cr>
" git commit
nmap <silent> <leader>gc :Gcommit<cr>
" git commit all
nmap <silent> <leader>gca :Gcommit -a<cr>
" git fixup previous commit
nmap <silent> <leader>gcf :Gcommit -a --amend<cr>
"-------------------------
" DelimitMate
" Delimitmate place cursor correctly n multiline objects e.g.
" if you press enter in {} cursor still be
" in the middle line instead of the last
let delimitMate_expand_cr = 1
" Delimitmate place cursor correctly in singleline pairs e.g.
" if x - cursor if you press space in {x} result will be { x } instead of { x}
let delimitMate_expand_space = 1
" Enable it for quotes
let delimitMate_smart_quotes = 1
"-------------------------
" vim-mustache-handlebars
" Enable shortcuts for things like {{{ an {{
let g:mustache_abbreviations = 1
"-------------------------
" vim-closetag
" Enable for files with this extensions
let g:closetag_filenames = "*.handlebars,*.html,*.xhtml,*.phtml,*.tsx,*jsx"
"-------------------------
" Solarized
" If You have problem with background, uncomment this line
" let g:solarized_termtrans=1
"-------------------------
" vim-airline
" Colorscheme for airline
let g:airline_theme='understated'
" Set custom left separator
let g:airline_left_sep = '▶'
" Set custom right separator
let g:airline_right_sep = '◀'
" Enable airline for tab-bar
let g:airline#extensions#tabline#enabled = 1
" Don't display buffers in tab-bar with single tab
let g:airline#extensions#tabline#show_buffers = 0
" Display only filename in tab
let g:airline#extensions#tabline#fnamemod = ':t'
" Don't display encoding
let g:airline_section_y = ''
" Don't display filetype
let g:airline_section_x = ''
"-------------------------
" YouCompleteMe
let g:ycm_semantic_triggers = {
\ 'css': [ 're!^\s{4}', 're!:\s+' ],
\ 'less': [ 're!^\s{4}', 're!:\s+' ]
\ }
" Choose completion with tab
let g:ycm_key_list_select_completion=["<tab>"]
let g:ycm_key_list_previous_completion=["<S-tab>"]
let g:ycm_filepath_blacklist = {
\ 'jsx': 1,
\ 'typescript': 1,
\ 'html': 1,
\ 'xml': 1
\}
" Since we use ale already
let g:ycm_show_diagnostics_ui = 0
" Go to type definition/declaration
nmap <silent> <leader>td :YcmCompleter GoTo<CR>
" Show all references to variable under coursor
nmap <silent> <leader>gr :YcmCompleter GoToReferences<CR>
" Show type of variable under cursor
nmap <silent> <leader>gt :YcmCompleter GetType<CR>
" Show docs for entity under cursor
nmap <silent> <leader>gd :YcmCompleter GetDoc<CR>
" Refactor smart rename, space at the end are important :)
nmap <leader>rr :YcmCompleter RefactorRename
"-------------------------
" Arpeggio
" Map jk to escape
call arpeggio#map('i', '', 0, 'jk', '<ESC>')
"--------------------------------------------------
" Colorscheme
" Use solarized colorscheme
colorscheme solarized
" Setting up light color scheme
set background=light
" Set highlighting for colorcolumn
highlight ColorColumn ctermbg=lightGrey
"--------------------------------------------------
" General options
" Enable per-directory .vimrc files and disable unsafe commands in them
"set exrc secure
" Set up leader key <leader>, i use default \
"let mapleader = ','
" Buffer will be hidden instead of closed when no one display it
"set hidden
" Auto reload changed files
set autoread
" Always change current directory to current-editing-file dir
"set autochdir
" Indicates fast terminal connection
set ttyfast
" Set character encoding to use in vim
set encoding=utf-8
" Let vim know what encoding we use in our terminal
set termencoding=utf-8
" Which EOl used. For us it's unix
" Not works with modifiable=no
if &modifiable
set fileformat=unix
endif
" Enable Tcl interface. Not sure what is exactly mean.
" set infercase
" Interprete all files like binary and disable many features.
" set binary
"--------------------------------------------------
" Display options
" Hide showmode
" Showmode is useless with airline
set noshowmode
" Show file name in window title
set title
" open preview window at bottom
set splitbelow
" Hide preview window for completion
set completeopt-=preview
" Mute error bell
set novisualbell
" Remove all useless messages like intro screen and use abbreviation like RO
" instead readonly and + instead modified
set shortmess=atI
" Enable display whitespace characters
set list
" Setting up how to display whitespace characters
set listchars=tab:⇥\ ,trail:·,extends:⋯,precedes:⋯,nbsp:~
" Wrap line only on characters in breakat list like ^I!@*-+;:,./?
" Useless with nowrap
" set linebreak
" Numbers of lines to scroll when the cursor get off the screen
" Useless with scrolloff
" set scrolljump=5
" Numbers of columns to scroll when the cursor get off the screen
" Useless with sidescrollof
" set sidescroll=4
" Numbers of rows to keep to the left and to the right off the screen
set scrolloff=10
" Numbers of columns to keep to the left and to the right off the screen
set sidescrolloff=10
" Vim will move to the previous/next line after reaching first/last char in
" the line with this command (you can add 'h' or 'l' here as well)
" <,> stand for arrows in command mode and [,] arrows in visual mode
set whichwrap=b,s,<,>,[,],
" Display command which you typing and other command related stuff
set showcmd
" Indicate that last window have a statusline too
set laststatus=2
" Add a line / column display in the bottom right-hand section of the screen.
" Not needed with airline plugin
"set ruler
" Setting up right-hand section(ruller) format
" Not needed with airline plugin
"set rulerformat=%30(%=\:%y%m%r%w\ %l,%c%V\ %P%)
" The cursor should stay where you leave it, instead of moving to the first non
" blank of the line
set nostartofline
" Disable wrapping long string
set nowrap
" Display Line numbers
set number
" Highlight line with cursor
set cursorline
" Maximum text length at 80 symbols, vim automatically breaks longer lines
" set textwidth=80
" Highlight column right after max textwidth
set colorcolumn=+1
"--------------------------------------------------
" Tab options
" Copy indent from previous line
set autoindent
" Enable smart indent. It add additional indents whe necessary
set smartindent
" Replace tabs with spaces
set expandtab
" When you hit tab at start of line, indent added according to shiftwidth value
set smarttab
" Number of spaces to use for each step of indent
set shiftwidth=2
" Number of spaces that a Tab in the file counts for
set tabstop=2
" Same but for editing operation (not sure what exactly does it means)
" but in most cases tabstop and softtabstop better be the same
set softtabstop=2
" Round indent to multiple of 'shiftwidth'.
" Indentation always be multiple of shiftwidth
" Applies to < and > command
set shiftround
"--------------------------------------------------
" Search options
" Add the g flag to search/replace by default
set gdefault
" Highlight search results
set hlsearch
" Ignore case in search patterns
set ignorecase
" Override the 'ignorecase' option if the search pattern contains upper case characters
set smartcase
" Live search. While typing a search command, show where the pattern
set incsearch
" Disable highlighting search result on Enter key
nnoremap <silent> <cr> :nohlsearch<cr><cr>
" Show matching brackets
set showmatch
"--------------------------------------------------
" Wildmenu
" Extended autocompletion for commands
set wildmenu
" Autocmpletion hotkey
set wildcharm=<TAB>
"--------------------------------------------------
" Folding
" Enable syntax folding in javascript
let javaScript_fold=1
" No fold closed at open file
set foldlevelstart=99
set nofoldenable
" Keymap to toggle folds with space
nmap <space> za
"--------------------------------------------------
" Edit
" Allow backspace to remove indents, newlines and old text
set backspace=indent,eol,start
" toggle paste mode on \p
set pastetoggle=<leader>p
" Add '-' as recognized word symbol. e.g dw delete all 'foo-bar' instead just 'foo'
set iskeyword+=-
" Disable backups file
set nobackup
" Disable vim common sequence for saving.
" By default vim write buffer to a new file, then delete original file
" then rename the new file.
set nowritebackup
" Disable swp files
set noswapfile
" Do not add eol at the end of file.
set noeol
" Spellcheck
set spell spelllang=en_us
"--------------------------------------------------
" Diff Options
" Display filler
set diffopt=filler
" Open diff in horizontal buffer
set diffopt+=horizontal
" Ignore changes in whitespaces characters
set diffopt+=iwhite
"--------------------------------------------------
" Hotkeys
" Open new tab
nmap <silent><leader>to :tabnew .<CR>
" Replace
nmap <leader>s :%s//<left>
vmap <leader>s :s//<left>
" Moving between splits
nmap <leader>w <C-w>w
nmap <S-Up> <C-w><Up>
nmap <S-Left> <C-w><Left>
nmap <S-Right> <C-w><Right>
nmap <S-Down> <C-w><Down>
" Resize splits
nmap <leader>w <C-w>w
nmap <C-S-Up> <C-w>+
nmap <C-S-Left> <C-w><
nmap <C-S-Right> <C-w>>
nmap <C-S-Down> <C-w>-
"--------------------------------------------------
" Autocmd
" It executes specific command when specific events occured
" like reading or writing file, or open or close buffer
if has("autocmd")
" Define group of commands,
" Commands defined in .vimrc don't bind twice if .vimrc will reload
augroup vimrc
" Delete any previously defined autocommands
au!
" Auto reload vim after your change it
au BufWritePost *.vim source $MYVIMRC | AirlineRefresh
au BufWritePost .vimrc source $MYVIMRC | AirlineRefresh
" Restore cursor position :help last-position-jump
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
" Set filetypes aliases
au FileType htmldjango set ft=html.htmldjango
au FileType scss set ft=scss.css
au FileType less set ft=less.css
au BufWinEnter * if line2byte(line("$") + 1) > 100000 | syntax clear | endif
au BufRead,BufNewFile *.js set ft=javascript.javascript-jquery
au BufRead,BufNewFile *.json set ft=json
" Execute python \ -mjson.tool for autoformatting *.json
au BufRead,BufNewFile *.bemhtml set ft=javascript
au BufRead,BufNewFile *.bemtree set ft=javascript
au BufRead,BufNewFile *.xjst set ft=javascript
au BufRead,BufNewFile *.tt2 set ft=tt2
au BufRead,BufNewFile *.plaintex set ft=plaintex.tex
" Auto close preview window, it uses with tags,
" I don't use it
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType typescript setlocal omnifunc=typescriptcomlete#CompleteTS
" Disable vertical line at max string length in NERDTree
autocmd FileType * setlocal colorcolumn=+1
autocmd FileType nerdtree setlocal colorcolumn=""
" Not enable Folding - it really slow on large files, uses plugin vim-javascript-syntax
" au FileType javascript* call JavaScriptFold()
" Group end
augroup END
endif