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