[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Only set VISUAL for edit-and-execute-command
From: |
Mike |
Subject: |
Re: Only set VISUAL for edit-and-execute-command |
Date: |
Thu, 30 May 2024 12:15:27 -0400 |
Good idea, this might do the trick for what I need to do. Thanks!
On Wed, May 29, 2024 at 4:54 PM Koichi Murase <myoga.murase@gmail.com>
wrote:
> 2024年5月24日(金) 13:43 Mike <nvimmike@gmail.com>:
> > 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 think the typical solution people use is to prepare a small script
> (such as ~/bin/custom-visual-selector) like
>
> #!/usr/bin/bash env
> if [[ $1 == *bash-fc* ]]; then
> exec script-to-be-invoked-by-edit-and-execute "$@"
> else
> exec nvim "$@"
> fi
>
> and put it in VISUAL
>
> VISUAL=custom-visual-selector
>
> --
> Koichi
>