Blob


1 .\" Copyright (c) 2021 Omar Polo <op@omarpolo.com>
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
6 .\"
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 .Dd $Mdocdate: March 28 2021$
15 .Dt TELESCOPE 1
16 .Os
17 .Sh NAME
18 .Nm telescope
19 .Nd Gemini client
20 .Sh SYNOPSIS
21 .Nm
22 .Bk -words
23 .Op Fl hn
24 .Op Fl c Pa config
25 .Op Ar URL
26 .Ek
27 .Sh DESCRIPTION
28 .Nm
29 is an interactive browser for the Gemini protocol.
30 It is able to process text/gemini and more in general every text/* file.
31 .Nm
32 also features tabs, bookmarks and out-of-band TOFU verification.
33 .Pp
34 The arguments are as follows:
35 .Bl -tag -width tenletters
36 .It Fl h
37 Display version and usage.
38 .It Fl n
39 Configtest mode.
40 Only check the configuration file for validity.
41 .It Fl c Pa config
42 Specify an alternative configuration file.
43 By default
44 .Pa $HOME/.telescope/config
45 is loaded.
46 .El
47 .Sh TOFU
48 .Nm
49 aims to use the "Trust, but Verify (where appropriate)" approach.
50 The idea is to define three level of verification for a certificate:
51 .Bl -tag -width 12m
52 .It untrusted
53 the server fingerprint does NOT match the stored value
54 .It trusted
55 the server fingerprint matches the store one
56 .It verified
57 the fingerprint matches and has been verified out-of-band
58 .El
59 .Pp
60 Most of the time the
61 .Dq trusted
62 level is enough, but where is appropriate users should be able to
63 verify out-of-band the certificate.
64 .Pp
65 At the moment, there is no built-in support for an out-of-band
66 verification though.
67 .Pp
68 Known certificates are store in
69 .Pa ~/.telescope/known_hosts
70 with a format similar to the
71 .Xr ssh 1 Ns '
72 .Pa known_hosts
73 file.
74 Each line is a record and it's made up by three fields, separated by a
75 single space, according to the following format:
76 .Dq HOST HASH TRUSTED
77 where:
78 .Bl -tag -width 12m
79 .It HOST
80 the hostname, optionally followed by a colon (":") and a port number.
81 .It HASH
82 is the hash of the certificate, as outputted by
83 .Xr tls_peer_cert_hash 3 .
84 .It TRUSTED
85 a single digit.
86 0 means trusted, 1 verified.
87 .El
88 .Sh DEFAULT KEY BINDINGS
89 The default key bindings are very similar to GNU Emacs, but care has
90 been taken to include also bindings familiar for
91 .Xr vi 1
92 and
93 .Dq CUA
94 users.
95 In the following examples, C-x means Control-x, M-x means Meta-x,
96 where the Meta key may be either a special key on the keyboard or the
97 ALT key; otherwise ESC followed by the key X works as well, and C-M-x
98 means to press the key X together with both Control and Meta.
99 .Pp
100 Keys are usually a single character, like
101 .Sq p
102 or
103 .Sq n ,
104 but some special keys are accepted as well.
105 .Pp
106 .Bl -tag -width 16m -offset indent -compact
107 .It <up>
108 Up arrow
109 .It <down>
110 Down arrow
111 .It <left>
112 Left arrow
113 .It <right>
114 Right arrow
115 .It <prior>
116 Previous page/Page up
117 .It <next>
118 Next page/Page down
119 .It <home>
120 Home
121 .It <end>
122 End
123 .It <f0> thru <f63>
124 Function keys
125 .It del or backspace
126 Backspace
127 .It esc
128 Escape
129 .It space or spc
130 Space
131 .It enter or ret
132 Enter
133 .It tab
134 Tab
135 .It backtab
136 Depends on the configuration of the terminal emulator.
137 Usually is shift tab though.
138 .El
139 .Ss GNU Emacs-like keys
140 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
141 .It C-p
142 previous-line
143 .It C-n
144 next-line
145 .It C-f
146 forward-char
147 .It C-b
148 backward-char
149 .It M-{
150 backward-paragraph
151 .It M-}
152 forward-paragraph
153 .It C-a
154 move-beginning-of-line
155 .It C-e
156 move-end-of-line
157 .It M-v, M-space
158 scroll-up
159 .It C-v, space
160 scroll-down
161 .It M-<
162 beginning-of-buffer
163 .It M->
164 end-of-buffer
165 .It C-x C-c
166 kill-telescope
167 .It C-g
168 clear-minibuf
169 .It M-x
170 execute-extended-command
171 .It C-c p
172 previous-heading
173 .It C-c n
174 next-heading
175 .It >
176 load-url
177 .It C-x C-f
178 load-url
179 .It C-x M-f
180 load-current-url
181 .It C-x t 0
182 tab-close
183 .It C-x t 1
184 tab-close-other
185 .It C-x t 2
186 tab-new
187 .It C-x t o
188 tab-next
189 .It C-x t O
190 tab-previous
191 .It C-x t m
192 tab-move
193 .It C-x t M
194 tab-move-to
195 .It C-M-b
196 previous-page
197 .It C-M-f
198 next-page
199 .It <f7> a
200 bookmark-page
201 .It <f7> <f7>
202 list-bookmarks
203 .El
204 .Ss Xr vi 1 Ns -like keys
205 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
206 .It k
207 previous-line
208 .It j
209 next-line
210 .It l
211 forward-char
212 .It h
213 backward-char
214 .It {
215 backward-paragraph
216 .It }
217 forward-paragraph
218 .It ^
219 move-beginning-of-line
220 .It $
221 move-end-of-line
222 .It K
223 scroll-line-up
224 .It J
225 scroll-line-down
226 .It g g
227 beginning-of-buffer
228 .It G
229 end-of-buffer
230 .It g D
231 tab-close
232 .It g N
233 tab-new
234 .It g t
235 tab-next
236 .It g T
237 tab-previous
238 .It g M-t
239 tab-move
240 .It g M-T
241 tab-move-to
242 .It H
243 previous-page
244 .It L
245 next-page
246 .It q
247 kill-telescope
248 .It ESC
249 clear-minibuf
250 .It :
251 execute-extended-command
252 .El
253 .Ss CUA-like keys
254 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
255 .It <up>
256 previous-line
257 .It <down>
258 next-line
259 .It <right>
260 forward-char
261 .It <left>
262 backward-char
263 .It <prior>
264 scroll-up
265 .It <next>
266 scroll-down
267 .It M-<left>
268 previous-page
269 .It M-<right>
270 next-page
271 .El
272 .Ss Neither Emacs nor vi specific
273 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
274 .It <f1>
275 toggle-help
276 .It enter
277 push-button
278 .It M-enter
279 push-button-new-tab
280 .It M-tab
281 previous-button
282 .It backtab
283 previous-button
284 .It tab
285 next-button
286 .El
287 .Ss Minibuffer-specific keys
288 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
289 .It enter
290 mini-complete-and-exit
291 .It C-g
292 mini-abort
293 .It ESC
294 mini-abort
295 .It C-d
296 mini-delete-char
297 .It del
298 mini-delete-backward-char
299 .It backspace
300 mini-delete-backward-char
301 .It C-h
302 mini-delete-backward-char
303 .It C-b
304 backward-char
305 .It C-f
306 forward-char
307 .It <left>
308 backward-char
309 .It <right>
310 forward-char
311 .It C-e
312 move-end-of-line
313 .It C-a
314 move-beginning-of-line
315 .It <end>
316 move-end-of-line
317 .It <home>
318 move-beginning-of-line
319 .It C-k
320 mini-kill-line
321 .It M-p
322 mini-previous-history-element
323 .It M-n
324 mini-next-history-element
325 .It <up>
326 mini-previous-history-element
327 .It <down>
328 mini-next-history-element
329 .El
330 .Sh INTERACTIVE COMMANDS
331 Follows the documentation for the interactive commands.
332 These commands can be bound to a key or executed with
333 .Ic execute-extended-command .
334 .Ss Movement commands
335 .Bl -tag -width execute-extended-command -compact
336 .It Ic backward-char
337 Move point one character backward.
338 .It Ic backward-paragraph
339 Move point one paragraph backward.
340 .It Ic beginning-of-buffer
341 Move point to the beginning of the buffer.
342 .It Ic end-of-buffer
343 Move point to the end of the buffer.
344 .It Ic forward-char
345 Move point one character forward.
346 .It Ic forward-paragraph
347 Move point one paragraph forward.
348 .It Ic move-beginning-of-line
349 Move point at the beginning of the current (visual) line.
350 .It Ic move-end-of-line
351 Move point at the end of the current (visual) line.
352 .It Ic next-button
353 Move point to the next link.
354 .It Ic next-heading
355 Move point to the next heading.
356 .It Ic next-line
357 Move point to the next (visual) line, in the same column if possible.
358 .It Ic previous-button
359 Move point to the previous link.
360 .It Ic previous-heading
361 Move point to the previous heading.
362 .It Ic previous-line
363 Move point to the previous (visual) line.
364 .El
365 .Ss Bookmark-related commands
366 .Bl -tag -width execute-extended-command -compact
367 .It Ic bookmark-page
368 Add a link to the bookmark file.
369 It preloads the minibuffer with the current URL.
370 .It Ic list-bookmarks
371 Load the bookmarks page.
372 .El
373 .Ss Tab-related commands
374 .Bl -tag -width execute-extended-command -compact
375 .It Ic tab-close
376 Close the current tab.
377 .It Ic tab-close-other
378 Close all tabs but the current one.
379 .It Ic tab-move
380 Move the current tab after the next one, wrapping around if
381 needed.
382 .It Ic tab-move-to
383 Move the current tab before the previous one, wrapping around if needed.
384 .It Ic tab-new
385 Open a new tab.
386 .It Ic tab-next
387 Focus next tab, wrapping around eventually.
388 .It Ic tab-previous
389 Focus the previous tab, wrapping around eventually.
390 .El
391 .Ss Misc commands
392 .Bl -tag -width execute-extended-command -compact
393 .It Ic clear-minibuf
394 Clears the echo area.
395 .It Ic execute-extended-command
396 Prompts for a command name using the minibuffer.
397 .It Ic kill-telescope
398 Quit
399 .Nm .
400 .It Ic load-current-url
401 Prompts for an URL, the minibuffer is preloaded with the current
402 one.
403 .It Ic load-url
404 Prompts for an URL.
405 .It Ic next-page
406 Load the next item in the history list.
407 .It Ic olivetti-mode
408 Toggle olivetti mode (i.e. horizontal centering of the lines of the
409 window.)
410 .It Ic previous-page
411 Load the previous item in the history list.
412 .It Ic push-button
413 Follow the link on the current line.
414 .It Ic push-button-new-tab
415 Follow the link on the current line on a new tab.
416 .It Ic redraw
417 Redraw the screen, useful if some background program messed up the
418 display.
419 .It Ic scroll-down
420 Scroll down by one visual page.
421 .It Ic scroll-line-down
422 Scroll down by one line.
423 .It Ic scroll-line-up
424 Scroll up by one line.
425 .It Ic scroll-up
426 Scroll up by one visual page.
427 .It Ic toggle-help
428 Toggle side window with help about available keys and their associated
429 interactive command.
430 .El
431 .Ss Minibuffer commands
432 .Bl -tag -width execute-extended-command -compact
433 .It Ic mini-abort
434 Abort the current minibuffer action.
435 .It Ic mini-complete-and-exit
436 Complete the current minibuffer action.
437 .It Ic mini-delete-backward-char
438 Delete the character before the point.
439 .It Ic mini-delete-char
440 Delete the character after the point.
441 .It Ic mini-kill-line
442 Delete from the point until the end of the line.
443 .It Ic mini-next-history-element
444 Load the previous history element.
445 .It Ic mini-previous-history-element
446 Load the next history element.
447 .El
448 .Ss Aliases
449 The following aliases are available during
450 .Ic execute-extended-command :
451 .Bl -tag -width 16m -compact
452 .It Ic tabn
453 .Ic tab-next
454 .It Ic tabnew
455 .Ic tab-new
456 .It Ic tabp
457 .Ic tab-previous
458 .It Ic q No and Ic wq
459 .Ic kill-telescope
460 .El
461 .Sh CONFIGURATION FILE
462 During the startup,
463 .Nm
464 reads the configuration file at
465 .Pa ~/.telescope/config
466 or the one given with the
467 .Fl c
468 flag.
469 .Pp
470 The format of the configuration file is fairly flexible.
471 The current line can be extended over multiple ones using a
472 backslash
473 .Pq Sq \e .
474 Comments can be put anywhere in the file using a hash mark
475 .Pq Sq # ,
476 and extend to the end of the current line, but backslashes can't be
477 used to extend comments over multiple lines.
478 .Pp
479 The following constructs are available:
480 .Bl -tag -width Ds
481 .It Ic set Ar opt No = Ar val
482 Set the option
483 .Ar opt
484 to the value
485 .Ar val .
486 Valid options are:
487 .Pp
488 .Bl -tag -width twelveletters -compact
489 .It enable-colors
490 .Pq integer
491 If not zero, enable colours.
492 By default is 1 if
493 .Ev NO_COLORS
494 is not set, 0 otherwise.
495 .It fill-column
496 .Pq integer
497 If greater than zero, lines of text will be formatted in a way that
498 don't exceed the given number of columns.
499 By default is 80.
500 .It new-tab-url
501 .Pq string
502 URL for the new tab page.
503 By default is
504 .Dq about:new .
505 .It olivetti-mode
506 .Pq integer
507 Enable
508 .Ic olivetti-mode
509 if non zero.
510 By default is 1.
511 .El
512 .It Ic proxy Ar proto Ic via Ar url
513 Use
514 .Ar url
515 as proxy for all URLs with
516 protocol
517 .Ar proto .
518 .Ar url
519 must be a Gemini URI without path, query and fragment component.
520 .It Ic style Ar name Ar option
521 Change the styling of the element identified by
522 .Ar name .
523 Multiple options may be specified within curly braces.
524 Valid style identifiers are:
525 .Bl -tag -width 14m -compact -offset Ds
526 .It line.text
527 for text lines
528 .It line.link
529 for link lines
530 .It line.title1..3
531 for headings
532 .It line.item
533 for item lines
534 .It line.quote
535 for quotes
536 .It line.pre.start
537 for the heading of a preformatted block
538 .It line.pre
539 for the content of a preformatted block
540 .It line.pre.end
541 for the closing line of a preformatted block
542 .El
543 .Pp
544 Valid options are:
545 .Bl -tag -width Ds
546 .It Ic attr Ar prefix Oo Ar line Oo Ar trail Oc Oc
547 Sets the text attributes.
548 If only one value is given,
549 .Ar line
550 and
551 .Ar trail
552 default to that; if two values are given then
553 .Ar trail
554 defaults to
555 .Ar prefix .
556 Each attribute is a comma-separated list of keywords:
557 .Bl -tag -width underline -compact -offset Ds
558 .It Ic normal
559 no attributes.
560 .It Ic standout
561 best highlighting mode for the terminal.
562 .It Ic underline
563 underlines the text.
564 .It Ic reverse
565 reverses background/foreground colors.
566 .It Ic blink
567 makes the text blinking.
568 .It Ic dim
569 half bright.
570 .It Ic bold
571 extra bright or bold.
572 .El
573 .It Ic bg Ar prefix Oo Ar line Oo Ar trail Oc Oc
574 Sets the background color.
575 Follows the same behaviour as
576 .Ic attr
577 regarding the optional parameters.
578 Supported colors are: default, black, red, green, yellow, blue,
579 magenta, cyan and white
580 .It Ic fg Ar prefix Oo Ar line Oo Ar trail Oc Oc
581 Sets the foreground color.
582 It behaves just like
583 .Ic bg .
584 .It Ic prefix Ar prfx Op Ar cont
585 Sets the prefix for the given line to
586 .Ar prfx
587 and
588 .Ar cont
589 as the prefix for the continuation lines
590 .Pq i.e. when a long line gets wrapped.
591 If
592 .Ar cont
593 is not given its value will be the same of
594 .Ar prfx .
595 .El
596 .El
597 .Sh FILES
598 .Bl -tag -width Ds -compact
599 .It Pa ~/.telescope/bookmarks.gmi
600 Holds the bookmarks.
601 .It Pa ~/.telescope/config
602 Default configuration file.
603 .It Pa ~/.telescope/known_hosts
604 Contains a list of host keys for all the hosts the user has visited.
605 See the TOFU section for more info.
606 .It Pa ~/.telescope/session
607 Contains the list of opened tabs in the last session, one per line.
608 Gets written on
609 .Ic kill-telescope
610 and loaded on startup.
611 .El
612 .Sh EXAMPLES
613 The following is my config file:
614 .Bd -literal -offset indent
615 # ignore the NO_COLOR environment variable
616 set enable-colors = 1
618 style line.item {
619 prefix " • " " "
622 style line.link {
623 prefix "→ " " "
624 fg blue
625 attr normal underline
628 style line.quote {
629 prefix " ┃ "
631 .Ed
632 .Pp
633 It's possible to browse
634 .Dq the small web
635 .Pq i.e. simple websites
636 using programs like the duckling-proxy by defining a proxy in
637 .Pa ~/.telescope/config :
638 .Bd -literal -offset indent
639 proxy http via "gemini://localhost:1965"
640 proxy https via "gemini://localhost:1965"
641 .Ed
642 .Pp
643 To load
644 .Nm
645 without any configuration use
646 .Bd -literal -offset indent
647 telescope -c /dev/null
648 .Ed
649 .Sh AUTHORS
650 .An -nosplit
651 The
652 .Nm
653 program was written by
654 .An Omar Polo Aq Mt op@omarpolo.com .