vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 2c53481e4938fc2027e6975e15fa72ff828718c0
parent 8bddb040c3cdae1cf133257110176bda68ee682d
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 31 Jan 2017 22:09:38 +0100

vis: support rudimentary help search using :help pattern

The argument needs to be a valid regular expression. It currently
clobbers the last used search term and hence allows repeated searches
using `n` and `N` respectively.

Diffstat:
Msam.c | 2+-
Mvis-cmds.c | 3+++
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/sam.c b/sam.c @@ -215,7 +215,7 @@ static const CommandDef cmds[] = { CMD_FORCE|CMD_ONCE|CMD_ADDRESS_NONE|CMD_DESTRUCTIVE, NULL, cmd_bdelete }, { "help", "Show this help", - CMD_ONCE|CMD_ADDRESS_NONE, NULL, cmd_help + CMD_ARGV|CMD_ONCE|CMD_ADDRESS_NONE, NULL, cmd_help }, { "map", "Map key binding `:map <mode> <lhs> <rhs>`", CMD_ARGV|CMD_FORCE|CMD_ONCE|CMD_ADDRESS_NONE, NULL, cmd_map diff --git a/vis-cmds.c b/vis-cmds.c @@ -753,6 +753,9 @@ static bool cmd_help(Vis *vis, Win *win, Command *cmd, const char *argv[], Curso text_appendf(txt, " %-32s\t%s\n", configs[i].name, configs[i].enabled ? "yes" : "no"); text_save(txt, NULL); + + if (argv[1]) + vis_motion(vis, VIS_MOVE_SEARCH_FORWARD, argv[1]); return true; }