Skip to content

Commit

Permalink
Accept unique prefixes as :commands
Browse files Browse the repository at this point in the history
The proper way to do this would be to use a trie, however the ugly
regexes do the trick for now.
  • Loading branch information
martanne committed Jan 14, 2015
1 parent 2e6c5a5 commit 1f6ddb7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ static Mode vis_modes[VIS_MODE_LAST];

/* command recognized at the ':'-prompt. tested top to bottom, first match wins. */
static Command cmds[] = {
{ "^bd(elete)?!?$", cmd_bdelete, false },
{ "^e(dit)?!?$", cmd_edit, false },
{ "^new$", cmd_new, false },
{ "^o(pen)?$", cmd_open, false },
{ "^qa(ll)?!?$", cmd_qall, false },
{ "^q(uit)?!?$", cmd_quit, false },
{ "^r(ead)?$", cmd_read, false },
{ "^sav(as)?$", cmd_saveas, false },
{ "^set?$", cmd_set, true },
{ "^sp(lit)?$", cmd_split, false },
{ "^s(ubstitute)?$", cmd_substitute, false },
{ "^vnew?$", cmd_vnew, false },
{ "^v(split)?$", cmd_vsplit, false },
{ "^wq!?$", cmd_wq, false },
{ "^w(rite)?$", cmd_write, false },
{ "^x(it)?!?$", cmd_xit, false },
{ /* array terminator */ },
{ "^bd(e|el|ele|elet|elete)?!?$", cmd_bdelete, false },
{ "^e(d|di|dit)?!?$", cmd_edit, false },
{ "^new$", cmd_new, false },
{ "^o(p|pe|pen)?$", cmd_open, false },
{ "^qa(l|ll)?!?$", cmd_qall, false },
{ "^q(u|ui|uit)?!?$", cmd_quit, false },
{ "^r(e|ea|ead)?$", cmd_read, false },
{ "^sav(a|as)?!?$", cmd_saveas, false },
{ "^set?$", cmd_set, true },
{ "^sp(l|li|lit)?$", cmd_split, false },
{ "^s(u|ubstitute)?$", cmd_substitute, false },
{ "^vnew?$", cmd_vnew, false },
{ "^vs(p|pl|pli|plit)?$", cmd_vsplit, false },
{ "^wq!?$", cmd_wq, false },
{ "^w(r|ri|rit|rite)?!?$", cmd_write, false },
{ "^x(i|it)?!?$", cmd_xit, false },
{ /* array terminator */ },
};

/* draw a statubar, do whatever you want with win->statuswin curses window */
Expand Down

0 comments on commit 1f6ddb7

Please sign in to comment.