From 292df41734c9f8ff8624357911dae82c8a611f7d Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Fri, 22 Feb 2013 22:55:16 +0100 Subject: [PATCH] Removed {tab}open-home command. 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 | 13 ++++++------- src/command.c | 17 +++++++---------- src/config.h | 4 ++-- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/doc/vimp.1.txt b/doc/vimp.1.txt index 75aac9d..c4f1187 100644 --- a/doc/vimp.1.txt +++ b/doc/vimp.1.txt @@ -59,14 +59,13 @@ To call it, it has to be bound to a key like "hmap =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. diff --git a/src/command.c b/src/command.c index ecfa688..12e2580 100644 --- a/src/command.c +++ b/src/command.c @@ -28,10 +28,8 @@ 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. */ diff --git a/src/config.h b/src/config.h index 8771316..cbe478c 100644 --- a/src/config.h +++ b/src/config.h @@ -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"}, -- 2.20.1