diff options
author | Peter Odding <peter@peterodding.com> | 2013-04-18 02:07:11 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2013-04-18 02:07:11 +0200 |
commit | b88ab45dae322f6780d8e0be0fdee2c7a68984ab (patch) | |
tree | 41bd2d6af0fb7aa911cb1c61f321a9dff2893ea7 /path.vim | |
parent | 9b4c7741d5e00d92406538f8e86e279d82c498e8 (diff) | |
download | vim-easytags-b88ab45dae322f6780d8e0be0fdee2c7a68984ab.tar.gz |
Bug fix: Encode ":" on Mac OS X in xolox#misc#path#encode()
Reported here: https://github.com/xolox/vim-notes/pull/28
Diffstat (limited to 'path.vim')
-rw-r--r-- | path.vim | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1,9 +1,10 @@ " Vim auto-load script " Author: Peter Odding <peter@peterodding.com> -" Last Change: September 26, 2011 +" Last Change: April 18, 2013 " URL: http://peterodding.com/code/vim/misc/ let s:windows_compatible = has('win32') || has('win64') +let s:mac_os_x_compatible = has('macunix') function! xolox#misc#path#which(...) let extensions = s:windows_compatible ? split($PATHEXT, ';') : [''] @@ -129,7 +130,13 @@ endfunction " Encode a pathname so it can be used as a filename. function! xolox#misc#path#encode(path) - let mask = s:windows_compatible ? '[*|\\/:"<>?%]' : '[\\/%]' + if s:windows_compatible + let mask = '[*|\\/:"<>?%]' + elseif s:mac_os_x_compatible + let mask = '[\\/%:]' + else + let mask = '[\\/%]' + endif return substitute(a:path, mask, '\=printf("%%%x", char2nr(submatch(0)))', 'g') endfunction |