Skip to content

Commit

Permalink
Add TIG_EDITOR environment variable to configure editor
Browse files Browse the repository at this point in the history
Closes jonas#889
  • Loading branch information
koutcher committed Apr 8, 2021
1 parent d109613 commit 2c34d2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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

0 comments on commit 2c34d2d

Please sign in to comment.