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