aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorKillTheMule <KillTheMule@users.noreply.github.com>2016-04-29 21:17:06 +0200
committerKillTheMule <KillTheMule@users.noreply.github.com>2016-05-02 21:09:43 +0200
commit00c35ab3b4d8498c82776525de7b1afcd7b3424a (patch)
treefce72ff6c7a1adf88952c57ddb6c78246fc41c2d /src/nvim/ex_getln.c
parentd542de4a76dd9e600ebcf1405efdc9d3090ad9a8 (diff)
downloadrneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.tar.gz
rneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.tar.bz2
rneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.zip
vim-patch:7.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. https://github.com/vim/vim/commit/b5971141dff0c69355fd64196fcc0d0d071d4c82 Most of it applied manually.
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 7d911ee93e..1a410759a3 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3983,6 +3983,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
char_u *s, *e;
int flags = flagsarg;
int ret;
+ bool did_curdir = false;
/* for ":set path=" and ":set tags=" halve backslashes for escaped
* space */
@@ -3991,7 +3992,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
if (pat[i] == '\\' && pat[i + 1] == ' ')
STRMOVE(pat + i, pat + i + 1);
- flags |= EW_FILE | EW_EXEC;
+ flags |= EW_FILE | EW_EXEC | EW_SHELLCMD;
bool mustfree = false; // Track memory allocation for *path.
/* For an absolute name we don't use $PATH. */
@@ -4011,10 +4012,23 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
/*
* 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 expaned for the
+ * current directory, to find "subdir/cmd".
*/
ga_init(&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. */