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 {
172 dec-fill-column
173 .It C-c }
174 inc-fill-column
175 .It C-c p
176 previous-heading
177 .It C-c n
178 next-heading
179 .It >
180 load-url
181 .It C-x C-f
182 load-url
183 .It C-x M-f
184 load-current-url
185 .It C-x t 0
186 tab-close
187 .It C-x t 1
188 tab-close-other
189 .It C-x t 2
190 tab-new
191 .It C-x t o
192 tab-next
193 .It C-x t O
194 tab-previous
195 .It C-x t m
196 tab-move
197 .It C-x t M
198 tab-move-to
199 .It C-M-b
200 previous-page
201 .It C-M-f
202 next-page
203 .It <f7> a
204 bookmark-page
205 .It <f7> <f7>
206 list-bookmarks
207 .El
208 .Ss Xr vi 1 Ns -like keys
209 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
210 .It k
211 previous-line
212 .It j
213 next-line
214 .It l
215 forward-char
216 .It h
217 backward-char
218 .It {
219 backward-paragraph
220 .It }
221 forward-paragraph
222 .It ^
223 move-beginning-of-line
224 .It $
225 move-end-of-line
226 .It K
227 scroll-line-up
228 .It J
229 scroll-line-down
230 .It g g
231 beginning-of-buffer
232 .It G
233 end-of-buffer
234 .It g D
235 tab-close
236 .It g N
237 tab-new
238 .It g t
239 tab-next
240 .It g T
241 tab-previous
242 .It g M-t
243 tab-move
244 .It g M-T
245 tab-move-to
246 .It H
247 previous-page
248 .It L
249 next-page
250 .It q
251 kill-telescope
252 .It ESC
253 clear-minibuf
254 .It :
255 execute-extended-command
256 .El
257 .Ss CUA-like keys
258 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
259 .It <up>
260 previous-line
261 .It <down>
262 next-line
263 .It <right>
264 forward-char
265 .It <left>
266 backward-char
267 .It <prior>
268 scroll-up
269 .It <next>
270 scroll-down
271 .It C-t
272 tab-new
273 .It M-<prior>
274 tab-previous
275 .It M-<next>
276 tab-next
277 .It M-<left>
278 previous-page
279 .It M-<right>
280 next-page
281 .El
282 .Ss Neither Emacs nor vi specific
283 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
284 .It <f1>
285 toggle-help
286 .It enter
287 push-button
288 .It M-enter
289 push-button-new-tab
290 .It M-tab
291 previous-button
292 .It backtab
293 previous-button
294 .It tab
295 next-button
296 .El
297 .Ss Minibuffer-specific keys
298 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
299 .It enter
300 mini-complete-and-exit
301 .It C-g
302 mini-abort
303 .It ESC
304 mini-abort
305 .It C-d
306 mini-delete-char
307 .It del
308 mini-delete-backward-char
309 .It backspace
310 mini-delete-backward-char
311 .It C-h
312 mini-delete-backward-char
313 .It C-b
314 backward-char
315 .It C-f
316 forward-char
317 .It <left>
318 backward-char
319 .It <right>
320 forward-char
321 .It C-e
322 move-end-of-line
323 .It C-a
324 move-beginning-of-line
325 .It <end>
326 move-end-of-line
327 .It <home>
328 move-beginning-of-line
329 .It C-k
330 mini-kill-line
331 .It M-p
332 mini-previous-history-element
333 .It M-n
334 mini-next-history-element
335 .It <up>
336 mini-previous-history-element
337 .It <down>
338 mini-next-history-element
339 .El
340 .Sh INTERACTIVE COMMANDS
341 Follows the documentation for the interactive commands.
342 These commands can be bound to a key or executed with
343 .Ic execute-extended-command .
344 .Ss Movement commands
345 .Bl -tag -width execute-extended-command -compact
346 .It Ic backward-char
347 Move point one character backward.
348 .It Ic backward-paragraph
349 Move point one paragraph backward.
350 .It Ic beginning-of-buffer
351 Move point to the beginning of the buffer.
352 .It Ic end-of-buffer
353 Move point to the end of the buffer.
354 .It Ic forward-char
355 Move point one character forward.
356 .It Ic forward-paragraph
357 Move point one paragraph forward.
358 .It Ic move-beginning-of-line
359 Move point at the beginning of the current (visual) line.
360 .It Ic move-end-of-line
361 Move point at the end of the current (visual) line.
362 .It Ic next-button
363 Move point to the next link.
364 .It Ic next-heading
365 Move point to the next heading.
366 .It Ic next-line
367 Move point to the next (visual) line, in the same column if possible.
368 .It Ic previous-button
369 Move point to the previous link.
370 .It Ic previous-heading
371 Move point to the previous heading.
372 .It Ic previous-line
373 Move point to the previous (visual) line.
374 .El
375 .Ss Bookmark-related commands
376 .Bl -tag -width execute-extended-command -compact
377 .It Ic bookmark-page
378 Add a link to the bookmark file.
379 It preloads the minibuffer with the current URL.
380 .It Ic list-bookmarks
381 Load the bookmarks page.
382 .El
383 .Ss Tab-related commands
384 .Bl -tag -width execute-extended-command -compact
385 .It Ic tab-close
386 Close the current tab.
387 .It Ic tab-close-other
388 Close all tabs but the current one.
389 .It Ic tab-move
390 Move the current tab after the next one, wrapping around if
391 needed.
392 .It Ic tab-move-to
393 Move the current tab before the previous one, wrapping around if needed.
394 .It Ic tab-new
395 Open a new tab.
396 .It Ic tab-next
397 Focus next tab, wrapping around eventually.
398 .It Ic tab-previous
399 Focus the previous tab, wrapping around eventually.
400 .El
401 .Ss Misc commands
402 .Bl -tag -width execute-extended-command -compact
403 .It Ic clear-minibuf
404 Clears the echo area.
405 .It Ic dec-fill-column
406 Decrements fill-column by two.
407 .It Ic execute-extended-command
408 Prompts for a command name using the minibuffer.
409 .It Ic kill-telescope
410 Quit
411 .Nm .
412 .It Ic inc-fill-column
413 Increments fill-column by two.
414 .It Ic load-current-url
415 Prompts for an URL, the minibuffer is preloaded with the current
416 one.
417 .It Ic load-url
418 Prompts for an URL.
419 .It Ic next-page
420 Load the next item in the history list.
421 .It Ic olivetti-mode
422 Toggle olivetti mode (i.e. horizontal centering of the lines of the
423 window.)
424 .It Ic previous-page
425 Load the previous item in the history list.
426 .It Ic push-button
427 Follow the link on the current line, or toggle the visibility of the
428 following preformatted block if called when the cursor is on the
429 heading of the block.
430 .It Ic push-button-new-tab
431 Follow the link on the current line on a new tab.
432 .It Ic redraw
433 Redraw the screen, useful if some background program messed up the
434 display.
435 .It Ic scroll-down
436 Scroll down by one visual page.
437 .It Ic scroll-line-down
438 Scroll down by one line.
439 .It Ic scroll-line-up
440 Scroll up by one line.
441 .It Ic scroll-up
442 Scroll up by one visual page.
443 .It Ic toggle-help
444 Toggle side window with help about available keys and their associated
445 interactive command.
446 .El
447 .Ss Minibuffer commands
448 .Bl -tag -width execute-extended-command -compact
449 .It Ic mini-abort
450 Abort the current minibuffer action.
451 .It Ic mini-complete-and-exit
452 Complete the current minibuffer action.
453 .It Ic mini-delete-backward-char
454 Delete the character before the point.
455 .It Ic mini-delete-char
456 Delete the character after the point.
457 .It Ic mini-kill-line
458 Delete from the point until the end of the line.
459 .It Ic mini-next-history-element
460 Load the previous history element.
461 .It Ic mini-previous-history-element
462 Load the next history element.
463 .El
464 .Ss Aliases
465 The following aliases are available during
466 .Ic execute-extended-command :
467 .Bl -tag -width 16m -compact
468 .It Ic tabn
469 .Ic tab-next
470 .It Ic tabnew
471 .Ic tab-new
472 .It Ic tabp
473 .Ic tab-previous
474 .It Ic q No and Ic wq
475 .Ic kill-telescope
476 .El
477 .Sh CONFIGURATION FILE
478 During the startup,
479 .Nm
480 reads the configuration file at
481 .Pa ~/.telescope/config
482 or the one given with the
483 .Fl c
484 flag.
485 .Pp
486 The format of the configuration file is fairly flexible.
487 The current line can be extended over multiple ones using a
488 backslash
489 .Pq Sq \e .
490 Comments can be put anywhere in the file using a hash mark
491 .Pq Sq # ,
492 and extend to the end of the current line, but backslashes can't be
493 used to extend comments over multiple lines.
494 .Pp
495 The following constructs are available:
496 .Bl -tag -width Ds
497 .It Ic bind Ar map Ar key Ar cmd
498 Bind
499 .Ar key
500 to the function
501 .Ar cmd
502 in the keymap
503 .Ar map .
504 Valid values for map are
505 .Dq global-map
506 .Pq i.e. when the user is viewing a page
507 and
508 .Dq minibuffer-map
509 .Pq i.e. when the minibuffer has the focus.
510 .Ar key
511 follows the same syntax described in
512 .Sx DEFAULT KEY BINDINGS
513 and all the possible functions are listed in
514 .Sx INTERACTIVE COMMANDS .
515 .It Ic proxy Ar proto Ic via Ar url
516 Use
517 .Ar url
518 as proxy for all URLs with
519 protocol
520 .Ar proto .
521 .Ar url
522 must be a Gemini URI without path, query and fragment component.
523 .It Ic set Ar opt No = Ar val
524 Set the option
525 .Ar opt
526 to the value
527 .Ar val .
528 Valid options are:
529 .Pp
530 .Bl -tag -width twelveletters -compact
531 .It enable-colors
532 .Pq integer
533 If not zero, enable colours.
534 By default is 1 if
535 .Ev NO_COLORS
536 is not set, 0 otherwise.
537 .It fill-column
538 .Pq integer
539 If greater than zero, lines of text will be formatted in a way that
540 don't exceed the given number of columns.
541 By default is 80.
542 .It hide-pre-blocks
543 .Pq integer
544 If nonzero, hide by default the body of the preformatted blocks.
545 By default is zero.
546 .Ic push-button
547 can be used to toggle the visibility per-block.
548 .It hide-pre-context
549 .Pq integer
550 If nonzero, hide the start and end line of the preformatted blocks.
551 If both hide-pre-context and hide-pre-blocks are nonzero, preformatted
552 blocks are irremediably hidden.
553 By default is zero.
554 .It new-tab-url
555 .Pq string
556 URL for the new tab page.
557 By default is
558 .Dq about:new .
559 .It olivetti-mode
560 .Pq integer
561 Enable
562 .Ic olivetti-mode
563 if non zero.
564 By default is 1.
565 .El
566 .It Ic style Ar name Ar option
567 Change the styling of the element identified by
568 .Ar name .
569 Multiple options may be specified within curly braces.
570 Valid style identifiers are:
571 .Bl -tag -width 16m -compact -offset Ds
572 .It line
573 for the area outside the lines in the body of the page.
574 .It line.text
575 for text lines.
576 .It line.link
577 for link lines.
578 .It line.title1..3
579 for headingse
580 .It line.item
581 for item lines.
582 .It line.quote
583 for quotes.
584 .It line.pre.start
585 for the heading of a preformatted block.
586 .It line.pre
587 for the content of a preformatted block.
588 .It line.pre.end
589 for the closing line of a preformatted block.
590 .It minibuffer
591 for the minibuffer
592 .Dq i.e. the last line of the window
593 .It modeline
594 for the modeline
595 .Dq i.e. the info line right above the minibuffer
596 .It tabline
597 for the tabline.
598 .It tabline.tab
599 for the non-focused tabs.
600 .It tabline.current
601 for the focused tab.
602 .El
603 .Pp
604 Valid options are:
605 .Bl -tag -width Ds
606 .It Ic attr Ar prefix Oo Ar line Oo Ar trail Oc Oc
607 Sets the text attributes.
608 If only one value is given,
609 .Ar line
610 and
611 .Ar trail
612 default to that; if two values are given then
613 .Ar trail
614 defaults to
615 .Ar prefix .
616 Each attribute is a comma-separated list of keywords:
617 .Bl -tag -width underline -compact -offset Ds
618 .It Ic normal
619 no attributes.
620 .It Ic standout
621 best highlighting mode for the terminal.
622 .It Ic underline
623 underlines the text.
624 .It Ic reverse
625 reverses background/foreground colors.
626 .It Ic blink
627 makes the text blinking.
628 .It Ic dim
629 half bright.
630 .It Ic bold
631 extra bright or bold.
632 .El
633 .Pp
634 Only the styles under the
635 .Dq line.
636 prefix accept up to three attributes.
637 The other will only use the first one given.
638 .It Ic bg Ar prefix Oo Ar line Oo Ar trail Oc Oc
639 Sets the background color.
640 Follows the same behaviour as
641 .Ic attr
642 regarding the optional parameters.
643 The colour is one of black, red, green, yellow, blue,
644 magenta, cyan and white; colour0 to colour255
645 .Pq or color0 to color255
646 from the 256-colour set;
647 default for the default colour.
648 .It Ic fg Ar prefix Oo Ar line Oo Ar trail Oc Oc
649 Sets the foreground color.
650 It behaves just like
651 .Ic bg .
652 .It Ic prefix Ar prfx Op Ar cont
653 Sets the prefix for the current line type to
654 .Ar prfx
655 and
656 .Ar cont
657 as the prefix for the continuation lines
658 .Pq i.e. when a long line gets wrapped.
659 If
660 .Ar cont
661 is not given its value will be the same of
662 .Ar prfx .
663 .El
664 .El
665 .Sh FILES
666 .Bl -tag -width Ds -compact
667 .It Pa ~/.telescope/bookmarks.gmi
668 Holds the bookmarks.
669 .It Pa ~/.telescope/config
670 Default configuration file.
671 .It Pa ~/.telescope/known_hosts
672 Contains a list of host keys for all the hosts the user has visited.
673 See the TOFU section for more info.
674 .It Pa ~/.telescope/session
675 Contains the list of opened tabs in the last session, one per line.
676 Gets written on
677 .Ic kill-telescope
678 and loaded on startup.
679 .El
680 .Sh EXAMPLES
681 The following is my config file:
682 .Bd -literal -offset indent
683 # enable colors regardless of $NO_COLOR
684 set enable-colors = 1
686 style line.item {
687 prefix " • " " "
690 style line.link {
691 prefix "→ " " "
694 style line.quote {
695 prefix " ┃ "
697 .Ed
698 .Pp
699 It's possible to browse
700 .Dq the small web
701 .Pq i.e. simple websites
702 by using programs like the duckling-proxy by defining a proxy in
703 .Pa ~/.telescope/config :
704 .Bd -literal -offset indent
705 proxy http via "gemini://localhost:1965"
706 proxy https via "gemini://localhost:1965"
707 .Ed
708 .Pp
709 To load
710 .Nm
711 without any configuration use
712 .Bd -literal -offset indent
713 telescope -c /dev/null
714 .Ed
715 .Sh AUTHORS
716 .An -nosplit
717 The
718 .Nm
719 program was written by
720 .An Omar Polo Aq Mt op@omarpolo.com .