prati0100 / git-gui

Tcl/Tk based UI for Git. I am currently acting as the project's maintainer.
161 stars 87 forks source link

Allow choosing external editor command #32

Open annulen opened 4 years ago

annulen commented 4 years ago

It seems like git-gui is using xdg-open or something like that when clicking on "link" with current file name. It would be great if it was possible to use custom editor with given arguments instead. Bonus points if git-gui could allow passing line number corresponding to currently reviewed diff chunk.

prati0100 commented 4 years ago

Yes, we do use xdg-open for opening files.

Allowing opening files with a custom editor command shouldn't be too difficult. I will look into it when I can find some time.

As for opening at a specific line number, how do you define the "current hunk"? Is it the hunk in which the cursor is? Is that something intuitive that other users can guess?

annulen commented 4 years ago

As for opening at a specific line number, how do you define the "current hunk"? Is it the hunk in which the cursor is? Is that something intuitive that other users can guess?

I'm not really competent in UX, but it could work for example as a button-like control "Open in editor" in a corner of chunk area, or just action in context menu.

annulen commented 4 years ago

Here is an example of how GUI for customization of editor command is implemented in other program (Alleyoop): 2020-03-11-175254_456x31_scrot

bertwesarg commented 4 years ago

In my opinion we should distinguish between opening a file and opening a file for editing. While it is true, that most tracked files are text files, it is not universal true. Thus I think we should keep using xdg-open (or platform dependent equivalents) for the Open action and should add a Edit or Open for Edit action with a user editable command for editing. Maybe this could be overloaded into one action, if we follow the result of the text attribute of the path, if it is a text file, then use the custom command, if not use xdg-open.