From 7e0ad67680ca03ba7910eec6facadec5462f8a12 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Mon, 26 May 2014 22:39:37 -0700 Subject: [PATCH] fix executing python api interface command in windows --- plugin/wakatime.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/wakatime.vim b/plugin/wakatime.vim index 7e6a0cc..ff028cc 100644 --- a/plugin/wakatime.vim +++ b/plugin/wakatime.vim @@ -73,14 +73,22 @@ let s:VERSION = '2.0.1' let targetFile = a:last[2] endif if targetFile != '' - let cmd = ['python', '-W', 'ignore', s:plugin_directory . 'packages/wakatime/wakatime-cli.py'] + let python_bin = 'python' + if has('win32') + let python_bin = 'pythonw' + endif + let cmd = [python_bin, '-W', 'ignore', s:plugin_directory . 'packages/wakatime/wakatime-cli.py'] let cmd = cmd + ['--file', shellescape(targetFile)] let cmd = cmd + ['--plugin', printf('vim-wakatime/%s', s:VERSION)] if a:is_write let cmd = cmd + ['--write'] endif "let cmd = cmd + ['--verbose'] - exec 'silent !' . join(cmd, ' ') . ' &' + if has('win32') + exec 'silent !start /min cmd /c "' . join(cmd, ' ') . '"' + else + exec 'silent !' . join(cmd, ' ') . ' &' + endif call s:SetLastAction(a:time, a:time, targetFile) endif endfunction