diff --git a/INSTALL.adoc b/INSTALL.adoc index ab132652c..3c3d56ea8 100644 --- a/INSTALL.adoc +++ b/INSTALL.adoc @@ -88,6 +88,7 @@ can be one of the following flags: - `NO_BUILTIN_TIGRC`: Reduce the size of the binary by not including a built-in tigrc. The built-in tigrc is used as a fallback when no `tigrc` is found in the system configuration directory (e.g. `/etc`). + - `TIG_USER_CONFIG`: Allow to customize the `tigrc` path (default `~/.tigrc`). The following example `config.make` manually configures Tig to use the ncurses library with wide character support and include the proper ncurses header file diff --git a/Makefile b/Makefile index 3f9eda6d2..bd89d0945 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,9 @@ endif override CPPFLAGS += '-DTIG_VERSION="$(VERSION)"' override CPPFLAGS += '-DSYSCONFDIR="$(sysconfdir)"' +ifdef TIG_USER_CONFIG +override CPPFLAGS += '-DTIG_USER_CONFIG="$(TIG_USER_CONFIG)"' +endif ASCIIDOC ?= asciidoc ASCIIDOC_FLAGS = -aversion=$(VERSION) -asysconfdir=$(sysconfdir) -f doc/asciidoc.conf diff --git a/NEWS.adoc b/NEWS.adoc index 10d064ed8..7109c0c4d 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -30,6 +30,7 @@ Improvements: - Add sample git-flow keybinding (GH #421) - Add chocolate theme (GH #432) - Show stash diffs. (GH #328) + - Make user tigrc location configurable. (GH #479) Bug fixes: diff --git a/include/tig/options.h b/include/tig/options.h index 737489a02..70e3f3812 100644 --- a/include/tig/options.h +++ b/include/tig/options.h @@ -26,6 +26,10 @@ struct ref_format; struct view_column; typedef struct view_column *view_settings; +#ifndef TIG_USER_CONFIG +#define TIG_USER_CONFIG "~/.tigrc" +#endif + #define OPTION_INFO(_) \ _(blame_options, const char **, VIEW_BLAME_LIKE) \ _(blame_view, view_settings, VIEW_NO_FLAGS) \ diff --git a/src/options.c b/src/options.c index 150fcf875..33b27c192 100644 --- a/src/options.c +++ b/src/options.c @@ -947,7 +947,7 @@ load_options(void) } if (!tigrc_user) - tigrc_user = "~/.tigrc"; + tigrc_user = TIG_USER_CONFIG; load_option_file(tigrc_user); if (!diff_opts_from_args && tig_diff_opts && *tig_diff_opts) {