Added support of read only registers ":, "/ and "%.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 30 May 2014 21:52:32 +0000 (23:52 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 30 May 2014 22:06:59 +0000 (00:06 +0200)
doc/vimb.1
src/command.c
src/ex.c
src/main.c
src/main.h
src/normal.c

index 296c5db..d72d4c9 100644 (file)
@@ -357,8 +357,9 @@ Moves the cursor after the char in inputbox.
 .B CTRL\-V
 Pass the next key press directly to gtk.
 .TP
-.B CTRL\-R {0-9a-z}
-Insert the content of given buffer at cursor position.
+.B CTRL\-R {a-z%:/}
+Insert the content of given buffer at cursor position. See also section
+REGISTERS.
 .SS Command Line History
 .TP
 .B <Tab>
@@ -580,6 +581,20 @@ Open configured editor with content of current form field.
 .TP
 .B CTRL\-Z
 Enter the pass-through mode.
+.SH REGISTERS
+There are different types of registers.
+.TP
+.BR \[char34]a " - " \[char34]z
+26 named registers "a to "z. Vimb fills these registers only when you say so.
+.TP
+.B \[char34]%
+Contains the curent opened URI.
+.TP
+.B \[char34]:
+Contains the most recent executed ex command.
+.TP
+.B \[char34]/
+Contains the most recent search-pattern.
 .SH COMPLETIONS
 The completions are triggered by pressing `<Tab>` or `<shift-tab>` in the
 activated inputbox. Depending of the current inserted content different
index de32cbb..4de2279 100644 (file)
@@ -96,7 +96,9 @@ gboolean command_yank(const Arg *arg, char buf)
         }
         if (text) {
             /* put the text into the yank buffer */
-            vb_register_add(buf, text);
+            if (strchr(VB_USER_REG, buf)) {
+                vb_register_add(buf, text);
+            }
             vb_echo(VB_MSG_NORMAL, false, tmpl, text);
             g_free(text);
 
@@ -117,7 +119,9 @@ gboolean command_yank(const Arg *arg, char buf)
     if (a.s) {
         /* put the text into the yank buffer */
         vb_set_clipboard(&a);
-        vb_register_add(buf, a.s);
+        if (strchr(VB_USER_REG, buf)) {
+            vb_register_add(buf, a.s);
+        }
         vb_echo(VB_MSG_NORMAL, false, tmpl, a.s);
 
         return true;
index 5cc44b6..243c069 100644 (file)
--- a/src/ex.c
+++ b/src/ex.c
@@ -427,9 +427,10 @@ static void input_activate(void)
     switch (*text) {
         case '/': count = 1; /* fall through */
         case '?':
-            history_add(HISTORY_SEARCH, cmd, NULL);
             mode_enter('n');
             command_search(&((Arg){count, cmd}));
+            vb_register_add('/', cmd);
+            history_add(HISTORY_SEARCH, cmd, NULL);
             break;
 
         case ';': /* fall through */
@@ -438,9 +439,10 @@ static void input_activate(void)
             break;
 
         case ':':
-            history_add(HISTORY_COMMAND, cmd, NULL);
             mode_enter('n');
             ex_run_string(cmd);
+            vb_register_add(':', cmd);
+            history_add(HISTORY_COMMAND, cmd, NULL);
             break;
 
     }
index 6efbb51..9dfb702 100644 (file)
@@ -513,6 +513,8 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec)
 
             vb_update_statusbar();
             vb_update_urlbar(uri);
+            /* save the current URI in register % */
+            vb_register_add('%', uri);
 
             /* clear possible set marks */
             marks_clear();
index e9fd42e..690e30b 100644 (file)
 #define VB_MARK_TICK    0
 #define VB_MARK_SIZE    (sizeof(VB_MARK_CHARS) - 1)
 
-#define VB_REG_CHARS    "0123456789abcdefghijklmnopqrstuvwxyz"
+#define VB_USER_REG     "abcdefghijklmnopqrstuvwxyz"
+#define VB_REG_CHARS    VB_USER_REG "%:/"
 #define VB_REG_SIZE     (sizeof(VB_REG_CHARS) - 1)
 
 /* enums */
index efaf469..52e140b 100644 (file)
@@ -270,7 +270,7 @@ VbResult normal_keypress(int key)
     } else if ((char)key == '"') {
         info.phase      = PHASE_CUTBUF;
         vb.mode->flags |= FLAG_NOMAP;
-    } else if (info.phase ==  PHASE_CUTBUF) {
+    } else if (info.phase ==  PHASE_CUTBUF && strchr(VB_REG_CHARS, (char)key)) {
         info.cutbuf = (char)key;
         info.phase  = PHASE_START;
     } else {