diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-11-30 22:48:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-11-30 22:48:32 +0100 |
commit | 07dc18ffa4e7ed202f219fe2fd3d6f58246f71f9 (patch) | |
tree | cff51538c1e68b208e06b278f4b675dbe00380a0 /src/ex_cmds2.c | |
parent | 01a060da74b756b161e595b39a7877cb7612120a (diff) |
patch 8.1.0553: it is not easy to edit a script that was sourcedv8.1.0553
Problem: It is not easy to edit a script that was sourced.
Solution: Add a count to ":scriptnames", so that ":script 40" edits the
script with script ID 40.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r-- | src/ex_cmds2.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index d6b6f5bf89..c3f26b64c5 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -4690,10 +4690,23 @@ theend: * ":scriptnames" */ void -ex_scriptnames(exarg_T *eap UNUSED) +ex_scriptnames(exarg_T *eap) { int i; + if (eap->addr_count > 0) + { + // :script {scriptId}: edit the script + if (eap->line2 < 1 || eap->line2 > script_items.ga_len) + EMSG(_(e_invarg)); + else + { + eap->arg = SCRIPT_ITEM(eap->line2).sn_name; + do_exedit(eap, NULL); + } + return; + } + for (i = 1; i <= script_items.ga_len && !got_int; ++i) if (SCRIPT_ITEM(i).sn_name != NULL) { |