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