darkrc/vim/ftplugin/ruby.vim
DarkWiiPlayer 5363da8480 Add outfile name to vim rubocop call to improve performance
Why rubocop would perform terribly when the file name is "." is beyond
me, but giving it a proper name seems to improve performance by a lot.
2020-08-19 11:44:48 +02:00

19 lines
779 B
VimL

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"
comm! -buffer AsyncLint call AsyncLint(bufnr("%"), b:linter->subsitute("%", expand("%"), "g"))
let b:undo_ftplugin .= " | delcommand AsyncLint"
comm! -buffer Lint silent exec "%!".b:linter->substitute("$0", "\\\\$0", "g")->substitute("%", expand("%"), "g")
let b:undo_ftplugin .= " | delcommand Lint"
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 }'\""
let b:undo_ftplugin .= " | unlet b:linter"
au InsertLeave <buffer> AsyncLint
" au CursorHoldI <buffer> AsyncLint
augroup END