aboutsummaryrefslogtreecommitdiff
path: root/vis-cmds.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-05 16:28:59 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-05 16:28:59 +0100
commit47e82949164c23973dbad72d3982d9aef557d118 (patch)
tree27b0ff988cbdd896a27f52882a8da77a27ecb7be /vis-cmds.c
parentfb414a7a85c6b8843d18030f07db0b8c80cc0251 (diff)
downloadvis-47e82949164c23973dbad72d3982d9aef557d118.tar.gz
vis-47e82949164c23973dbad72d3982d9aef557d118.tar.xz
vis: display Lua package.cpath in :help output
These paths are used to load the Lua LPeg module (lpeg.so) and are thus helpful when diagnosing setup problems in case syntax highlighting does not work.
Diffstat (limited to 'vis-cmds.c')
-rw-r--r--vis-cmds.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/vis-cmds.c b/vis-cmds.c
index 87ebd67..ab4a4d2 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -653,18 +653,23 @@ static bool cmd_help(Vis *vis, Win *win, Command *cmd, const char *argv[], Curso
"(prefix with C-, S-, and M- for Ctrl, Shift and Alt respectively)\n\n");
print_symbolic_keys(vis, txt);
- const char *paths = vis_lua_paths_get(vis);
- if (paths) {
- char *copy = strdup(paths);
- text_appendf(txt, "\n Lua paths used to load runtime files "
- "(? will be replaced by filename):\n\n");
- for (char *elem = copy, *next; elem; elem = next) {
- if ((next = strstr(elem, ";")))
- *next++ = '\0';
- if (*elem)
- text_appendf(txt, " %s\n", elem);
+ char *paths[] = { NULL, NULL };
+ char *paths_description[] = {
+ "Lua paths used to load runtime files (? will be replaced by filename):",
+ "Lua paths used to load C libraries (? will be replaced by filename):",
+ };
+
+ if (vis_lua_paths_get(vis, &paths[0], &paths[1])) {
+ for (size_t i = 0; i < LENGTH(paths); i++) {
+ text_appendf(txt, "\n %s\n\n", paths_description[i]);
+ for (char *elem = paths[i], *next; elem; elem = next) {
+ if ((next = strstr(elem, ";")))
+ *next++ = '\0';
+ if (*elem)
+ text_appendf(txt, " %s\n", elem);
+ }
+ free(paths[i]);
}
- free (copy);
}
text_save(txt, NULL);