Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How does shell decide between gui vim & terminal vim?



Hi,

On Tue, Aug 30, 2022 at 4:13 PM david rayner <david@xxxxxxxxxxxxxx> wrote:
> On 30/08/2022 20:38, Felipe Contreras wrote:
> > On Tue, Aug 30, 2022 at 11:39 AM zzapper <zsh@xxxxxxxxxxxxxx> wrote:
> >
> >> I am using a shell (/bin/sh) script which stubbornly calls the terminal
> >> version of gvim instead of the desired GUI version (gtk).
> >>
> >> I suspect the script doesn't know there is a GUI but what decides that?
> > How is it being called? Some programs use the $VISUAL or $EDITOR
> > environment variables to decide which editor to open.
> >
> PEBCAK: embarrassing mistake!
>
> Of course I'd set EDITOR=/bin/gvim but in .zshrc
>
> but the sh script obviously wasn't using .zshrc

I've thought a lot about how to set the editor properly, and my
conclusion is that it doesn't belong in .zshrc, but .zprofile. In
fact, it's better to set the editor to "vim" in .profile, and to
"gvim" in .xprofile. Of course, this depends on how your session is
being started.

But anyway, the point is that it should be in the environment,
*before* starting the script.

-- 
Felipe Contreras




Messages sorted by: Reverse Date, Date, Thread, Author