Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TIG_EDITOR environment variable to configure editor #1098

Merged
merged 1 commit into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/tig.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ TIG_NO_DISPLAY::
Open Tig without rendering anything to the terminal. This force Ncurses
to write to /dev/null. The main use is for automated testing of Tig.

TIG_EDITOR::
The editor command to use when visiting files. This environment
variable overrides $GIT_EDITOR, $EDITOR and $VISUAL, so it allows
to use a different editor from the one Git uses.

FILES
-----
'$XDG_CONFIG_HOME/tig/config'::
Expand Down
3 changes: 2 additions & 1 deletion doc/tigrc.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ the Git configuration:

'core.editor'::

The editor command. Can be overridden by setting GIT_EDITOR.
The editor command. Can be overridden by setting TIG_EDITOR or
GIT_EDITOR.

'core.worktree'::

Expand Down
4 changes: 3 additions & 1 deletion src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ open_editor(const char *file, unsigned int lineno)
const char *editor;
int argc = 0;

editor = getenv("GIT_EDITOR");
editor = getenv("TIG_EDITOR");
if (!editor)
editor = getenv("GIT_EDITOR");
if (!editor && *opt_editor)
editor = opt_editor;
if (!editor)
Expand Down