From 5698a055c3a8e48fd08c11643831ead41eaab6e3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 22 Feb 2015 11:41:27 +0900 Subject: [PATCH] Minor refactoring --- plug.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plug.vim b/plug.vim index 3840bed..52c3dc2 100644 --- a/plug.vim +++ b/plug.vim @@ -1591,7 +1591,7 @@ EOF endfunction function! s:shellesc(arg) - return '"'.substitute(a:arg, '"', '\\"', 'g').'"' + return '"'.escape(a:arg, '"').'"' endfunction function! s:glob_dir(path) @@ -1618,7 +1618,7 @@ function! s:format_message(bullet, name, message) endfunction function! s:with_cd(cmd, dir) - return printf('cd%s "%s" && %s', s:is_win ? ' /d' : '', escape(a:dir, '"'), a:cmd) + return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) endfunction function! s:system(cmd, ...) @@ -1904,7 +1904,7 @@ function! s:preview_commit() execute 'pedit' sha wincmd P setlocal filetype=git buftype=nofile nobuflisted - execute 'silent read !cd "'.escape(g:plugs[name].dir, '"').'" && git show' sha + execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show' sha normal! gg"_dd wincmd p endfunction