Skip to content

feat(open): support for new openInTerminal config option (behaves the same as editInTerminal but then for the open key binding)#5624

Open
ramonvermeulen wants to merge 1 commit into
jesseduffield:masterfrom
ramonvermeulen:f/open-in-terminal
Open

feat(open): support for new openInTerminal config option (behaves the same as editInTerminal but then for the open key binding)#5624
ramonvermeulen wants to merge 1 commit into
jesseduffield:masterfrom
ramonvermeulen:f/open-in-terminal

Conversation

@ramonvermeulen
Copy link
Copy Markdown

@ramonvermeulen ramonvermeulen commented May 21, 2026

PR Description

Closes #5623

This PR add support for openInTerminal in the same way that there is support for editInTerminal. When this value is set to true, lazygit will suspend until the configured open process returns, when the value is set to false behavior stays the same as is.

I decided to keep the naming conventional to editInTerminal, even though editInTerminal is named as is for backwards compatibility. Otherwise you would have suspendOnOpen and editInTerminal which doesn't really pair well, I'm fine renaming if that is desried.

Additional context: #5622

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here) -> when I run the formatter I get quite a huge diff on files that I didn't touch
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

Manual testing

I manually tested with the following configs:

With openInTerminal: true and a terminal based editor provided

  os:
    edit: 'nvim -- {{filename}}'
    editAtLine: 'nvim +{{line}} -- {{filename}}'
    editAtLineAndWait: 'nvim +{{line}} -- {{filename}}'
    editInTerminal: true
    open: 'nvim -- {{filename}}'
    openInTerminal: true

  promptToReturnFromSubprocess: false

  keybinding:
    universal:
      edit: e
      openFile: o

With this config open now behaves the same as edit in combination with editInTerminal, and I am able to open neovim within the same terminal session and after closing be back in lazygit because of the suspend functionality.

With openInTerminal: false and a terminal based editor provided

  os:
    edit: 'nvim -- {{filename}}'
    editAtLine: 'nvim +{{line}} -- {{filename}}'
    editAtLineAndWait: 'nvim +{{line}} -- {{filename}}'
    editInTerminal: true
    open: 'nvim -- {{filename}}'
    openInTerminal: false

  promptToReturnFromSubprocess: false

  keybinding:
    universal:
      edit: e
      openFile: o

For me this freezes lazygit and I have to close the app manually, this is the same behavior as what is currently on main.

With openInTerminal: false and a no editor provided

  os:
    edit: 'nvim -- {{filename}}'
    editAtLine: 'nvim +{{line}} -- {{filename}}'
    editAtLineAndWait: 'nvim +{{line}} -- {{filename}}'
    editInTerminal: true
    open: '' # keeps default behavior via GetPlatformDefaultConfig, which is `open -- {{filename}}`
    openInTerminal: false

  promptToReturnFromSubprocess: false

  keybinding:
    universal:
      edit: e
      openFile: o

Still keeps the original behavior, taking the system default via open -- and launching the default editor in a new process. In my case this opens the file in a GUI based editor in another process (in my case zed).

@ramonvermeulen ramonvermeulen marked this pull request as ready for review May 21, 2026 19:18
@ramonvermeulen ramonvermeulen changed the title feat(open): support for openInTerminal to behave the same as editInTerminal but then for the open binding feat(open): support for openInTerminal to behave the same as editInTerminal but then for the open key binding May 21, 2026
@ramonvermeulen ramonvermeulen changed the title feat(open): support for openInTerminal to behave the same as editInTerminal but then for the open key binding feat(open): support for new openInTerminal config option (behaves the same as editInTerminal but then for the open key binding) May 22, 2026
…nTerminal` but then for the `open` binding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support openInTerminal just like editInTerminal

1 participant