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 Chnv
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 xxxxxxxxxxxxx
36 .It Fl C , Fl -colors
37 Show all available colors and exit.
38 .It Fl c Pa config
39 Specify an alternative configuration file.
40 By default
41 .Pa $HOME/.telescope/config
42 is loaded.
43 .It Fl h , Fl -help
44 Display version and usage.
45 .It Fl n
46 Configtest mode.
47 Only check the configuration file for validity.
48 .It Fl v , Fl -version
49 Display version.
50 .El
51 .Sh TOFU
52 .Nm
53 aims to use the "Trust, but Verify (where appropriate)" approach.
54 The idea is to define three level of verification for a certificate:
55 .Bl -tag -width 12m
56 .It untrusted
57 the server fingerprint does NOT match the stored value
58 .It trusted
59 the server fingerprint matches the store one
60 .It verified
61 the fingerprint matches and has been verified out-of-band
62 .El
63 .Pp
64 Most of the time the
65 .Dq trusted
66 level is enough, but where is appropriate users should be able to
67 verify out-of-band the certificate.
68 .Pp
69 At the moment, there is no built-in support for an out-of-band
70 verification though.
71 .Pp
72 Known certificates are store in
73 .Pa ~/.telescope/known_hosts
74 with a format similar to the
75 .Xr ssh 1 Ns '
76 .Pa known_hosts
77 file.
78 Each line is a record and it's made up by three fields, separated by a
79 single space, according to the following format:
80 .Dq HOST HASH TRUSTED
81 where:
82 .Bl -tag -width 12m
83 .It HOST
84 the hostname, optionally followed by a colon (":") and a port number.
85 .It HASH
86 is the hash of the certificate, as outputted by
87 .Xr tls_peer_cert_hash 3 .
88 .It TRUSTED
89 a single digit.
90 0 means trusted, 1 verified.
91 .El
92 .Sh DEFAULT KEY BINDINGS
93 The default key bindings are very similar to GNU Emacs, but care has
94 been taken to include also bindings familiar for
95 .Xr vi 1
96 and
97 .Dq CUA
98 users.
99 In the following examples, C-x means Control-x, M-x means Meta-x,
100 where the Meta key may be either a special key on the keyboard or the
101 ALT key; otherwise ESC followed by the key X works as well, and C-M-x
102 means to press the key X together with both Control and Meta.
103 .Pp
104 Keys are usually a single character, like
105 .Sq p
106 or
107 .Sq n ,
108 but some special keys are accepted as well.
109 .Pp
110 .Bl -tag -width 16m -offset indent -compact
111 .It <up>
112 Up arrow
113 .It <down>
114 Down arrow
115 .It <left>
116 Left arrow
117 .It <right>
118 Right arrow
119 .It <prior>
120 Previous page/Page up
121 .It <next>
122 Next page/Page down
123 .It <home>
124 Home
125 .It <end>
126 End
127 .It <f0> thru <f63>
128 Function keys
129 .It del or backspace
130 Backspace
131 .It esc
132 Escape
133 .It space or spc
134 Space
135 .It enter or ret
136 Enter
137 .It tab
138 Tab
139 .It backtab
140 Depends on the configuration of the terminal emulator.
141 Usually is shift tab though.
142 .El
143 .Ss GNU Emacs-like keys
144 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
145 .It C-p
146 previous-line
147 .It C-n
148 next-line
149 .It C-f
150 forward-char
151 .It C-b
152 backward-char
153 .It M-{
154 backward-paragraph
155 .It M-}
156 forward-paragraph
157 .It C-a
158 move-beginning-of-line
159 .It C-e
160 move-end-of-line
161 .It M-v, M-space
162 scroll-up
163 .It C-v, space
164 scroll-down
165 .It M-<
166 beginning-of-buffer
167 .It M->
168 end-of-buffer
169 .It C-x C-c
170 kill-telescope
171 .It C-g
172 clear-minibuf
173 .It M-x
174 execute-extended-command
175 .It C-c {
176 dec-fill-column
177 .It C-c }
178 inc-fill-column
179 .It C-c p
180 previous-heading
181 .It C-c n
182 next-heading
183 .It >
184 load-url
185 .It <
186 load-current-url
187 .It C-x C-f
188 load-url
189 .It C-x M-f
190 load-current-url
191 .It C-x t 0
192 tab-close
193 .It C-x t 1
194 tab-close-other
195 .It C-x t 2
196 tab-new
197 .It C-x t o
198 tab-next
199 .It C-x t O
200 tab-previous
201 .It C-x t m
202 tab-move
203 .It C-x t M
204 tab-move-to
205 .It B, C-M-b
206 previous-page
207 .It F, C-M-f
208 next-page
209 .It <f7> a
210 bookmark-page
211 .It <f7> <f7>
212 list-bookmarks
213 .It C-z
214 suspend-telescope
215 .El
216 .Ss Xr vi 1 Ns -like keys
217 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
218 .It k
219 previous-line
220 .It j
221 next-line
222 .It l
223 forward-char
224 .It h
225 backward-char
226 .It {
227 backward-paragraph
228 .It }
229 forward-paragraph
230 .It ^
231 move-beginning-of-line
232 .It $
233 move-end-of-line
234 .It K
235 scroll-line-up
236 .It J
237 scroll-line-down
238 .It g g
239 beginning-of-buffer
240 .It G
241 end-of-buffer
242 .It g D
243 tab-close
244 .It g N
245 tab-new
246 .It g t
247 tab-next
248 .It g T
249 tab-previous
250 .It g M-t
251 tab-move
252 .It g M-T
253 tab-move-to
254 .It H
255 previous-page
256 .It L
257 next-page
258 .It q
259 kill-telescope
260 .It ESC
261 clear-minibuf
262 .It :
263 execute-extended-command
264 .El
265 .Ss CUA-like keys
266 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
267 .It <up>
268 previous-line
269 .It <down>
270 next-line
271 .It <right>
272 forward-char
273 .It <left>
274 backward-char
275 .It <home>
276 move-beginning-of-line
277 .It <end>
278 move-end-of-line
279 .It <prior>
280 scroll-up
281 .It <next>
282 scroll-down
283 .It C-w
284 tab-close
285 .It C-t
286 tab-new
287 .It M-<prior>
288 tab-previous
289 .It M-<next>
290 tab-next
291 .It M-<left>
292 previous-page
293 .It M-<right>
294 next-page
295 .It <f5>
296 reload-page
297 .It r
298 reload-page
299 .El
300 .Ss Neither Emacs nor vi specific
301 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
302 .It <f1>
303 toggle-help
304 .It enter
305 push-button
306 .It M-enter
307 push-button-new-tab
308 .It M-tab
309 previous-button
310 .It backtab
311 previous-button
312 .It tab
313 next-button
314 .It M-t
315 tab-select
316 .It M-l
317 link-select
318 .It M-/
319 swiper
320 .El
321 .Ss Minibuffer-specific keys
322 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
323 .It enter
324 mini-complete-and-exit
325 .It C-g
326 mini-abort
327 .It ESC
328 mini-abort
329 .It C-d
330 mini-delete-char
331 .It del
332 mini-delete-backward-char
333 .It backspace
334 mini-delete-backward-char
335 .It C-h
336 mini-delete-backward-char
337 .It C-b
338 backward-char
339 .It C-f
340 forward-char
341 .It <left>
342 backward-char
343 .It <right>
344 forward-char
345 .It C-e
346 move-end-of-line
347 .It C-a
348 move-beginning-of-line
349 .It <end>
350 move-end-of-line
351 .It <home>
352 move-beginning-of-line
353 .It C-k
354 mini-kill-line
355 .It M-p
356 mini-previous-history-element
357 .It M-n
358 mini-next-history-element
359 .It C-p
360 previous-completion
361 .It C-n
362 next-completion
363 .It <up>
364 previous-completion
365 .It <down>
366 next-completion
367 .It tab
368 insert-current-candidate
369 .El
370 .Sh INTERACTIVE COMMANDS
371 Follows the documentation for the interactive commands.
372 These commands can be bound to a key or executed with
373 .Ic execute-extended-command .
374 .Ss Movement commands
375 .Bl -tag -width execute-extended-command -compact
376 .It Ic backward-char
377 Move point one character backward.
378 .It Ic backward-paragraph
379 Move point one paragraph backward.
380 .It Ic beginning-of-buffer
381 Move point to the beginning of the buffer.
382 .It Ic end-of-buffer
383 Move point to the end of the buffer.
384 .It Ic forward-char
385 Move point one character forward.
386 .It Ic forward-paragraph
387 Move point one paragraph forward.
388 .It Ic insert-current-candidate
389 Copy the current selection text as minibuffer input.
390 .It Ic move-beginning-of-line
391 Move point at the beginning of the current (visual) line.
392 .It Ic move-end-of-line
393 Move point at the end of the current (visual) line.
394 .It Ic next-button
395 Move point to the next link.
396 .It Ic next-completion
397 Select the next completion.
398 .It Ic next-heading
399 Move point to the next heading.
400 .It Ic next-line
401 Move point to the next (visual) line, in the same column if possible.
402 .It Ic previous-button
403 Move point to the previous link.
404 .It Ic previous-completion
405 Select the previous completion.
406 .It Ic previous-heading
407 Move point to the previous heading.
408 .It Ic previous-line
409 Move point to the previous (visual) line.
410 .El
411 .Ss Bookmark-related commands
412 .Bl -tag -width execute-extended-command -compact
413 .It Ic bookmark-page
414 Add a link to the bookmark file.
415 It preloads the minibuffer with the current URL.
416 .It Ic list-bookmarks
417 Load the bookmarks page.
418 .El
419 .Ss Tab-related commands
420 .Bl -tag -width execute-extended-command -compact
421 .It Ic tab-close
422 Close the current tab.
423 .It Ic tab-close-other
424 Close all tabs but the current one.
425 .It Ic tab-move
426 Move the current tab after the next one, wrapping around if
427 needed.
428 .It Ic tab-move-to
429 Move the current tab before the previous one, wrapping around if needed.
430 .It Ic tab-new
431 Open a new tab.
432 .It Ic tab-next
433 Focus next tab, wrapping around eventually.
434 .It Ic tab-previous
435 Focus the previous tab, wrapping around eventually.
436 .It Ic tab-select
437 Switch to a tab using the minibuffer.
438 .El
439 .Ss Misc commands
440 .Bl -tag -width execute-extended-command -compact
441 .It Ic clear-minibuf
442 Clears the echo area.
443 .It Ic dec-fill-column
444 Decrements fill-column by two.
445 .It Ic execute-extended-command
446 Prompts for a command name using the minibuffer.
447 .It Ic kill-telescope
448 Quit
449 .Nm .
450 .It Ic inc-fill-column
451 Increments fill-column by two.
452 .It Ic link-select
453 Select and visit a link using the minibuffer.
454 .It Ic load-current-url
455 Prompts for an URL, the minibuffer is preloaded with the current
456 one.
457 .It Ic load-url
458 Prompts for an URL.
459 .It Ic next-page
460 Load the next item in the history list.
461 .It Ic olivetti-mode
462 Toggle olivetti mode (i.e. horizontal centering of the lines of the
463 window.)
464 .It Ic previous-page
465 Load the previous item in the history list.
466 .It Ic push-button
467 Follow the link on the current line, or toggle the visibility of the
468 following preformatted block if called when the cursor is on the
469 heading of the block.
470 .It Ic push-button-new-tab
471 Follow the link on the current line on a new tab.
472 .It Ic redraw
473 Redraw the screen, useful if some background program messed up the
474 display.
475 .It Ic reload-page
476 Reload the current page.
477 .It Ic scroll-down
478 Scroll down by one visual page.
479 .It Ic scroll-line-down
480 Scroll down by one line.
481 .It Ic scroll-line-up
482 Scroll up by one line.
483 .It Ic scroll-up
484 Scroll up by one visual page.
485 .It Ic suspend-telescope
486 Suspend the current
487 .Nm
488 session.
489 .It Ic swiper
490 Jump to a line using the minibuffer.
491 .It Ic toc
492 Select and jump to a heading of the page using the minibuffer.
493 .It Ic toggle-help
494 Toggle side window with help about available keys and their associated
495 interactive command.
496 .It Ic toggle-pre-wrap
497 Toggle the wrapping of preformatted blocks.
498 .El
499 .Ss Minibuffer commands
500 .Bl -tag -width execute-extended-command -compact
501 .It Ic mini-abort
502 Abort the current minibuffer action.
503 .It Ic mini-complete-and-exit
504 Complete the current minibuffer action.
505 .It Ic mini-delete-backward-char
506 Delete the character before the point.
507 .It Ic mini-delete-char
508 Delete the character after the point.
509 .It Ic mini-kill-line
510 Delete from the point until the end of the line.
511 .It Ic mini-next-history-element
512 Load the previous history element.
513 .It Ic mini-previous-history-element
514 Load the next history element.
515 .El
516 .Ss Aliases
517 The following aliases are available during
518 .Ic execute-extended-command :
519 .Bl -tag -width 16m -compact
520 .It Ic tabn
521 .Ic tab-next
522 .It Ic tabnew
523 .Ic tab-new
524 .It Ic tabp
525 .Ic tab-previous
526 .It Ic q No and Ic wq
527 .Ic kill-telescope
528 .El
529 .Sh CONFIGURATION FILE
530 During the startup,
531 .Nm
532 reads the configuration file at
533 .Pa ~/.telescope/config
534 or the one given with the
535 .Fl c
536 flag.
537 .Pp
538 .Nm
539 will also load a file called
540 .Pa config-TERM ,
541 where
542 .Dq TERM
543 is the name of the terminal type
544 .Pq i.e. the TERM variable ,
545 if available.
546 .Pp
547 The format of the configuration file is fairly flexible.
548 The current line can be extended over multiple ones using a
549 backslash
550 .Pq Sq \e .
551 Comments can be put anywhere in the file using a hash mark
552 .Pq Sq # ,
553 and extend to the end of the current line, but backslashes can't be
554 used to extend comments over multiple lines.
555 .Pp
556 The following constructs are available:
557 .Bl -tag -width Ds
558 .It Ic bind Ar map Ar key Ar cmd
559 Bind
560 .Ar key
561 to the function
562 .Ar cmd
563 in the keymap
564 .Ar map .
565 Valid values for map are
566 .Dq global-map
567 .Pq i.e. when the user is viewing a page
568 and
569 .Dq minibuffer-map
570 .Pq i.e. when the minibuffer has the focus.
571 .Ar key
572 follows the same syntax described in
573 .Sx DEFAULT KEY BINDINGS
574 and all the possible functions are listed in
575 .Sx INTERACTIVE COMMANDS .
576 .It Ic proxy Ar proto Ic via Ar url
577 Use
578 .Ar url
579 as proxy for all URLs with
580 protocol
581 .Ar proto .
582 .Ar url
583 must be a Gemini URI without path, query and fragment component.
584 .It Ic set Ar opt No = Ar val
585 Set the option
586 .Ar opt
587 to the value
588 .Ar val .
589 Valid options are:
590 .Pp
591 .Bl -tag -width twelveletters -compact
592 .It dont-wrap-pre
593 .Pq integer
594 If nonzero, don't wrap preformatted blocks.
595 .It emojify-link
596 .Pq integer
597 If not zero, when the text of a link starts with an emoji followed by
598 a space, use that emoji as line prefix.
599 Defaults to 1.
600 .It enable-colors
601 .Pq integer
602 If not zero, enable colours.
603 By default is 1 if
604 .Ev NO_COLORS
605 is not set, 0 otherwise.
606 .It fill-column
607 .Pq integer
608 If greater than zero, lines of text will be formatted in a way that
609 don't exceed the given number of columns.
610 By default is 80.
611 .It hide-pre-blocks
612 .Pq integer
613 If nonzero, hide by default the body of the preformatted blocks.
614 By default is zero.
615 .Ic push-button
616 can be used to toggle the visibility per-block.
617 .It hide-pre-closing-line
618 .Pq integer
619 If nonzero, hide the closing line of preformatted blocks.
620 .It hide-pre-context
621 .Pq integer
622 If nonzero, hide the start and end line of the preformatted blocks.
623 If both hide-pre-context and hide-pre-blocks are nonzero, preformatted
624 blocks are irremediably hidden.
625 By default is zero.
626 .It new-tab-url
627 .Pq string
628 URL for the new tab page.
629 By default is
630 .Dq about:new .
631 .It olivetti-mode
632 .Pq integer
633 Enable
634 .Ic olivetti-mode
635 if non zero.
636 By default is 1.
637 .El
638 .It Ic style Ar name Ar option
639 Change the styling of the element identified by
640 .Ar name .
641 Multiple options may be specified within curly braces.
642 Valid style identifiers are:
643 .Bl -tag -width 16m -compact -offset Ds
644 .It line
645 for the area outside the lines in the body of the page.
646 .It line.compl
647 for the completion in the minibuffer
648 .It line.compl.current
649 for the current completion
650 .It line.text
651 for text lines.
652 .It line.link
653 for link lines.
654 .It line.title1..3
655 for headings
656 .It line.item
657 for item lines.
658 .It line.quote
659 for quotes.
660 .It line.pre.start
661 for the heading of a preformatted block.
662 .It line.pre
663 for the content of a preformatted block.
664 .It line.pre.end
665 for the closing line of a preformatted block.
666 .It minibuffer
667 for the minibuffer
668 .Dq i.e. the last line of the window
669 .It modeline
670 for the modeline
671 .Dq i.e. the info line right above the minibuffer
672 .It tabline
673 for the tabline.
674 .It tabline.tab
675 for the non-focused tabs.
676 .It tabline.current
677 for the focused tab.
678 .El
679 .Pp
680 Valid options are:
681 .Bl -tag -width Ds
682 .It Ic attr Ar prefix Oo Ar line Oo Ar trail Oc Oc
683 Sets the text attributes.
684 If only one value is given,
685 .Ar line
686 and
687 .Ar trail
688 default to that; if two values are given then
689 .Ar trail
690 defaults to
691 .Ar prefix .
692 Each attribute is a comma-separated list of keywords:
693 .Bl -tag -width underline -compact -offset Ds
694 .It Ic normal
695 no attributes.
696 .It Ic standout
697 best highlighting mode for the terminal.
698 .It Ic underline
699 underlines the text.
700 .It Ic reverse
701 reverses background/foreground colors.
702 .It Ic blink
703 makes the text blinking.
704 .It Ic dim
705 half bright.
706 .It Ic bold
707 extra bright or bold.
708 .El
709 .Pp
710 Only the styles under the
711 .Dq line.
712 prefix accept up to three attributes.
713 The other will only use the first one given.
714 .It Ic bg Ar prefix Oo Ar line Oo Ar trail Oc Oc
715 Sets the background color.
716 Follows the same behaviour as
717 .Ic attr
718 regarding the optional parameters.
719 The colour is one of black, red, green, yellow, blue,
720 magenta, cyan and white; colour0 to colour255
721 .Pq or color0 to color255
722 from the 256-colour set;
723 default for the default colour.
724 .It Ic fg Ar prefix Oo Ar line Oo Ar trail Oc Oc
725 Sets the foreground color.
726 It behaves just like
727 .Ic bg .
728 .It Ic prefix Ar prfx Op Ar cont
729 Sets the prefix for the current line type to
730 .Ar prfx
731 and
732 .Ar cont
733 as the prefix for the continuation lines
734 .Pq i.e. when a long line gets wrapped.
735 If
736 .Ar cont
737 is not given its value will be the same of
738 .Ar prfx .
739 .El
740 .El
741 .Sh FILES
742 .Bl -tag -width Ds -compact
743 .It Pa ~/.telescope/bookmarks.gmi
744 Holds the bookmarks.
745 .It Pa ~/.telescope/config
746 Default configuration file.
747 .It Pa ~/.telescope/known_hosts
748 Contains a list of host keys for all the hosts the user has visited.
749 See the TOFU section for more info.
750 .It Pa ~/.telescope/lock
751 Lock file used to prevent multiple instance of
752 .Nm
753 from running at the same time.
754 .It Pa ~/.telescope/session
755 Contains the list of opened tabs in the last session, one per line.
756 Gets written on
757 .Ic kill-telescope
758 and loaded on startup.
759 .El
760 .Sh EXAMPLES
761 The following is my config file:
762 .Bd -literal -offset indent
763 # enable colors regardless of $NO_COLOR
764 set enable-colors = 1
766 style line.item {
767 prefix " • " " "
770 style line.link {
771 prefix "→ " " "
774 style line.quote {
775 prefix " ┃ "
777 .Ed
778 .Pp
779 It's possible to browse
780 .Dq the small web
781 .Pq i.e. simple websites
782 by using programs like the duckling-proxy by defining a proxy in
783 .Pa ~/.telescope/config :
784 .Bd -literal -offset indent
785 proxy http via "gemini://localhost:1965"
786 proxy https via "gemini://localhost:1965"
787 .Ed
788 .Pp
789 To load
790 .Nm
791 without any configuration use
792 .Bd -literal -offset indent
793 telescope -c /dev/null
794 .Ed
795 .Sh AUTHORS
796 .An -nosplit
797 The
798 .Nm
799 program was written by
800 .An Omar Polo Aq Mt op@omarpolo.com .