From 5363da8480869fe5c677b1f756c0fe945502b0f9 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 19 Aug 2020 11:44:48 +0200 Subject: [PATCH] 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. --- vim/ftplugin/ruby.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vim/ftplugin/ruby.vim b/vim/ftplugin/ruby.vim index 8af236d..51d5cdf 100644 --- a/vim/ftplugin/ruby.vim +++ b/vim/ftplugin/ruby.vim @@ -6,12 +6,12 @@ augroup RUBY end let b:undo_ftplugin .= "augroup RUBY | au! | augroup END" - comm! -buffer AsyncLint call AsyncLint(bufnr("%"), b:linter) + 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") + 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: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