help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Only set VISUAL for edit-and-execute-command


From: Mike
Subject: Only set VISUAL for edit-and-execute-command
Date: Thu, 23 May 2024 23:11:12 -0400

I am working on a script that I'd like to be invoked
by edit-and-execute-command. Currently, it works fine if I set the VISUAL
environment variable and press C-xC-e. However, I don't want to set VISUAL
to this script globally because I only want it to run in the context of
C-xC-e. I'd like to keep VISUAL set to nvim so that other applications can
still use VISUAL as expected.

I see the source for edit_and_execute_command looks for VISUAL and then
EDITOR.

#define VI_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-vi}}\""
#define EMACS_EDIT_COMMAND "fc -e \"${VISUAL:-${EDITOR:-emacs}}\""
#define POSIX_VI_EDIT_COMMAND "fc -e vi"

Is there a way to create a binding that could in a local scope set VISUAL
to my script and then trigger edit-and-execute-command?

Ideally, there would be another environment variable that I could hook into
just for this specific case. For example if the source had something like
this:

${EDIT_AND_EXECUTE_COMMAND:-${VISUAL:-${EDITOR:-emacs}}}

Then I could just use EDIT_AND_EXECUTE_COMMAND and leave VISUAL alone.

Thanks,
Mike


reply via email to

[Prev in Thread] Current Thread [Next in Thread]