summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-03-21 17:32:19 +0100
committerBram Moolenaar <Bram@vim.org>2015-03-21 17:32:19 +0100
commitb5971141dff0c69355fd64196fcc0d0d071d4c82 (patch)
treef2a062bcfa6558a9bd58d24c23924d403ec39170 /src/ex_getln.c
parent4df702999d14955255fcdfb820511767dcfec463 (diff)
updated for version 7.4.672v7.4.672
Problem: When completing a shell command, directories in the current directory are not listed. Solution: When "." is not in $PATH also look in the current directory for directories.
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index e18a8ede93..31e61d0945 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4885,6 +4885,7 @@ expand_shellcmd(filepat, num_file, file, flagsarg)
char_u *s, *e;
int flags = flagsarg;
int ret;
+ int did_curdir = FALSE;
if (buf == NULL)
return FAIL;
@@ -4896,7 +4897,7 @@ expand_shellcmd(filepat, num_file, file, flagsarg)
if (pat[i] == '\\' && pat[i + 1] == ' ')
STRMOVE(pat + i, pat + i + 1);
- flags |= EW_FILE | EW_EXEC;
+ flags |= EW_FILE | EW_EXEC | EW_SHELLCMD;
/* For an absolute name we don't use $PATH. */
if (mch_isFullName(pat))
@@ -4913,11 +4914,22 @@ expand_shellcmd(filepat, num_file, file, flagsarg)
/*
* Go over all directories in $PATH. Expand matches in that directory and
- * collect them in "ga".
+ * collect them in "ga". When "." is not in $PATH also expand for the
+ * current directory, to find "subdir/cmd".
*/
ga_init2(&ga, (int)sizeof(char *), 10);
- for (s = path; *s != NUL; s = e)
+ for (s = path; ; s = e)
{
+ if (*s == NUL)
+ {
+ if (did_curdir)
+ break;
+ /* Find directories in the current directory, path is empty. */
+ did_curdir = TRUE;
+ }
+ else if (*s == '.')
+ did_curdir = TRUE;
+
if (*s == ' ')
++s; /* Skip space used for absolute path name. */