diff options
| -rw-r--r-- | man/vis.1 | 6 | ||||
| -rw-r--r-- | vis.c | 6 |
2 files changed, 12 insertions, 0 deletions
@@ -520,6 +520,12 @@ or if the shell command is omitted, the last shell command .Pq "of any type" is substituted. +Unless the file being edited is unnamed, all these external commands +can refer to its absolute path and file name through the +.Ic $vis_filepath +and +.Ic $vis_filename +environment variables. .Ss Loops and conditionals .Bl -tag -width indent .It Ic x/regexp/ Bq command @@ -1548,6 +1548,12 @@ int vis_pipe(Vis *vis, File *file, Filerange *range, const char *argv[], close(perr[1]); close(null); + if (file->name) { + char *name = strrchr(file->name, '/'); + setenv("vis_filepath", file->name, 1); + setenv("vis_filename", name ? name+1 : file->name, 1); + } + if (!argv[1]) execlp(vis->shell, vis->shell, "-c", argv[0], (char*)NULL); else |
