Removed commands to step thought hints or completions.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 11 May 2013 12:55:52 +0000 (14:55 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 11 May 2013 13:11:23 +0000 (15:11 +0200)
Hint focussing and completion stepping are both done in command mode. So we
can't assign the same keybindings for both commands to the same keybinding.
Using only one command allows us to check the browsers submode to do the right
action.

doc/vimb.1.txt
src/command.c
src/command.h
src/config.h

index c0510bb..e22970f 100644 (file)
@@ -187,31 +187,6 @@ Remove a Input Mode keybinding.
 .TP
 .B cunmap
 Remove a Command Mode keybinding.
-.TP
-.B complete
-Start a completion according to the current first chars in the inputbox. If
-completion is already started, switch to the next completion item.
-
-Following completions are available:
-.RS
-.nr step 1 1
-.IP \n[step] 3
-Commands `:'
-.IP \n+[step]
-Settings `:set '
-.IP \n+[step]
-Url-History and Bookmarks `:open \fIQUERY\fP' or `:tabopen \fIQUERY\fP'.
-If \fIQUERY\fP is given, this will be used to fetch matching urls from history
-file, or to find bookmarks from bookmark file. The urls from history will only
-be matched by their url, the bookmarks only by their tags. If multiple tags
-are given to get the bookmarks, only those bookmarks will be returned, that
-matches all the given tags or that don't have any tag set.
-.IP \n+[step]
-Searchqueries `/' or `?'
-.RE
-.TP
-.B complete-back
-If complation is already started, switch to the previous completion item.
 .SS Hints
 .TP
 .BI "hint-link [" PREFIX "], hint-link-new [" PREFIX ]
@@ -234,9 +209,6 @@ given, print this into the inputbox, default ';i' and ';I'.
 .BI "hint-editor [" PREFIX "]"
 Start hinting to open inputboxes or textareas with external editor. If
 \fIPREFIX\fP is given, print this into the inputbox, default ';e'.
-.TP
-.B hint-focus-nex, hint-focus-prev
-Focus next or previous hint.
 .SS Yank
 .TP
 .B yank-uri
@@ -309,6 +281,28 @@ commands and search queries.
 Save the current opened uri with \fITAGS\fP to the bookmark file.
 .SS Misc
 .TP
