Add vim ruby ft-plugin with async linting
This commit is contained in:
parent
2ce229a2e6
commit
111a1c3dd7
1 changed files with 19 additions and 0 deletions
19
vim/ftplugin/ruby.vim
Normal file
19
vim/ftplugin/ruby.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
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)
|
||||||
|
let b:undo_ftplugin .= " | delcommand AsyncLint"
|
||||||
|
comm! -buffer Lint silent exec "%!".b:linter->substitute("$0", "\\\\$0", "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
|
Loading…
Reference in a new issue