Commit Diff


commit - 1a99965e859a4469e44e826fe9a441db1774b021
commit + db7cc27a493175cc7a9fbabb072245257200b278
blob - c86e00fa41c8d798bc329bf39bbcd8873cd03e74
blob + cc356cac157231e9db7a71c8fdae21dc0900fbb9
--- ChangeLog
+++ ChangeLog
@@ -1,6 +1,7 @@
 2021-06-19  Omar Polo  <op@omarpolo.com>
 
 	* defaults.c (config_setvari): add fill-column config to manage the max-width when filling the page.
+	(config_setvars): add new-tab-url config to specify the default url for new tabs.
 
 2021-06-18  Omar Polo  <op@omarpolo.com>
 
blob - f94ecba2d71f73b289479fe456e200f3fafe4530
blob + 545355ce305ae31951d0f567dfa7458c9e3c1300
--- defaults.c
+++ defaults.c
@@ -18,8 +18,10 @@
 
 #include <curses.h>
 #include <limits.h>
+#include <stdlib.h>
 #include <string.h>
 
+char *new_tab_url = NULL;
 int fill_column = INT_MAX;
 
 struct lineprefix line_prefixes[] = {
@@ -118,5 +120,11 @@ config_setvari(const char *var, int val)
 int
 config_setvars(const char *var, char *val)
 {
-	return 0;
+	if (!strcmp(var, "new-tab-url")) {
+		if (new_tab_url != NULL)
+			free(new_tab_url);
+		new_tab_url = val;
+	} else
+		return 0;
+	return 1;
 }
blob - 259171e405997f00029ac07a2900cf7c499ee1d1
blob + 1d2b3c2a1670836331646ff356b0308ead265cf6
--- telescope.h
+++ telescope.h
@@ -58,7 +58,8 @@ enum imsg_type {
 	IMSG_SESSION_END,
 };
 
-extern int fill_column;
+extern char	*new_tab_url;
+extern int	 fill_column;
 
 struct lineprefix {
 	const char	*prfx1;
blob - 7e0e6b38e253bc4ecf389f448588f0e96cd19cff
blob + ca480f95f4709c7ea8e9873866bd689ffc199b00
--- ui.c
+++ ui.c
@@ -680,7 +680,12 @@ cmd_tab_close_other(struct buffer *buffer)
 void
 cmd_tab_new(struct buffer *buffer)
 {
-	new_tab(NEW_TAB_URL);
+	const char *url;
+
+	if ((url = new_tab_url) == NULL)
+		url = NEW_TAB_URL;
+
+	new_tab(url);
 }
 
 void