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