From b6b10ac17e549f404f47379fc4a6e7f535cbd6be Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 27 Jul 2014 03:07:37 +0900 Subject: [PATCH] Print progress of post-update hooks using `:!` (#38) --- plug.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plug.vim b/plug.vim index 25db16d..cddf43a 100644 --- a/plug.vim +++ b/plug.vim @@ -459,8 +459,17 @@ function! s:do(pull, todo) call append(3, '- Post-update hook for '. name .' ... ') let type = type(spec.do) if type == s:TYPE.string - call system(spec.do) - let result = v:shell_error ? ('Exit status: '.v:shell_error) : 'Done!' + try + " FIXME: Escaping is incomplete. We could use shellescape with eval, + " but it won't work on Windows. + let g:_plug_do = '!'.escape(spec.do, '#!%') + nnoremap (plug-do) :execute g:_plug_do + execute "normal \(plug-do)" + finally + let result = v:shell_error ? ('Exit status: '.v:shell_error) : 'Done!' + unlet g:_plug_do + unmap (plug-do) + endtry elseif type == s:TYPE.funcref try call spec.do()