lazygit: lazygit can not works with editor

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Switch to Commits panel
  2. <kbd>R</kbd> to reword commit using editor
+ git rebase --interactive --autostash [hash]

hint: Waiting for your editor to close the file... 2019/09/29 22:34:25 chdir /path/to/.git/rebase-merge/git-rebase-todo: not a directory
error: There was a problem with the editor '/usr/bin/lazygit'.

Press enter to return to lazygit
  1. I have tried both git config --global core.editor $(which vim) and git config --global core.editor $(which nano), neither of them works.

  1. Switch to Commits panel
  2. <kbd>f</kbd> to fixup the commit. <kbd>Enter</kbd> to confirm.
┌─Error───────────────────────────────────────────────────────────────────────────────────┐
│2019/09/29 22:38:49 chdir /path/to/.git/rebase-merge/git-rebase-todo: not a directory    │
│error: There was a problem with the editor '/usr/bin/lazygit'.                           │
└─────────────────────────────────────────────────────────────────────────────────────────┘
  1. I have tried both git config --global core.editor $(which vim) and git config --global core.editor $(which nano), neither of them works.

Expected behavior A clear and concise description of what you expected to happen.

I use nano as default editor for git. lazygit used to works well with nano.

Desktop (please complete the following information):

  • OS: Debian 10 WSL1 on Windows 10
  • Lazygit Version: latest daily build from Ubuntu PPA
$ lazygit -v
commit=95ae806, build date=2019-09-25, build source=debian, version=, os=linux, arch=amd64

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Please try setting EDITOR environment variable and then run lazygit.

Like: EDITOR=vim lazygit.

Impossible to have a different editor than vim I tried setting it up with both EDITOR env var or core.editor git config.

I tried with code, codei, zed editors, nothing works.

Any idea how I can debug that?

lazygit should fallback to EDITOR if git.editor is not set

Identified possible bug:

if repoPath != "." {
	if err := os.Chdir(repoPath); err != nil {
		log.Fatal(err.Error())
	}
}

Seems to have side effects