Minor refactoring

This commit is contained in:
Junegunn Choi 2015-02-22 11:41:27 +09:00
parent 59748b0680
commit 5698a055c3

View File

@ -1591,7 +1591,7 @@ EOF
endfunction endfunction
function! s:shellesc(arg) function! s:shellesc(arg)
return '"'.substitute(a:arg, '"', '\\"', 'g').'"' return '"'.escape(a:arg, '"').'"'
endfunction endfunction
function! s:glob_dir(path) function! s:glob_dir(path)
@ -1618,7 +1618,7 @@ function! s:format_message(bullet, name, message)
endfunction endfunction
function! s:with_cd(cmd, dir) 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 endfunction
function! s:system(cmd, ...) function! s:system(cmd, ...)
@ -1904,7 +1904,7 @@ function! s:preview_commit()
execute 'pedit' sha execute 'pedit' sha
wincmd P wincmd P
setlocal filetype=git buftype=nofile nobuflisted 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 normal! gg"_dd
wincmd p wincmd p
endfunction endfunction