jesseduffield / lazygit

simple terminal UI for git commands
MIT License
53.82k stars 1.88k forks source link

(Neo)Vim Integration with a Flag #1591

Open is0n opened 3 years ago

is0n commented 3 years ago

Is your feature request related to a problem? Please describe. Looking at #996, it is clear to me that people would like to see a better way of using Lazygit in Neovim, however, there isn't really a good way of doing this. I too would like to see some sort of vim integration yet I see no good solution to this.

Describe the solution you'd like What I suggest is creating a flag for Lazygit where if a file is opened with e, instead of opening the file with $EDITOR, it will write the path of the file to some temporary file (the flag would be like --flagname <temporary file path>. Lazygit would then close and from then on, a Vim or Neovim can just read from the file and open the selected file with the written file path. Lots of terminal file managers such as Nnn (-p), Ranger (--chosefiles=), and Lf (-selection-path) have flags like these that allows vim integration.

Describe alternatives you've considered An alternative to this is using something of the likes lazygit.nvim or even neovim-remote, however, I find both of these approaches to be quite excessive for just wanting to open a file in Neovim.

Additional context I have a Neovim plugin for terminal file managers and fuzzy finders called fm-nvim and its method for integrating external programs is the same method I have used to integrate 3 fuzzy finders and 10 file managers.

lifeModder19135 commented 3 years ago

...it will write the path of the file to some temporary file...

Sounds like a great use case for a FIFO.