X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/html/htmlhint.vim diff --git a/.vim/bundle/ale/ale_linters/html/htmlhint.vim b/.vim/bundle/ale/ale_linters/html/htmlhint.vim new file mode 100644 index 00000000..25bf5137 --- /dev/null +++ b/.vim/bundle/ale/ale_linters/html/htmlhint.vim @@ -0,0 +1,32 @@ +" Author: KabbAmine , deathmaz <00maz1987@gmail.com>, diartyz +" Description: HTMLHint for checking html files + +call ale#Set('html_htmlhint_options', '') +call ale#Set('html_htmlhint_executable', 'htmlhint') +call ale#Set('html_htmlhint_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#html#htmlhint#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'html_htmlhint_options') + let l:config = l:options !~# '--config' + \ ? ale#path#FindNearestFile(a:buffer, '.htmlhintrc') + \ : '' + + if !empty(l:config) + let l:options .= ' --config ' . ale#Escape(l:config) + endif + + if !empty(l:options) + let l:options = substitute(l:options, '--format=unix', '', '') + endif + + return '%e' . ale#Pad(l:options) . ' --format=unix %t' +endfunction + +call ale#linter#Define('html', { +\ 'name': 'htmlhint', +\ 'executable': {b -> ale#path#FindExecutable(b, 'html_htmlhint', [ +\ 'node_modules/.bin/htmlhint', +\ ])}, +\ 'command': function('ale_linters#html#htmlhint#GetCommand'), +\ 'callback': 'ale#handlers#unix#HandleAsError', +\})