You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Open editor in the same line of the diff pane #1206
During diff inspection, it would be nice to open the editor to the same line number as it is within the diff pane.
This feature would allow to quickly make changes to the file under inspection.
It would be also very useful to print numbers at the begin of the lines in the diff pane.
We could check the $EDITOR or $GIT_EDITOR for a handful of most common editors and support that? E.g. vim, nvim, vi, nano, emacs, subl, vscode, they all support something like <editor> +<line> <file>.
If it's not one of those, we could read a config entry in the form of <editor> <args> <file> and let the user provide their own?
IMO it would be a reasonable compromise to have this feature for all editors supporting the +line arg.
I assume that with the editors just enumerated you already covered a huge part of gitui users (maybe all :-) )
I have found myself wishing for this feature fairly often since it's great to be able to live inside gitui!
The most satisfying and flexible way I've seen this problem being solved is the token-based approach in qutebrowser for defining an editor command via config:
{file}: Filename of the file to be edited.
{line}: Line in which the caret is found in the text.
{column}: Column in which the caret is found in the text.
{line0}: Same as {line}, but starting from index 0.
{column0}: Same as {column}, but starting from index 0.
...
This method allows for configuration that would work with almost any editor. We also probably wouldn't need column or column0 here.
There could still be default configuration similar to the current functionality, but with the ability to override beyond just setting an environment variable. The +line could even be part of the default configuration, like:
editor_command: "$EDITOR +{line} {file}"
The big caveat of this idea/suggestion being that from what I know gitui doesn't currently have anything like a config.ron, but we do have config files for themes and keybinds.
This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
Any update on this?
I just started using this amazing software (good job with this project BTW! :D) but this part is quite frankly really annoying, when working with decently sized files this problem causes quite a lot of wasted time having to scroll to the line you were on when you pressed "e" to edit the file while on gitui, is there any chance this might get implemented using one of the suggested possible solutions (or something else) in the future?
This is one of the things I miss most from tig. In the diff view of tig, when I hit the edit key it opens my editor to whichever line I was highlighting. Gitui currently only lets you open the file from the stage view, not in the diff view where you actually want to edit the line or hunk you're looking at. If it added an [e]dit key to diff view that used the +lineno syntax it would go a long way.
Some additional context, tig's config has this setting:
set editor-line-number = yes # Automatically pass line number to editor? Used
# for opening file at specific line e.g. from a diff
Activity
extrawurst commentedon Apr 23, 2022
that has two challenges:
mark2185 commentedon Apr 23, 2022
We could check the
$EDITORor$GIT_EDITORfor a handful of most common editors and support that? E.g.vim, nvim, vi, nano, emacs, subl, vscode, they all support something like<editor> +<line> <file>.If it's not one of those, we could read a config entry in the form of
<editor> <args> <file>and let the user provide their own?davxy commentedon Apr 23, 2022
IMO it would be a reasonable compromise to have this feature for all editors supporting the
+linearg.I assume that with the editors just enumerated you already covered a huge part of
gituiusers (maybe all :-) )star-szr commentedon May 26, 2022
I have found myself wishing for this feature fairly often since it's great to be able to live inside
gitui!The most satisfying and flexible way I've seen this problem being solved is the token-based approach in qutebrowser for defining an editor command via config:
https://www.qutebrowser.org/doc/help/settings.html#editor.command
This method allows for configuration that would work with almost any editor. We also probably wouldn't need
columnorcolumn0here.There could still be default configuration similar to the current functionality, but with the ability to override beyond just setting an environment variable. The
+linecould even be part of the default configuration, like:The big caveat of this idea/suggestion being that from what I know gitui doesn't currently have anything like a
config.ron, but we do have config files for themes and keybinds.stale commentedon Dec 21, 2022
This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
davxy commentedon Jan 5, 2023
not stale? 🤞😃
creeloper27 commentedon Mar 16, 2023
Any update on this?
I just started using this amazing software (good job with this project BTW! :D) but this part is quite frankly really annoying, when working with decently sized files this problem causes quite a lot of wasted time having to scroll to the line you were on when you pressed "e" to edit the file while on gitui, is there any chance this might get implemented using one of the suggested possible solutions (or something else) in the future?
rawsp33d commentedon Oct 3, 2026
This is one of the things I miss most from tig. In the diff view of tig, when I hit the edit key it opens my editor to whichever line I was highlighting. Gitui currently only lets you open the file from the stage view, not in the diff view where you actually want to edit the line or hunk you're looking at. If it added an
[e]ditkey to diff view that used the+linenosyntax it would go a long way.Some additional context, tig's config has this setting: