aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2018-11-30 22:43:08 -0500
committerJustin M. Keyes <justinkz@gmail.com>2018-12-01 04:43:08 +0100
commita9e368a7050c86dff36d80dc1cced21de14dd3ac (patch)
tree78889b8ab7b01a3b299128e755431f6bc0e10e27 /src/nvim/ex_cmds2.c
parent0ce880083d1faeebaecd393fc28e443b19862540 (diff)
downloadrneovim-a9e368a7050c86dff36d80dc1cced21de14dd3ac.tar.gz
rneovim-a9e368a7050c86dff36d80dc1cced21de14dd3ac.tar.bz2
rneovim-a9e368a7050c86dff36d80dc1cced21de14dd3ac.zip
vim-patch:8.1.0553: it is not easy to edit a script that was sourced (#9298)
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. https://github.com/vim/vim/commit/07dc18ffa4e7ed202f219fe2fd3d6f58246f71f9
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index a148f51527..76c71a00ec 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -3069,6 +3069,17 @@ theend:
/// ":scriptnames"
void ex_scriptnames(exarg_T *eap)
{
+ 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 (int i = 1; i <= script_items.ga_len && !got_int; i++) {
if (SCRIPT_ITEM(i).sn_name != NULL) {
home_replace(NULL, SCRIPT_ITEM(i).sn_name,