mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 18:06:30 +00:00
vim-patch:9.1.0568: Cannot expand paths from 'cdpath' setting
Problem: Cannot expand paths from 'cdpath' setting
(Daniel Hahler)
Solution: Implement 'cdpath' completion, add the new 'dir_in_path'
completion type (LemonBoy)
fixes vim/vim#374
closes: vim/vim#15205
a20bf69a3b
Co-authored-by: LemonBoy <thatlemon@gmail.com>
This commit is contained in:
@@ -105,6 +105,7 @@ static bool cmdline_fuzzy_completion_supported(const expand_T *const xp)
|
||||
&& xp->xp_context != EXPAND_COLORS
|
||||
&& xp->xp_context != EXPAND_COMPILER
|
||||
&& xp->xp_context != EXPAND_DIRECTORIES
|
||||
&& xp->xp_context != EXPAND_DIRS_IN_CDPATH
|
||||
&& xp->xp_context != EXPAND_FILES
|
||||
&& xp->xp_context != EXPAND_FILES_IN_PATH
|
||||
&& xp->xp_context != EXPAND_FILETYPE
|
||||
@@ -159,7 +160,8 @@ static void wildescape(expand_T *xp, const char *str, int numfiles, char **files
|
||||
|| xp->xp_context == EXPAND_FILES_IN_PATH
|
||||
|| xp->xp_context == EXPAND_SHELLCMD
|
||||
|| xp->xp_context == EXPAND_BUFFERS
|
||||
|| xp->xp_context == EXPAND_DIRECTORIES) {
|
||||
|| xp->xp_context == EXPAND_DIRECTORIES
|
||||
|| xp->xp_context == EXPAND_DIRS_IN_CDPATH) {
|
||||
// Insert a backslash into a file name before a space, \, %, #
|
||||
// and wildmatch characters, except '~'.
|
||||
for (int i = 0; i < numfiles; i++) {
|
||||
@@ -1228,7 +1230,8 @@ char *addstar(char *fname, size_t len, int context)
|
||||
if (context != EXPAND_FILES
|
||||
&& context != EXPAND_FILES_IN_PATH
|
||||
&& context != EXPAND_SHELLCMD
|
||||
&& context != EXPAND_DIRECTORIES) {
|
||||
&& context != EXPAND_DIRECTORIES
|
||||
&& context != EXPAND_DIRS_IN_CDPATH) {
|
||||
// Matching will be done internally (on something other than files).
|
||||
// So we convert the file-matching-type wildcards into our kind for
|
||||
// use with vim_regcomp(). First work out how long it will be:
|
||||
@@ -1842,7 +1845,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
|
||||
case CMD_tcd:
|
||||
case CMD_tchdir:
|
||||
if (xp->xp_context == EXPAND_FILES) {
|
||||
xp->xp_context = EXPAND_DIRECTORIES;
|
||||
xp->xp_context = EXPAND_DIRS_IN_CDPATH;
|
||||
}
|
||||
break;
|
||||
case CMD_help:
|
||||
@@ -2506,6 +2509,8 @@ static int expand_files_and_dirs(expand_T *xp, char *pat, char ***matches, int *
|
||||
flags |= EW_FILE;
|
||||
} else if (xp->xp_context == EXPAND_FILES_IN_PATH) {
|
||||
flags |= (EW_FILE | EW_PATH);
|
||||
} else if (xp->xp_context == EXPAND_DIRS_IN_CDPATH) {
|
||||
flags = (flags | EW_DIR | EW_CDPATH) & ~EW_FILE;
|
||||
} else {
|
||||
flags = (flags | EW_DIR) & ~EW_FILE;
|
||||
}
|
||||
@@ -2718,7 +2723,8 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
|
||||
|
||||
if (xp->xp_context == EXPAND_FILES
|
||||
|| xp->xp_context == EXPAND_DIRECTORIES
|
||||
|| xp->xp_context == EXPAND_FILES_IN_PATH) {
|
||||
|| xp->xp_context == EXPAND_FILES_IN_PATH
|
||||
|| xp->xp_context == EXPAND_DIRS_IN_CDPATH) {
|
||||
return expand_files_and_dirs(xp, pat, matches, numMatches, flags, options);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user