1
0
forked from aniani/vim

updated for version 7.3.631

Problem:    Cannot complete user names.
Solution:   Add user name completion.  (Dominique Pelle)
This commit is contained in:
Bram Moolenaar
2012-08-15 14:05:05 +02:00
parent 2dac213ac6
commit 2430586629
11 changed files with 120 additions and 2 deletions

View File

@@ -3515,6 +3515,23 @@ set_one_cmd_context(xp, buff)
#endif
}
}
#if defined(FEAT_CMDL_COMPL)
/* Check for user names */
if (*xp->xp_pattern == '~')
{
for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p)
;
/* Complete ~user only if it partially matches a user name.
* A full match ~user<Tab> will be replaced by user's home
* directory i.e. something like ~user<Tab> -> /home/user/ */
if (*p == NUL && p > xp->xp_pattern + 1
&& match_user(xp->xp_pattern + 1) == 1)
{
xp->xp_context = EXPAND_USER;
++xp->xp_pattern;
}
}
#endif
}
/*
@@ -5396,6 +5413,7 @@ static struct
#endif
{EXPAND_TAGS, "tag"},
{EXPAND_TAGS_LISTFILES, "tag_listfiles"},
{EXPAND_USER, "user"},
{EXPAND_USER_VARS, "var"},
{0, NULL}
};