aboutsummaryrefslogtreecommitdiff
path: root/config.def.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-03-11 23:42:32 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-03-18 20:52:00 +0100
commitce06f56c96111f2a4a25178da3102033b703f3b3 (patch)
tree46c1e54b59529e8166fc7bab26cba5d667115588 /config.def.h
parent286e1911b926d47e2028e132451f9c0f99f4affb (diff)
downloadvis-ce06f56c96111f2a4a25178da3102033b703f3b3.tar.gz
vis-ce06f56c96111f2a4a25178da3102033b703f3b3.tar.xz
Cleanup :-command implementation
Everything that is a unique prefix should now be allowed for a given command.
Diffstat (limited to 'config.def.h')
-rw-r--r--config.def.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/config.def.h b/config.def.h
index 04274e2..7d7c495 100644
--- a/config.def.h
+++ b/config.def.h
@@ -46,25 +46,29 @@ enum {
static Mode vis_modes[VIS_MODE_LAST];
-/* command recognized at the ':'-prompt. tested top to bottom, first match wins. */
+/* command recognized at the ':'-prompt. commands are found using a unique
+ * prefix match. that is if a command should be available under an abbreviation
+ * which is a prefix for another command it has to be added as an alias. the
+ * long human readable name should always come first */
static Command cmds[] = {
- { "^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(e|ea|eas)?!?$", 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 */ },
+ /* command name / optional alias, function, options */
+ { { "bdelete" }, cmd_bdelete, CMD_OPT_FORCE },
+ { { "edit" }, cmd_edit, CMD_OPT_FORCE },
+ { { "new" }, cmd_new, CMD_OPT_NONE },
+ { { "open" }, cmd_open, CMD_OPT_NONE },
+ { { "qall" }, cmd_qall, CMD_OPT_FORCE },
+ { { "quit", "q" }, cmd_quit, CMD_OPT_FORCE },
+ { { "read", }, cmd_read, CMD_OPT_NONE },
+ { { "saveas" }, cmd_saveas, CMD_OPT_FORCE },
+ { { "set", }, cmd_set, CMD_OPT_ARGS },
+ { { "split" }, cmd_split, CMD_OPT_NONE },
+ { { "substitute", "s" }, cmd_substitute, CMD_OPT_NONE },
+ { { "vnew" }, cmd_vnew, CMD_OPT_NONE },
+ { { "vsplit", }, cmd_vsplit, CMD_OPT_NONE },
+ { { "wq", }, cmd_wq, CMD_OPT_FORCE },
+ { { "write", "w" }, cmd_write, CMD_OPT_FORCE },
+ { { "xit", }, cmd_xit, CMD_OPT_FORCE },
+ { /* array terminator */ },
};
/* draw a statubar, do whatever you want with win->statuswin curses window */