diff options
author | We're Yet <58348703+butwerenotthereyet@users.noreply.github.com> | 2020-01-04 07:34:45 +0000 |
---|---|---|
committer | We're Yet <58348703+butwerenotthereyet@users.noreply.github.com> | 2020-01-04 07:42:05 +0000 |
commit | 3f15e127d2807d6dd49d085eb766987b3cdca767 (patch) | |
tree | 3c35abd44abacaf7a7d855c56a6a8c033e988b39 /main.c | |
parent | Update ChangeLog (diff) | |
download | w3m-3f15e127d2807d6dd49d085eb766987b3cdca767.tar.gz w3m-3f15e127d2807d6dd49d085eb766987b3cdca767.zip |
Add command to go home.
When w3m is launched, if no other options are specified, it attempts to
read HTTP_HOME and WWW_HOME from the environment and upon finding a
value for one of these load the url specified. Once launched, though,
w3m provides no convenience for navigating to the home page.
Here, that ability is added. A new command GOTO_HOME is defined with a
default key binding of C-_.
Diffstat (limited to '')
-rw-r--r-- | main.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -4256,6 +4256,23 @@ DEFUN(goURL, GOTO, "Open specified document in a new buffer") goURL0("Goto URL: ", FALSE); } +DEFUN(goHome, GOTO_HOME, "Open home page in a new buffer") +{ + char *url; + if ((url = getenv("HTTP_HOME")) != NULL || + (url = getenv("WWW_HOME")) != NULL) { + ParsedURL p_url; + Buffer *cur_buf = Currentbuf; + SKIP_BLANKS(url); + url = url_encode(url, NULL, 0); + parseURL2(url, &p_url, NULL); + pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr); + cmd_loadURL(url, NULL, NULL, NULL); + if (Currentbuf != cur_buf) /* success */ + pushHashHist(URLHist, parsedURL2Str(&Currentbuf->currentURL)->ptr); + } +} + DEFUN(gorURL, GOTO_RELATIVE, "Go to relative address") { goURL0("Goto relative URL: ", TRUE); |