diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-11-16 07:20:18 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-11-16 07:20:18 +0530 |
commit | 2b4bd35ba66756b4b3df3678a8dfc1ee47693d7f (patch) | |
tree | 8af573f98769cbba3c291ccafaf5e018b4815f38 /src | |
parent | f31fa09f5608d9fbe922a898adbb6091396bd572 (diff) | |
download | nnn-2b4bd35ba66756b4b3df3678a8dfc1ee47693d7f.tar.gz |
Simplify running commands
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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]) { |