Skip to content

Commit 3e6b8fb

Browse files
committed
Try to fix issue #17 (async command execution on Windows without DLL)
See issue 17 on GitHub: #17
1 parent 8076e72 commit 3e6b8fb

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

autoload/xolox/misc.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" The version of my miscellaneous scripts.
22
"
33
" Author: Peter Odding <[email protected]>
4-
" Last Change: April 28, 2015
4+
" Last Change: May 21, 2015
55
" URL: http://peterodding.com/code/vim/misc/
66

7-
let g:xolox#misc#version = '1.17.5'
7+
let g:xolox#misc#version = '1.17.6'

autoload/xolox/misc/os.vim

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Operating system interfaces.
22
"
33
" Author: Peter Odding <[email protected]>
4-
" Last Change: June , 2013
4+
" Last Change: May 21, 2015
55
" URL: http://peterodding.com/code/vim/misc/
66

77
function! xolox#misc#os#is_mac() " {{{1
@@ -158,7 +158,20 @@ function! xolox#misc#os#exec(options) " {{{1
158158
" Enable asynchronous mode (very platform specific).
159159
if async
160160
if is_win
161-
let cmd = printf('start /b %s', cmd)
161+
" As pointed out in issue 17 [1] the use of `:!start' on Windows
162+
" requires characters like `!', `%' and `#' to be escaped with a
163+
" backslash [2]. Vim's shellescape() function knows how to escape
164+
" these special characters however the use of `:!start' is an
165+
" implementation detail of xolox#misc#os#exec() so I don't want to
166+
" bother callers (who perform the shell escaping) with such a
167+
" specific implementation detail. This is why I resort to manually
168+
" escaping characters documented to have a special meaning [2].
169+
"
170+
" [1] https://github.com/xolox/vim-misc/issues/17
171+
" [2] All characters interpreted specially in shell command lines
172+
" executed from Vim's command mode, refer to `:help :!' for
173+
" details.
174+
let cmd = printf('start /b %s', escape(cmd, "\\\n!%#"))
162175
elseif has('unix')
163176
let cmd = printf('(%s) &', cmd)
164177
else

0 commit comments

Comments
 (0)