2020-08-19 06:54:13 +00:00
|
|
|
augroup RUBY
|
|
|
|
if b:undo_ftplugin
|
|
|
|
let b:undo_ftplugin .= " | "
|
|
|
|
else
|
|
|
|
let b:undo_ftplugin = ""
|
|
|
|
end
|
|
|
|
let b:undo_ftplugin .= "augroup RUBY | au! | augroup END"
|
|
|
|
|
2020-08-19 12:13:48 +00:00
|
|
|
comm! -buffer AsyncLint call AsyncLint(bufnr("%"), b:linter->substitute("%", expand("%"), "g"))
|
2020-08-19 06:54:13 +00:00
|
|
|
let b:undo_ftplugin .= " | delcommand AsyncLint"
|
2020-08-19 09:44:48 +00:00
|
|
|
comm! -buffer Lint silent exec "%!".b:linter->substitute("$0", "\\\\$0", "g")->substitute("%", expand("%"), "g")
|
2020-08-19 06:54:13 +00:00
|
|
|
let b:undo_ftplugin .= " | delcommand Lint"
|
|
|
|
|
2020-08-19 09:44:48 +00:00
|
|
|
let b:linter = "sh -c \"rubocop --auto-correct -o /dev/null --stdin % 2>/dev/null | awk 'BEGIN { header=0 } // && header==1 { print $0 } /^====================$/ { header=1 }'\""
|
2020-08-19 06:54:13 +00:00
|
|
|
let b:undo_ftplugin .= " | unlet b:linter"
|
|
|
|
|
|
|
|
au InsertLeave <buffer> AsyncLint
|
|
|
|
" au CursorHoldI <buffer> AsyncLint
|
|
|
|
augroup END
|