Skip to content

Commit

Permalink
add /etc/vis to lua path for system-wide configuration by administrator
Browse files Browse the repository at this point in the history
  • Loading branch information
eworm-de committed Feb 2, 2017
1 parent a8f67d4 commit 36b03e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion man/vis.1
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,10 @@ Upon startup
.Nm
will source the first
.Pa visrc.lua
configuration file found from these locations:
configuration file found from these locations. All actively used paths can
be listed at runtime using the
.Cm :help
command.
.Bl -bullet
.It
.Pa $VIS_PATH
Expand All @@ -1261,6 +1264,9 @@ refers to
if unset.
.
.It
.Pa /etc/vis
for a system-wide configuration provided by administrator.
.It
.Pa /usr/local/share/vis
or
.Pa /usr/share/vis
Expand Down
3 changes: 3 additions & 0 deletions vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -2186,6 +2186,7 @@ void vis_lua_init(Vis *vis) {
* - $VIS_PATH/{,lexers}
* - {,lexers} relative to the binary location
* - $XDG_CONFIG_HOME/vis/{,lexers} (defaulting to $HOME/.config/vis/{,lexers})
* - /etc/vis/{,lexers} (for system-wide configuration provided by administrator)
* - /usr/local/share/vis/{,lexers} (or whatever is specified during ./configure)
* - package.path (standard lua search path)
*/
Expand All @@ -2201,6 +2202,8 @@ void vis_lua_init(Vis *vis) {
home = pw->pw_dir;
}

vis_lua_path_add(vis, "/etc/vis");

const char *xdg_config = getenv("XDG_CONFIG_HOME");
if (xdg_config) {
snprintf(path, sizeof path, "%s/vis", xdg_config);
Expand Down

0 comments on commit 36b03e5

Please sign in to comment.