commit 50fd8b267750be705819a7036c7f08a8b4fc5432 from: Omar Polo date: Mon Feb 12 15:51:59 2024 UTC support gopher urls for search; document default-search-engine commit - fd6c540b6faa6c802c92c9e209e2122ca3ddfa92 commit + 50fd8b267750be705819a7036c7f08a8b4fc5432 blob - edc2fb6aa94afa69e4541ababd5321e1966c18f3 blob + 8928556709972b28db62863d0b7aeb0dd403b236 --- cmd.c +++ cmd.c @@ -1150,6 +1150,12 @@ void cmd_search(struct buffer *buffer) { GUARD_RECURSIVE_MINIBUFFER(); + + if (!strncmp(default_search_engine, "gopher://", 9)) { + load_url_in_tab(current_tab, default_search_engine, NULL, + LU_MODE_NOCACHE); + return; + } enter_minibuffer(sensible_self_insert, search_select, exit_minibuffer, NULL, NULL, NULL, 0); blob - 1f3988f96a0fc2d3b96579dbf4e6b4207f3fc159 blob + 13ef23dd6740f1dd87531e4f5ab0be60447b914a --- defaults.c +++ defaults.c @@ -582,6 +582,16 @@ config_setvars(const char *var, char *val) free(default_protocol); default_protocol = val; + return 1; + } + + if (!strcmp(var, "default-search-engine")) { + if (strncmp(val, "gemini://", 9) != 0 && + strncmp(val, "gopher://", 9) != 0) + return 0; + + free(default_search_engine); + default_search_engine = val; return 1; } blob - c94f5d082e90fd040a19fc74becfd104c5fbdfd7 blob + 3e1f8d26129d6a7cf2a0d469a0e95f349d8681c6 --- telescope.1 +++ telescope.1 @@ -330,6 +330,16 @@ Must be a positive number; if zero, don't save closed If true, enable .Ic olivetti-mode Defaults to true. +.It default-search-engine +.Pq string +URL of the preferred search engine, used by the +.Cm search +command. +If it's a Gemini URI, the user query will be appended as query, +replacing it if present. +If it's a Gopher URI, the user query will be sent as gopher search +parameter. +No other URI scheme are allowed. .It Ic tab-bar-show .Pq integer If tab-bar-show is -1 hide the tab bar permanently, if 0 show it