From 8541eec8fc12bd89320752e930fb348335bd9f57 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Fri, 31 Jan 2014 10:04:41 +0100 Subject: [PATCH] Remove unnecessary escaping. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While I can't say I fully understand escaping rules for Windows, I understand them better now than I did when I copied that code from another plugin and hoped for the best. As far as I can tell, this escaping code was written to be used when manually constructing a system command to execute – which isn't how this plugin is written. So this code shouldn't be here. --- autoload/diff.vim | 1 - autoload/utility.vim | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/autoload/diff.vim b/autoload/diff.vim index 5a1dce7..2989029 100644 --- a/autoload/diff.vim +++ b/autoload/diff.vim @@ -23,7 +23,6 @@ function! diff#run_diff(realtime, use_external_grep) endif let cmd .= ')' - let cmd = utility#escape(cmd) if a:realtime let diff = system(utility#command_in_directory_of_file(cmd), utility#buffer_contents()) diff --git a/autoload/utility.vim b/autoload/utility.vim index f9d68c9..e649288 100644 --- a/autoload/utility.vim +++ b/autoload/utility.vim @@ -57,18 +57,6 @@ function! utility#file_relative_to_repo_root() return substitute(s:file, repo_root_for_file, '', '') endfunction -" https://github.com/tpope/vim-dispatch/blob/bc415acd37187cbd6b417d92af40ba2c4b3b8775/autoload/dispatch/windows.vim#L8-L17 -function! utility#escape(str) - if &shellxquote ==# '"' - return '"' . substitute(a:str, '"', '""', 'g') . '"' - else - let esc = exists('+shellxescape') ? &shellxescape : '"&|<>()@^' - return &shellquote . - \ substitute(a:str, '['.esc.']', '^&', 'g') . - \ get({'(': ')', '"(': ')"'}, &shellquote, &shellquote) - endif -endfunction - function! utility#command_in_directory_of_file(cmd) let directory_of_file = shellescape(fnamemodify(utility#file(), ':h')) return 'cd ' . directory_of_file . ' && ' . a:cmd