File tree Expand file tree Collapse file tree
vim/plugged/supplemental/plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ function ! s: RunCompiler (program) abort
2+ let old_compiler = get (b: , ' current_compiler' , ' ' )
3+ let old_makeprg = &l: makeprg
4+ let old_errorformat = &l: errorformat
5+
6+ try
7+ silent ! execute ' compiler' a: program
8+ silent ! execute ' make' ' %'
9+
10+ " if qf list has anything in it, open it
11+ if len (getqflist ()) > 0
12+ " only open if it's not already open
13+ if empty (filter (range (1 , winnr (' $' )), ' getwinvar(v:val, "&buftype") ==# "quickfix"' ))
14+ silent ! execute ' botright copen'
15+ endif
16+ else
17+ silent ! execute ' cclose'
18+ end
19+
20+ redraw !
21+ finally
22+ let b: current_compiler = old_compiler
23+ let &l: makeprg = old_makeprg
24+ let &l: errorformat = old_errorformat
25+ endtry
26+ endfunction
27+
28+ augroup eslint_buffers
29+ autocmd !
30+ autocmd BufRead ,BufNewFile *.vue,*.ts nnoremap <buffer> <leader> l :<C-u> call <SID> RunCompiler('eslint')<CR>
31+ augroup END
You can’t perform that action at this time.
0 commit comments