From 111a1c3dd7cb508ee7e9f8f23bf15f1c0c34d0f8 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 19 Aug 2020 08:54:13 +0200 Subject: [PATCH] Add vim ruby ft-plugin with async linting --- vim/ftplugin/ruby.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 vim/ftplugin/ruby.vim diff --git a/vim/ftplugin/ruby.vim b/vim/ftplugin/ruby.vim new file mode 100644 index 0000000..8af236d --- /dev/null +++ b/vim/ftplugin/ruby.vim @@ -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 AsyncLint +" au CursorHoldI AsyncLint +augroup END