diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-12 22:56:58 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-12 23:20:56 -0500 |
commit | a4ea6027880211b15b5659054e6e14d384517e27 (patch) | |
tree | c65c1e34c4ea4a51c9467797858e7fad6ac34e0f /src/nvim/ex_getln.c | |
parent | b650d2d8d90a371d73a25be2d46dd3c8c0d935ab (diff) | |
download | rneovim-a4ea6027880211b15b5659054e6e14d384517e27.tar.gz rneovim-a4ea6027880211b15b5659054e6e14d384517e27.tar.bz2 rneovim-a4ea6027880211b15b5659054e6e14d384517e27.zip |
vim-patch:8.2.2341: expresison command line completion incomplete after "g:"
Problem: Expresison command line completion shows variables but not
functions after "g:". (Gary Johnson)
Solution: Prefix "g:" when needed to a global function.
https://github.com/vim/vim/commit/1bb4de5302ba038b9c59e845b6d735e87d5681d0
Port most of patch v8.2.0335 to complete script-local functions
if the name starts with "s:".
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 5979f4d3a0..9977be56ca 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -5117,6 +5117,18 @@ ExpandFromContext ( if (xp->xp_context == EXPAND_PACKADD) { return ExpandPackAddDir(pat, num_file, file); } + + // When expanding a function name starting with s:, match the <SNR>nr_ + // prefix. + char_u *tofree = NULL; + if (xp->xp_context == EXPAND_USER_FUNC && STRNCMP(pat, "^s:", 3) == 0) { + const size_t len = STRLEN(pat) + 20; + + tofree = xmalloc(len); + snprintf((char *)tofree, len, "^<SNR>\\d\\+_%s", pat + 3); + pat = tofree; + } + if (xp->xp_context == EXPAND_LUA) { ILOG("PAT %s", pat); return nlua_expand_pat(xp, pat, num_file, file); @@ -5195,6 +5207,7 @@ ExpandFromContext ( } vim_regfree(regmatch.regprog); + xfree(tofree); return ret; } |