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