Skip to content

Commit

Permalink
vis: support rudimentary help search using :help pattern
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
martanne committed Feb 2, 2017
1 parent 3b07039 commit cc69898
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions vis-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit cc69898

Please sign in to comment.