From 2464589156b1c75a883b6320328c3479a95dc6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 5 Feb 2017 23:15:55 +0100 Subject: vis: set $vis_file{name,path} environment variables for external commands --- vis.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 8a26415..0f596ee 100644 --- a/vis.c +++ b/vis.c @@ -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 -- cgit v1.2.3