Skip to content

External editor does not start with EDITOR set #1654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
darthmall opened this issue Apr 14, 2023 · 5 comments
Closed

External editor does not start with EDITOR set #1654

darthmall opened this issue Apr 14, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@darthmall
Copy link

Describe the bug
I have set EDITOR=nvim in my shell, but when I hit ctrl-e, nothing happens.

To Reproduce
Steps to reproduce the behavior:

  1. Stage changes
  2. Press 'w' to switch to staged changes
  3. Press 'ctrl+e'
  4. Nothing happens

Expected behavior
NeoVim should start up with the commit message template.

Context (please complete the following information):

  • OS/Distro + Version: Pop!_OS 22.04 LTS x86_64
  • GitUI Version: 0.22.1
  • Rust version: 1.67.1

Additional context
I’m using fish version 3.6.1 for my shell, and I have NeoVim version 0.8.2. I have tried running EDITOR=vi gitui and ctrl-e still does nothing.

@darthmall darthmall added the bug Something isn't working label Apr 14, 2023
@pm100
Copy link
Contributor

pm100 commented Apr 17, 2023

^e is only available in the commit popup. 'h' shows help

image

in the staged change box, press 'c' to start a commit. You will get

image

now hit ^e

image

@darthmall
Copy link
Author

Thanks, I misunderstood the help menu in the app. But now I’m getting an error:

Failed to launch editor:
"$EDITOR": no such file or directory (os error 2)

I’ve tried the following:

  1. EDITOR=nvim gitui
  2. EDITOR=vi gitui
  3. EDITOR=/home/evan/.local/bin/nvim gitui

I have no trouble launching either vi or nvim from the same shell in which I then launch gitui.

@pm100
Copy link
Contributor

pm100 commented Apr 19, 2023

Hmm, very odd. Can you please show exactly how you set that editor variable. The fact that the error message says '$EDITOR' is very strange.

When I do

image

and try to invoke the editor I get

image

Note that the thing that is reported is the content of the editor specification, not the variable name.

I can create that error condition by doing this

git config core.editor '$EDITOR'
export EDITOR=nvim

and I get

image

But that is mixing two ways of setting up the editor. Plus the quoting of $EDITOR means that its not really an environment variable.

To specify the editor you can either do:

export EDITOR=vim

(or VISUAL or GIT_EDITOR)

or

git config core.editor=vim

BTW the precedence is GIT_EDITOR, core.editor, VISUAL, EDITOR

I also wonder why you have tried to invoke nvim gitui. Why pass gitui as an argument to the editor?

@darthmall
Copy link
Author

BTW the precedence is GIT_EDITOR, core.editor, VISUAL, EDITOR

Ok, that’s what it was. I had a bad value for core.editor in ~/.gitconfig.

But for what it’s worth, I was not passing gitui as an argument to nvim. The commands I executed are:

  1. EDITOR=nvim gitui
  2. EDITOR=vi gitui
  3. EDITOR=/home/evan/.local/bin/nvim gitui

Beginning the command with EDITOR=nvim sets the environment variable EDITOR for just that command, so that you don’t have to keep running export or set in your shell when you’re testing multiple values.

@pm100
Copy link
Contributor

pm100 commented Apr 19, 2023

Yup, my bad with the last question. So you good now? Can you close this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants