diff options
author | Peter Odding <peter@peterodding.com> | 2011-11-21 21:31:02 +0100 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2011-11-21 21:31:02 +0100 |
commit | d7b3e0cb4d4343316d53346b1cf7b77b32ed58a9 (patch) | |
tree | 3b91081ca88124efd3b1e0a081d31b163761e5e5 /escape.vim | |
parent | 362ec9c9391decf5440b1a14e8a84a71168158cd (diff) | |
download | vim-easytags-d7b3e0cb4d4343316d53346b1cf7b77b32ed58a9.tar.gz |
Work around the existence of &shellslash
(see inline comment about misuse of features :-\)
Diffstat (limited to 'escape.vim')
-rw-r--r-- | escape.vim | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -1,6 +1,6 @@ " Vim auto-load script " Author: Peter Odding <peter@peterodding.com> -" Last Change: March 15, 2011 +" Last Change: November 21, 2011 " URL: http://peterodding.com/code/vim/misc/ " Convert a string into a :substitute pattern that matches the string literally. @@ -23,4 +23,24 @@ function! xolox#misc#escape#substitute(string) return '' endfunction +" Convert a string into a quoted command line argument. I was going to add a +" long rant here about &shellslash, but really, it won't make any difference. +" Let's just suffice to say that I have yet to encounter a single person out +" there who uses this option for its intended purpose (running a UNIX-style +" shell on Windows). + +function! xolox#misc#escape#shell(string) + if xolox#misc#os#is_win() + try + let ssl_save = &shellslash + set noshellslash + return shellescape(a:string) + finally + let &shellslash = ssl_save + endtry + else + return shellescape(a:string) + endif +endfunction + " vim: ts=2 sw=2 et |