From 2cad05a933ade05c8540f787f0bd7d5e76ae5db2 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Sun, 19 May 2013 23:44:55 +0200 Subject: Bug fix: Correct wrong expansion order in xolox#misc#path#which() --- autoload/xolox/misc/compat.vim | 2 +- autoload/xolox/misc/path.vim | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'autoload/xolox') diff --git a/autoload/xolox/misc/compat.vim b/autoload/xolox/misc/compat.vim index 56aff62..84f0a5f 100644 --- a/autoload/xolox/misc/compat.vim +++ b/autoload/xolox/misc/compat.vim @@ -7,7 +7,7 @@ " scripts breaks backwards compatibility. This enables my Vim plug-ins to fail " early when they detect an incompatible version, instead of breaking at the " worst possible moments :-). -let g:xolox#misc#compat#version = 5 +let g:xolox#misc#compat#version = 6 " Remember the directory where the miscellaneous scripts are loaded from " so the user knows which plug-in to update if incompatibilities arise. diff --git a/autoload/xolox/misc/path.vim b/autoload/xolox/misc/path.vim index 6ad8be4..60d3cbb 100644 --- a/autoload/xolox/misc/path.vim +++ b/autoload/xolox/misc/path.vim @@ -1,6 +1,6 @@ " Vim auto-load script " Author: Peter Odding -" Last Change: April 28, 2013 +" Last Change: May 19, 2013 " URL: http://peterodding.com/code/vim/misc/ let s:windows_compatible = has('win32') || has('win64') @@ -11,21 +11,18 @@ function! xolox#misc#path#which(...) " {{{1 let extensions = s:windows_compatible ? split($PATHEXT, ';') : [''] let matches = [] let checked = {} - for directory in split($PATH, s:windows_compatible ? ';' : ':') - let directory = xolox#misc#path#absolute(directory) - if !has_key(checked, directory) - if isdirectory(directory) - for program in a:000 - for extension in extensions - let path = xolox#misc#path#merge(directory, program . extension) - if executable(path) - call add(matches, path) - endif - endfor - endfor - endif - let checked[directory] = 1 - endif + for program in a:000 + for extension in extensions + for directory in split($PATH, s:windows_compatible ? ';' : ':') + let directory = xolox#misc#path#absolute(directory) + if isdirectory(directory) + let path = xolox#misc#path#merge(directory, program . extension) + if executable(path) + call add(matches, path) + endif + endif + endfor + endfor endfor return matches endfunction -- cgit v1.2.3