From 2b4bd35ba66756b4b3df3678a8dfc1ee47693d7f Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 16 Nov 2019 07:20:18 +0530 Subject: Simplify running commands --- src/nnn.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nnn.c b/src/nnn.c index 42107d9..5d5fff4 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4970,8 +4970,14 @@ nochange: if (tmp[0] == '_' && tmp[1]) { xstrlcpy(newpath, ++tmp, PATH_MAX); - spawn(newpath, (ndents ? dents[cur].name : NULL), - NULL, path, F_CLI | F_CONFIRM); + if (is_suffix(newpath, " $NNN")) { + tmp = (ndents ? dents[cur].name : NULL); + /* Set `\0` to clear ' $NNN' suffix */ + newpath[strlen(newpath) - 5] = '\0'; + } else + tmp = NULL; + + spawn(newpath, tmp, NULL, path, F_CLI | F_CONFIRM); } else { if (!run_selected_plugin(&path, tmp, newpath, NULL, (ndents ? dents[cur].name : NULL), @@ -4981,6 +4987,9 @@ nochange: goto nochange; } } + + if (ndents) + copycurname(); } else { cfg.runplugin ^= 1; if (!cfg.runplugin && rundir[0]) { -- cgit v1.2.3-70-g09d2