feat(open): support for new openInTerminal config option to be able to use terminal based applications for opening files in the same session#5624
Conversation
60f1fb8 to
932042f
Compare
openInTerminal to behave the same as editInTerminal but then for the open bindingopenInTerminal to behave the same as editInTerminal but then for the open key binding
openInTerminal to behave the same as editInTerminal but then for the open key bindingopenInTerminal config option (behaves the same as editInTerminal but then for the open key binding)
…nTerminal` but then for the `open` binding
932042f to
5a97314
Compare
|
Hi @stefanhaller, If you have the capacity, I would like to get a review on this PR / feature request. First typical question would be if this is something you would like to see added to lazygit at all? From my personal experience I would really love a configuration option like |
|
This doesn't make sense to me, and I don't understand why you are doing it (your PR description only explains what this does, but not why; that's the first thing a PR or issue should explain). It seems you want to achieve that
|
|
@stefanhaller thanks for taking a look at this. Sorry for not providing this thought in my original issue, but to elaborate a bit more on the why:
That is indeed how it is currently implemented. The Even though the "original" purpose is purely Even for binary files such as If it is just a clear no, it's only intended for GUI based programs, that is also fine, but at least I hope this makes you understand my chain of thought and why I would like to see this as a feature. Edit: I just updated the issue description to be more complete. |
openInTerminal config option (behaves the same as editInTerminal but then for the open key binding)openInTerminal config option to be able to use terminal based applications for opening files in the same session
PR Description
Closes #5623
This PR add support for
openInTerminalin the same way that there is support foreditInTerminal. When this value is set totrue, lazygit will suspend until the configuredopenprocess returns, when the value is set tofalsebehavior stays the same as is.I decided to keep the naming conventional to
editInTerminal, even thougheditInTerminalis named as is for backwards compatibility. Otherwise you would havesuspendOnOpenandeditInTerminalwhich doesn't really pair well, I'm fine renaming if that is desried.Additional context: #5622
Please check if the PR fulfills these requirements
go generate ./...)Manual testing
I manually tested with the following configs:
With
openInTerminal: trueand a terminal based editor providedWith this config
opennow behaves the same aseditin combination witheditInTerminal, 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: falseand a terminal based editor providedFor me this freezes
lazygitand I have to close the app manually, this is the same behavior as what is currently onmain.With
openInTerminal: falseand a no editor providedStill 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).