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 [
317 tab-previous
318 .It ]
319 tab-next
320 .It M-l
321 link-select
322 .It M-/
323 swiper
324 .El
325 .Ss Minibuffer-specific keys
326 .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
327 .It enter
328 mini-complete-and-exit
329 .It C-g
330 mini-abort
331 .It ESC
332 mini-abort
333 .It C-d
334 mini-delete-char
335 .It del
336 mini-delete-backward-char
337 .It backspace
338 mini-delete-backward-char
339 .It C-h
340 mini-delete-backward-char
341 .It C-b
342 backward-char
343 .It C-f
344 forward-char
345 .It <left>
346 backward-char
347 .It <right>
348 forward-char
349 .It C-e
350 move-end-of-line
351 .It C-a
352 move-beginning-of-line
353 .It <end>
354 move-end-of-line
355 .It <home>
356 move-beginning-of-line
357 .It C-k
358 mini-kill-line
359 .It M-p
360 mini-previous-history-element
361 .It M-n
362 mini-next-history-element
363 .It C-p
364 previous-completion
365 .It C-n
366 next-completion
367 .It <up>
368 previous-completion
369 .It <down>
370 next-completion
371 .It tab
372 insert-current-candidate
373 .El
374 .Sh INTERACTIVE COMMANDS
375 Follows the documentation for the interactive commands.
376 These commands can be bound to a key or executed with
377 .Ic execute-extended-command .
378 .Ss Movement commands
379 .Bl -tag -width execute-extended-command -compact
380 .It Ic backward-char
381 Move point one character backward.
382 .It Ic backward-paragraph
383 Move point one paragraph backward.
384 .It Ic beginning-of-buffer
385 Move point to the beginning of the buffer.
386 .It Ic end-of-buffer
387 Move point to the end of the buffer.
388 .It Ic forward-char
389 Move point one character forward.
390 .It Ic forward-paragraph
391 Move point one paragraph forward.
392 .It Ic insert-current-candidate
393 Copy the current selection text as minibuffer input.
394 .It Ic move-beginning-of-line
395 Move point at the beginning of the current (visual) line.
396 .It Ic move-end-of-line
397 Move point at the end of the current (visual) line.
398 .It Ic next-button
399 Move point to the next link.
400 .It Ic next-completion
401 Select the next completion.
402 .It Ic next-heading
403 Move point to the next heading.
404 .It Ic next-line
405 Move point to the next (visual) line, in the same column if possible.
406 .It Ic previous-button
407 Move point to the previous link.
408 .It Ic previous-completion
409 Select the previous completion.
410 .It Ic previous-heading
411 Move point to the previous heading.
412 .It Ic previous-line
413 Move point to the previous (visual) line.
414 .El
415 .Ss Bookmark-related commands
416 .Bl -tag -width execute-extended-command -compact
417 .It Ic bookmark-page
418 Save a page in the bookmark file.
419 It preloads the minibuffer with the current URL.
420 .It Ic list-bookmarks
421 Load the bookmarks page.
422 .El
423 .Ss Tab-related commands
424 .Bl -tag -width execute-extended-command -compact
425 .It Ic tab-close
426 Close the current tab.
427 .It Ic tab-close-other
428 Close all tabs but the current one.
429 .It Ic tab-move
430 Move the current tab after the next one, wrapping around if
431 needed.
432 .It Ic tab-move-to
433 Move the current tab before the previous one, wrapping around if needed.
434 .It Ic tab-new
435 Open a new tab.
436 .It Ic tab-next
437 Focus next tab, wrapping around eventually.
438 .It Ic tab-previous
439 Focus the previous tab, wrapping around eventually.
440 .It Ic tab-select
441 Switch to a tab using the minibuffer.
442 .El
443 .Ss Misc commands
444 .Bl -tag -width execute-extended-command -compact
445 .It Ic clear-minibuf
446 Clear the echo area.
447 .It Ic dec-fill-column
448 Decrement fill-column by two.
449 .It Ic execute-extended-command
450 Execute an internal command.
451 .It Ic kill-telescope
452 Quit
453 .Nm .
454 .It Ic inc-fill-column
455 Increment fill-column by two.
456 .It Ic link-select
457 Select and visit a link using the minibuffer.
458 .It Ic load-current-url
459 Edit the current URL.
460 .It Ic load-url
461 Prompt for an URL.
462 .It Ic next-page
463 Go forward in the page history.
464 .It Ic olivetti-mode
465 Toggle olivetti mode (i.e. horizontal centering of the lines of the
466 window.)
467 .It Ic previous-page
468 Go backward in the page history.
469 .It Ic push-button
470 Follow link at point, or toggle the visibility of the following
471 preformatted block if called when the cursor is on the heading of the block.
472 .It Ic push-button-new-tab
473 Follow link at point in a new tab.
474 .It Ic redraw
475 Redraw the screen, useful if some background program messed up the
476 display.
477 .It Ic reload-page
478 Reload the current page.
479 .It Ic scroll-down
480 Scroll down by one visual page.
481 .It Ic scroll-line-down
482 Scroll down by one line.
483 .It Ic scroll-line-up
484 Scroll up by one line.
485 .It Ic scroll-up
486 Scroll up by one visual page.
487 .It Ic suspend-telescope
488 Suspend the current
489 .Nm
490 session.
491 .It Ic swiper
492 Jump to a line using the minibuffer.
493 .It Ic toc
494 Jump to a heading using the minibuffer.
495 .It Ic toggle-help
496 Toggle side window with help about available keys and their associated
497 interactive command.
498 .It Ic toggle-pre-wrap
499 Toggle the wrapping of preformatted blocks.
500 .El
501 .Ss Minibuffer commands
502 .Bl -tag -width execute-extended-command -compact
503 .It Ic mini-abort
504 Abort the current minibuffer action.
505 .It Ic mini-complete-and-exit
506 Complete the current minibuffer action.
507 .It Ic mini-delete-backward-char
508 Delete the character before the point.
509 .It Ic mini-delete-char
510 Delete the character after the point.
511 .It Ic mini-goto-beginning
512 Select the first completion, if any.
513 .It Ic mini-goto-end
514 Select the last completion, if any.
515 .It Ic mini-kill-line
516 Delete from point until the end of the line.
517 .It Ic mini-next-history-element
518 Load the previous history element.
519 .It Ic mini-previous-history-element
520 Load the next history element.
521 .El
522 .Ss Aliases
523 The following aliases are available during
524 .Ic execute-extended-command :
525 .Bl -tag -width 16m -compact
526 .It Ic tabn
527 .Ic tab-next
528 .It Ic tabnew
529 .Ic tab-new
530 .It Ic tabp
531 .Ic tab-previous
532 .It Ic q No and Ic wq
533 .Ic kill-telescope
534 .El
535 .Sh CONFIGURATION FILE
536 During the startup,
537 .Nm
538 reads the configuration file at
539 .Pa ~/.telescope/config
540 or the one given with the
541 .Fl c
542 flag.
543 .Pp
544 .Nm
545 will also load a file called
546 .Pa config-TERM ,
547 where
548 .Dq TERM
549 is the name of the terminal type
550 .Pq i.e. the TERM variable ,
551 if available.
552 .Pp
553 The format of the configuration file is fairly flexible.
554 The current line can be extended over multiple ones using a
555 backslash
556 .Pq Sq \e .
557 Comments can be put anywhere in the file using a hash mark
558 .Pq Sq # ,
559 and extend to the end of the current line, but backslashes can't be
560 used to extend comments over multiple lines.
561 .Pp
562 The following constructs are available:
563 .Bl -tag -width Ds
564 .It Ic bind Ar map Ar key Ar cmd
565 Bind
566 .Ar key
567 to the function
568 .Ar cmd
569 in the keymap
570 .Ar map .
571 Valid values for map are
572 .Dq global-map
573 .Pq i.e. when the user is viewing a page
574 and
575 .Dq minibuffer-map
576 .Pq i.e. when the minibuffer has the focus.
577 .Ar key
578 follows the same syntax described in
579 .Sx DEFAULT KEY BINDINGS
580 and all the possible functions are listed in
581 .Sx INTERACTIVE COMMANDS .
582 .It Ic proxy Ar proto Ic via Ar url
583 Use
584 .Ar url
585 as proxy for all URLs with
586 protocol
587 .Ar proto .
588 .Ar url
589 must be a Gemini URI without path, query and fragment component.
590 .It Ic set Ar opt No = Ar val
591 Set the option
592 .Ar opt
593 to the value
594 .Ar val .
595 Valid options are:
596 .Pp
597 .Bl -tag -width twelveletters -compact
598 .It dont-wrap-pre
599 .Pq integer
600 If nonzero, don't wrap preformatted blocks.
601 .It emojify-link
602 .Pq integer
603 If not zero, when the text of a link starts with an emoji followed by
604 a space, use that emoji as line prefix.
605 Defaults to 1.
606 .It enable-colors
607 .Pq integer
608 If not zero, enable colours.
609 By default is 1 if
610 .Ev NO_COLORS
611 is not set, 0 otherwise.
612 .It fill-column
613 .Pq integer
614 If greater than zero, lines of text will be formatted in a way that
615 don't exceed the given number of columns.
616 By default is 80.
617 .It hide-pre-blocks
618 .Pq integer
619 If nonzero, hide by default the body of the preformatted blocks.
620 By default is zero.
621 .Ic push-button
622 can be used to toggle the visibility per-block.
623 .It hide-pre-closing-line
624 .Pq integer
625 If nonzero, hide the closing line of preformatted blocks.
626 .It hide-pre-context
627 .Pq integer
628 If nonzero, hide the start and end line of the preformatted blocks.
629 If both hide-pre-context and hide-pre-blocks are nonzero, preformatted
630 blocks are irremediably hidden.
631 By default is zero.
632 .It new-tab-url
633 .Pq string
634 URL for the new tab page.
635 By default is
636 .Dq about:new .
637 .It olivetti-mode
638 .Pq integer
639 Enable
640 .Ic olivetti-mode
641 if non zero.
642 By default is 1.
643 .It set-title
644 .Pq integer
645 If nonzero, set the terminal title.
646 Defaults to 1.
647 .El
648 .It Ic style Ar name Ar option
649 Change the styling of the element identified by
650 .Ar name .
651 Multiple options may be specified within curly braces.
652 Valid style identifiers are:
653 .Bl -tag -width 16m -compact -offset Ds
654 .It line
655 for the area outside the lines in the body of the page.
656 .It line.compl
657 for the completion in the minibuffer
658 .It line.compl.current
659 for the current completion
660 .It line.text
661 for text lines.
662 .It line.link
663 for link lines.
664 .It line.title1..3
665 for headings
666 .It line.item
667 for item lines.
668 .It line.quote
669 for quotes.
670 .It line.pre.start
671 for the heading of a preformatted block.
672 .It line.pre
673 for the content of a preformatted block.
674 .It line.pre.end
675 for the closing line of a preformatted block.
676 .It minibuffer
677 for the minibuffer
678 .Dq i.e. the last line of the window
679 .It modeline
680 for the modeline
681 .Dq i.e. the info line right above the minibuffer
682 .It tabline
683 for the tabline.
684 .It tabline.tab
685 for the non-focused tabs.
686 .It tabline.current
687 for the focused tab.
688 .El
689 .Pp
690 Valid options are:
691 .Bl -tag -width Ds
692 .It Ic attr Ar prefix Oo Ar line Oo Ar trail Oc Oc
693 Sets the text attributes.
694 If only one value is given,
695 .Ar line
696 and
697 .Ar trail
698 default to that; if two values are given then
699 .Ar trail
700 defaults to
701 .Ar prefix .
702 Each attribute is a comma-separated list of keywords:
703 .Bl -tag -width underline -compact -offset Ds
704 .It Ic normal
705 no attributes.
706 .It Ic standout
707 best highlighting mode for the terminal.
708 .It Ic underline
709 underlines the text.
710 .It Ic reverse
711 reverses background/foreground colors.
712 .It Ic blink
713 makes the text blinking.
714 .It Ic dim
715 half bright.
716 .It Ic bold
717 extra bright or bold.
718 .El
719 .Pp
720 Only the styles under the
721 .Dq line.
722 prefix accept up to three attributes.
723 The other will only use the first one given.
724 .It Ic bg Ar prefix Oo Ar line Oo Ar trail Oc Oc
725 Sets the background color.
726 Follows the same behaviour as
727 .Ic attr
728 regarding the optional parameters.
729 The colour is one of black, red, green, yellow, blue,
730 magenta, cyan and white; colour0 to colour255
731 .Pq or color0 to color255
732 from the 256-colour set;
733 default for the default colour.
734 .It Ic fg Ar prefix Oo Ar line Oo Ar trail Oc Oc
735 Sets the foreground color.
736 It behaves just like
737 .Ic bg .
738 .It Ic prefix Ar prfx Op Ar cont
739 Sets the prefix for the current line type to
740 .Ar prfx
741 and
742 .Ar cont
743 as the prefix for the continuation lines
744 .Pq i.e. when a long line gets wrapped.
745 If
746 .Ar cont
747 is not given its value will be the same of
748 .Ar prfx .
749 .El
750 .El
751 .Sh FILES
752 .Bl -tag -width Ds -compact
753 .It Pa ~/.telescope/bookmarks.gmi
754 Holds the bookmarks.
755 .It Pa ~/.telescope/config
756 Default configuration file.
757 .It Pa ~/.telescope/known_hosts
758 Contains a list of host keys for all the hosts the user has visited.
759 See the TOFU section for more info.
760 .It Pa ~/.telescope/lock
761 Lock file used to prevent multiple instance of
762 .Nm
763 from running at the same time.
764 .It Pa ~/.telescope/session
765 Contains the list of tabs from the last session.
766 Every line identifies a tab.
767 The syntax is the full URL, followed by a space, followed by an
768 optional comma-separated list of attributes.
769 Is written by
770 .Ic kill-telescope
771 and loaded on startup.
772 .El
773 .Sh EXAMPLES
774 The following is my config file:
775 .Bd -literal -offset indent
776 # enable colors regardless of $NO_COLOR
777 set enable-colors = 1
779 style line.item {
780 prefix " • " " "
783 style line.link {
784 prefix "→ " " "
787 style line.quote {
788 prefix " ┃ "
790 .Ed
791 .Pp
792 It's possible to browse
793 .Dq the small web
794 .Pq i.e. simple websites
795 by using programs like the duckling-proxy by defining a proxy in
796 .Pa ~/.telescope/config :
797 .Bd -literal -offset indent
798 proxy http via "gemini://localhost:1965"
799 proxy https via "gemini://localhost:1965"
800 .Ed
801 .Pp
802 To load
803 .Nm
804 without any configuration use
805 .Bd -literal -offset indent
806 telescope -c /dev/null
807 .Ed
808 .Sh AUTHORS
809 .An -nosplit
810 The
811 .Nm
812 program was written by
813 .An Omar Polo Aq Mt op@omarpolo.com .