lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Keyboard shortcut `o` to open `config.yml` file does not respect default editor

Open jamesnelmore opened this issue 1 year ago • 1 comments

Describe the bug When using the shortcut o to open the lazygit config file, it does not open in the default editor specified by $EDITOR.

To Reproduce Steps to reproduce the behavior:

  1. Select Status panel
  2. Presse o
  3. config.yml opened in Xcode (on MacOS), while I have $EDITOR set to nvim

Expected behavior Should open the config file in the default editor according to config.yml or $EDITOR.

Version info: commit=, build date=, build source=homebrew, version=0.40.2, os=darwin, arch=arm64, git version=2.44.0 git version 2.44.0

I ran this one the latest commit (fadc289) and it still occurs.

jamesnelmore avatar Mar 20 '24 21:03 jamesnelmore

Not a bug. Short answer: use e instead of o.

Long answer: lazygit has two ways to open or edit a file (any file, not just the config file): e, which uses your editor configuration, and o, which opens the file as if you had double-clicked it in the Finder. For files in your repo this distinction can be useful because, for example, for svg files it lets you decide whether you want to edit them, or open them in your image viewer.

For the case of the config file, only e is really useful, so I'm not sure why we also provide o for it; probably only for legacy reasons, but I don't totally remember. I'd be in favor of removing it to avoid this confusion.

stefanhaller avatar Mar 21 '24 07:03 stefanhaller