vhakulinen / gnvim

GUI for neovim, without any web bloat
MIT License
1.85k stars 69 forks source link

Detach from terminal automatically #167

Closed newptcai closed 3 years ago

newptcai commented 3 years ago

When using gvim, you can run gvim file from a terminal, and gvim will start detach itself from the terminal automatically.

To do the same thing for gnvim, now I have to type (gnvim file &). Can we get the same behavior of gvim?

vhakulinen commented 3 years ago

Its not currently possible. You could write a wrapper script for gnvim which detaches its process from the terminal.

simi commented 1 year ago

@vhakulinen would you mind to explain why it is not possible? Is that just not implemented and would that be welcomed? Or is there any known technical limitation preventing this being implemented?

vhakulinen commented 1 year ago

Not currently possible, e.g. not implemented at the moment.

simi commented 1 year ago

@vhakulinen I was looking at gvim implementation and it seems to be utilizing fork on UNIX systems to achieve this.

https://github.com/vim/vim/blob/b9a1edfc5434f2a3ac50b1a178d3c85aa417b798/src/gui.c#L81-L100

I can take a look how much effort would be to do something similar if welcomed.

vhakulinen commented 1 year ago

In addition to the fork and setsid approach, you could also spawn a new gnvim process (with std::process::Command) passing all the arguments to it.

Feel free to experiment. I would personally try to avoid pulling any dependencies for this sort of functionality.

simi commented 1 year ago

In addition to the fork and setsid approach, you could also spawn a new gnvim process (with std::process::Command) passing all the arguments to it.

Feel free to experiment. I would personally try to avoid pulling any dependencies for this sort of functionality.

OK, thanks for the info and suggestion!