Removed {tab}open-home command.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 22 Feb 2013 21:55:16 +0000 (22:55 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 22 Feb 2013 21:55:16 +0000 (22:55 +0100)
The featured is done in the open command. If open is called without any url
the configured home page is opened.

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

index 75aac9d..c4f1187 100644 (file)
@@ -59,14 +59,13 @@ To call it, it has to be bound to a key like "hmap <tab>=hint-focus-next" to
 be used.
 .SS Open
 .TP
-.BI open " URI"
-Open the give \fIURI\fP into current window.
+.BI "open [" URI ]
+Open the give \fIURI\fP into current window. If \fIURI\fP is empty the
+configured 'home-page' is opened.
 .TP
-.BI tabopen " URI"
-Open the give \fIURI\fP into a new window.
-.TP
-.B (tab)open-home
-Opens the configured 'home-page'.
+.BI "tabopen [" URI ]
+Open the give \fIURI\fP into a new window. If \fIURI\fP is empty the
+configured 'home-page' is opened.
 .TP
 .B (tab)open-closed
 Open the last closed page.
index ecfa688..12e2580 100644 (file)
 
 static CommandInfo cmd_list[] = {
     /* command              function             arg                                                                                 mode */
-    {"open",                command_open,        {VP_TARGET_CURRENT}},
-    {"tabopen",             command_open,        {VP_TARGET_NEW}},
-    {"open-home",           command_open_home,   {VP_TARGET_CURRENT}},
-    {"tabopen-home",        command_open_home,   {VP_TARGET_NEW}},
+    {"open",                command_open,        {VP_TARGET_CURRENT, ""}},
+    {"tabopen",             command_open,        {VP_TARGET_NEW, ""}},
     {"open-closed",         command_open_closed, {VP_TARGET_CURRENT}},
     {"tabopen-closed",      command_open_closed, {VP_TARGET_NEW}},
     {"input",               command_input,       {0, ":"}},
@@ -140,6 +138,11 @@ gboolean command_open(const Arg* arg)
 {
     char* uri = NULL;
     gboolean result;
+
+    if (!arg->s || arg->s[0] == '\0') {
+        Arg a = {arg->i, vp.config.home_page};
+        return vp_load_uri(&a);
+    }
     /* check for searchengine handles */
     /* split into handle and searchterms */
     char **string = g_strsplit(arg->s, " ", 2);
@@ -159,12 +162,6 @@ gboolean command_open(const Arg* arg)
     return result;
 }
 
-gboolean command_open_home(const Arg* arg)
-{
-    Arg a = {arg->i, vp.config.home_page};
-    return vp_load_uri(&a);
-}
-
 /**
  * Reopens the last closed page.
  */
index 8771316..cbe478c 100644 (file)
@@ -44,8 +44,8 @@ const struct {
     {"nmap t=input :tabopen "},
     {"nmap O=inputuri :open "},
     {"nmap T=inputuri :tabopen "},
-    {"nmap gh=open-home"},
-    {"nmap gH=tabopen-home"},
+    {"nmap gh=open"},
+    {"nmap gH=tabopen"},
     {"nmap u=open-closed"},
     {"nmap U=tabopen-closed"},
     {"nmap d=quit"},