+.B next, prev
+This are wrapper commands to start completion and to step through the
+completion items, or to focus previous or next hints if hinting is active.
+
+Following completions are available:
+.RS
+.nr step 1 1
+.IP \n[step] 3
+Commands `:'
+.IP \n+[step]
+Settings `:set '
+.IP \n+[step]
+Url-History and Bookmarks `:open \fIQUERY\fP' or `:tabopen \fIQUERY\fP'.
+If \fIQUERY\fP is given, this will be used to fetch matching urls from history
+file, or to find bookmarks from bookmark file. The urls from history will only
+be matched by their url, the bookmarks only by their tags. If multiple tags
+are given to get the bookmarks, only those bookmarks will be returned, that
+matches all the given tags or that don't have any tag set.
+.IP \n+[step]
+Searchqueries `/' or `?'
+.RE
+.TP
 .BI run " [COMMAND LIST]"
 Run is a command, that was introduced to have the ability to run multiple
 other commands with a single call. Everything after the `run' is interpreted
@@ -500,19 +494,15 @@ Search for \fIN\fPnth next search result.
 .TP
 .BI [ N ]N
 Search for \fIN\fPnth previous search result.
-.TP
-.B ctrl\-n
-Foxus the next hint.
-.TP
-.B ctrl\-p
-Foxus the previous hint.
 .SS COMMAND_MODE
 .TP
 .B tab
-Complete different sources in the inputbox.
+Complete different sources in the inputbox or if hinting is active, focus next
+hint.
 .TP
 .B shift\-tab
-Complete backward different sources in the inputbox.
+Complete backward different sources in the inputbox or if hinting is active,
+focus previous hint.
 .TP
 .B up
 Step through history backward.
index 0a62612..27c2cdb 100644 (file)
@@ -74,8 +74,6 @@ static CommandInfo cmd_list[] = {
     {"iunmap",               command_unmap,                {VB_MODE_INSERT}},
     {"cunmap",               command_unmap,                {VB_MODE_COMMAND}},
     {"set",                  command_set,                  {0}},
-    {"complete",             command_complete,             {0}},
-    {"complete-back",        command_complete,             {1}},
     {"inspect",              command_inspect,              {0}},
     {"hint-link",            command_hints,                {HINTS_TYPE_LINK | HINTS_PROCESS_OPEN, "."}},
     {"hint-link-new",        command_hints,                {HINTS_TYPE_LINK | HINTS_PROCESS_OPEN | HINTS_OPEN_NEW, ","}},
@@ -85,8 +83,6 @@ static CommandInfo cmd_list[] = {
     {"hint-image-open",      command_hints,                {HINTS_TYPE_IMAGE | HINTS_PROCESS_OPEN, ";i"}},
     {"hint-image-tabopen",   command_hints,                {HINTS_TYPE_IMAGE | HINTS_PROCESS_OPEN | HINTS_OPEN_NEW, ";I"}},
     {"hint-editor",          command_hints,                {HINTS_TYPE_EDITABLE, ";e"}},
-    {"hint-focus-next",      command_hints_focus,          {0}},
-    {"hint-focus-prev",      command_hints_focus,          {1}},
     {"yank-uri",             command_yank,                 {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_URI}},
     {"yank-selection",       command_yank,                 {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_SELECTION}},
     {"open-clipboard",       command_paste,                {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | VB_TARGET_CURRENT}},
@@ -107,6 +103,8 @@ static CommandInfo cmd_list[] = {
     {"bookmark-add",         command_bookmark,             {1}},
     {"eval",                 command_eval,                 {0}},
     {"editor",               command_editor,               {0}},
+    {"next",                 command_nextprev,             {0}},
+    {"prev",                 command_nextprev,             {1}},
 };
 
 
@@ -388,14 +386,6 @@ gboolean command_set(const Arg *arg)
     return success;
 }
 
-gboolean command_complete(const Arg *arg)
-{
-    /* mode will be set in completion_complete */
-    completion_complete(arg->i ? true : false);
-
-    return true;
-}
-
 gboolean command_inspect(const Arg *arg)
 {
     gboolean enabled;
@@ -428,13 +418,6 @@ gboolean command_hints(const Arg *arg)
     return true;
 }
 
-gboolean command_hints_focus(const Arg *arg)
-{
-    hints_focus_next(arg->i ? true : false);
-
-    return true;
-}
-
 gboolean command_yank(const Arg *arg)
 {
     vb_set_mode(VB_MODE_NORMAL, true);
@@ -695,6 +678,18 @@ gboolean command_editor(const Arg *arg)
     return true;
 }
 
+gboolean command_nextprev(const Arg *arg)
+{
+    if (vb.state.mode & VB_MODE_HINTING) {
+        hints_focus_next(arg->i ? true : false);
+    } else {
+        /* mode will be set in completion_complete */
+        completion_complete(arg->i ? true : false);
+    }
+
+    return true;
+}
+
 static void editor_resume(GPid pid, int status, OpenEditorData *data)
 {
     char *text;
index fb50ba7..b6cc227 100644 (file)
@@ -62,10 +62,8 @@ gboolean command_scroll(const Arg *arg);
 gboolean command_map(const Arg *arg);
 gboolean command_unmap(const Arg *arg);
 gboolean command_set(const Arg *arg);
-gboolean command_complete(const Arg *arg);
 gboolean command_inspect(const Arg *arg);
 gboolean command_hints(const Arg *arg);
-gboolean command_hints_focus(const Arg *arg);
 gboolean command_yank(const Arg *arg);
 gboolean command_paste(const Arg *arg);
 gboolean command_search(const Arg *arg);
@@ -76,5 +74,6 @@ gboolean command_history(const Arg *arg);
 gboolean command_bookmark(const Arg *arg);
 gboolean command_eval(const Arg *arg);
 gboolean command_editor(const Arg *arg);
+gboolean command_nextprev(const Arg *arg);
 
 #endif /* end of include guard: _COMMAND_H */
index 2c5ec29..1e010d4 100644 (file)
@@ -85,10 +85,8 @@ const char *default_config[] = {
     "nmap zo=zoomout",
     "nmap zO=zoomoutfull",
     "nmap zz=zoomreset",
-    "cmap <tab>=complete",
-    "cmap <shift-tab>=complete-back",
-    "cmap <ctrl-p>=hint-focus-prev",
-    "cmap <ctrl-n>=hint-focus-next",
+    "cmap <tab>=next",
+    "cmap <shift-tab>=prev",
     "cmap <up>=hist-prev",
     "cmap <down>=hist-next",
     "imap <ctrl-t>=editor",