From 3db2139195b4ed2378d12b2fdae63e92725aa782 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 Jan 2023 16:07:38 +0800 Subject: vim-patch:8.2.4617: no completion for :scriptnames Problem: No completion for :scriptnames. Solution: Implement :scriptnames completion. (Yegappan Lakshmanan, closes vim/vim#10005) https://github.com/vim/vim/commit/454ce6737cadb82886f1fc0eb9e8666cc59ae42b Co-authored-by: Yegappan Lakshmanan --- src/nvim/runtime.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/nvim/runtime.c') diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index ea975042ed..321023bce2 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -2160,12 +2160,17 @@ scriptitem_T *get_current_script_id(char **fnamep, sctx_T *ret_sctx) /// ":scriptnames" void ex_scriptnames(exarg_T *eap) { - if (eap->addr_count > 0) { + if (eap->addr_count > 0 || *eap->arg != NUL) { // :script {scriptId}: edit the script - if (eap->line2 < 1 || eap->line2 > script_items.ga_len) { + if (eap->addr_count > 0 && !SCRIPT_ID_VALID(eap->line2)) { emsg(_(e_invarg)); } else { - eap->arg = SCRIPT_ITEM(eap->line2).sn_name; + if (eap->addr_count > 0) { + eap->arg = SCRIPT_ITEM(eap->line2).sn_name; + } else { + expand_env(eap->arg, NameBuff, MAXPATHL); + eap->arg = NameBuff; + } do_exedit(eap, NULL); } return; -- cgit