I have been following the following two tutorials to try and set up eslint
and Neomake
:
So I have the following minimal init.vim
call plug#begin('~/.vim/plugged')
Plug 'neomake/neomake'
call plug#end()
autocmd! BufWritePost,BufEnter * Neomake
let g:neomake_verbose=3
let g:neomake_open_list = 2
let g:neomake_javascript_enabled_makers = ['eslint']
" neomake
nmap <Leader><Space>o :lopen<CR> " open location window
nmap <Leader><Space>c :lclose<CR> " close location window
nmap <Leader><Space>, :ll<CR> " go to current error/warning
nmap <Leader><Space>n :lnext<CR> " next error/warning
nmap <Leader><Space>p :lprev<CR> " previous error/warning
The problem is when I save Neomake
hangs with the following message:
Neomake: Starting: eslint -f compact /home/otis/Developer/test/index.js
If i run that command manually outside of nvim
like so:
eslint -f compact /home/otis/Developer/test/index.js
I receive the following output:
/home/otis/Developer/test/index.js: line 1, col 1, Error - Unexpected var, use let or const instead. (no-var)
/home/otis/Developer/test/index.js: line 1, col 5, Error - 'a' is defined but never used. (no-unused-vars)
/home/otis/Developer/test/index.js: line 1, col 9, Error - Strings must use singlequote. (quotes)
3 problems
Which is good it means eslint
is working but I am getting nothing back from Neomake
.
If I run :lopen
the window pops up and then instantly closes like below:
My vim
/nvim
knowledge is somewhat basic so please be explicit in responses.
autocmd! BufWritePost,BufEnter * Neomake
toaugroup neomake/ au!/ autocmd BufWritePost * Neomake/ augroup END
BufEnter don't have many sense:lopen
Neomake runs for that buffer due to autocmd for BufEnter. @Yonsy snippet is good, but should be additionally limited to JavaScript files only:augroup neomake/ au!/ autocmd BufWritePost *.js Neomake/ augroup END