From d1ed0cff118a07327b3b237ea65836f5c673acbb Mon Sep 17 00:00:00 2001 From: Martin Kühl Date: Fri, 20 Nov 2015 16:42:33 +0100 Subject: Support commands specified by environment variables Specifying commands by name in config.h means that every time one switches ones editor (for example), one has to modify every config.h file referencing that editor and then recompile every corresponding program. This change adds a string `env` for specifying an environment variable to `struct key` and uses it to optionally specify the command to run on SEL_{RUN,RUNARG}. The `run` string is used as a fallback when the environment variable has not been specified or is not set. It also updates `config.def.h` to demonstrate this new capability. --- config.def.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index 39c1799..beae17d 100644 --- a/config.def.h +++ b/config.def.h @@ -62,8 +62,9 @@ struct key bindings[] = { { 't', SEL_MTIME }, { CONTROL('L'), SEL_REDRAW }, /* Run command */ - { '!', SEL_RUN, "sh" }, - { 'z', SEL_RUN, "top" }, + { 'z', SEL_RUN, "top" }, + { '!', SEL_RUN, "sh", "SHELL" }, /* Run command with argument */ - { 'e', SEL_RUNARG, "vi" }, + { 'e', SEL_RUNARG, "vi", "EDITOR" }, + { 'p', SEL_RUNARG, "less", "PAGER" }, }; -- cgit v1.2.3-70-g09d2