Cosmetics
[llpp.git] / help.ml
blobafae7fd0642a4925125f49e37445cd40a68038dc
1 let keys =
2 {|-----Quitting-----
3 escape/q - quit
4 Q - quit without saving the configuration or changes
5 W - save changes
7 -----Movement-----
8 up/down arrow - scroll up/down
9 j/k - scroll up/down
10 left/right arrow - pan left/right (when zoomed in)
11 Ctrl-arrows - scroll up/down, pan left/right (by half a screen width/height)
12 space - go to the next page
13 delete - go to the previous page
14 pageup/pagedown - go forward/backward one screen-full
15 g, G - go to first/last page
16 home/end - go to first/last page
18 -----Advanced Movement / History-----
19 backspace - go back after jumping (clicking link and suchlike)[1]
20 Alt-left/right arrow - go backward/forward in history
21 0..9 - enter page number to jump to
22 t - align top of the screen with the top of the page
23 <,> - rotate
24 Ctrl-pageup/pagedown - align top of the screen with first/last visible page
25 F - go to hinted link
26 if auto scrolling is active:
27 up/down arrows and mouse buttons 3/4 will make scrolling go faster/slower
29 -----Mouse-----
30 primary mouse button - click on link or select text[2]
31 when shift is held - execute "synctex command" with coordinates of the point[3]
32 when control is held - pan
33 zoom to block - when in block zoom mode
34 otherwise - pan if there's no text/link under the cursor
35 mouse buttons 3/4 - scroll up/down (aka mouse wheel)
36 when control is held - zoom
37 mouse buttons 5/6 - pan left/right (aka horizontal mouse wheel)
38 secondary mouse button - select rectangle to zoom to
39 when shift is held - add text annotation
41 Note:
42 moving mouse while holding primary mouse button will pan the page,
43 if the mouse is over selectable element (text/link) holding control
44 will make the page pan instead of the default action (selecting text/
45 clicking link)
47 -----Bookmarks-----
48 m - create named bookmark
49 ~ - create quick bookmark
51 -----Zoom-----
52 control + shift up/down - set previous zoom level
53 B - toggle zoom block mode
54 w - change height of the window to encompass all of the page
55 Alt-c - center view
56 Ctrl-+/Ctrl-= - zoom in
57 Ctrl-- - zoom out
58 Ctrl-0 - reset zoom and panning
59 Ctrl-1 - fit tallest page
60 Ctrl-2 - fit tallest page height exactly
61 Ctrl-3 - cycle fit models
62 Ctrl-4 - 1:1 zoom
63 Ctrl-9/F9 - enter bird's eye view
65 -----Actions-----
66 u - dehighlight
67 r - reload document[4]
68 y - select link and paste its description to the clipboard
69 | - pipe selection through specified command
70 x - run pax command on selected region
71 Ctrl-p - launch a command with the document path as an argument
72 return - (in link navigation mode) follow link
73 = - show current position
74 e - view error log
76 -----Search-----
77 /,? - enter text to search for (/ - forward, ? - backward)
78 n - repeat last search (forward)
79 p, N - repeat last search (backward)
80 Ctrl-g - interrupt search
82 -----Settings / Modes-----
83 [,] - decrease/increase page brightness
84 + - set page bias
85 - - toggle/set tunable
86 b - toggle scroll bar
87 l - toggle highlighting of the links
88 f - toggle fullscreen
89 insert - toggle link navigation mode
90 o - switch to outline/table of contents mode
91 ' - switch to bookmark mode
92 H - switch to history mode
93 h,F1 - switch to help mode
94 i - switch to info mode
95 P - switch to "presentation" mode
96 c - switch to previous column layout
97 a - auto scroll mode
98 S - slide show mode
99 (auto scroll step is interepreted as a delay (in seconds) between transitions)
102 -----Tunables-----
103 -i - toggle case sensitivity of searches
104 -s<number> - set scroll step (pixels)
105 -S<number> - set space between pages (pixels)
106 -R<number> - rotate
107 -v - toggle verbosity
108 -l - toggle proportional display
109 -Z<number> - set zoom (percent)
110 -T - toggle trimming of margins
111 -I - invert colors
112 -M - toggle pax mode
113 -C<number> - set column count
114 -x<string> - set command to run on selection
115 -f - toggle "what's under cursor" identification
116 - (or "what's currently selected" in link navigation mode)
117 - (font name of the text under cursor or link target)
119 -----Bird's eye mode-----
120 Ctrl-9,F9,esc - leave bird's eye view
121 Ctrl-l - center the view on the currently selected page
122 (page)up/(page)down - navigate
123 home/end - go to first/last page
124 enter - select the page and leave bird's eye mode
125 primary mouse button - select the page under cursor and leave bird's eye mode
127 -----Outline/bookmark/help/info/history mode-----
128 esc - leave outline/bookmark mode
129 up/down - select previous/next item
130 alpha-numeric - quick search
131 Ctrl-s - repeat search (forward)
132 Ctrl-r - repeat search (backward)
133 Ctrl-l - center on current item
134 Ctrl-left/right - pan text left/right
135 Ctrl-up/down - scroll view up/down
136 Ctrl-insert - copy active item's text to clipboard
138 -----Outline/history mode-----
139 left/right - go up/down a level
140 Ctrl-a - toggle auto narrowing
141 / - enter auto narrowing
142 tab - begin nested narrowing
143 Ctrl-n - narrow to search pattern
144 Ctrl-u - undo narrowing
145 Ctrl-S - synchronize
147 -----Info mode-----
148 enter - toggle/enter new value for selected parameter
150 -----When entering search pattern/page number-----
151 up/down arrow - previous/next entered text
152 enter - confirm
153 Ctrl-g,esc - cancel
155 double/triple/quadruple/quintuple clicks in view mode will pipe the
156 word/line/block/page through pax command when control is held and
157 selection command otherwise
159 [1] if the document was previously visited initial backspace will
160 jump to the last visited place
162 [2] text selection requires
163 X11 - xclip https://github.com/astrand/xclip
164 macOS - pbcopy ships with the system
166 [3] arguments to the command are:
167 1 = path to the document
168 2 = zero based page number
169 3 = X coordinate within the page
170 4 = Y …
172 [4] document will also be reloaded upon reception of the HUP signal
174 -----Caveat emptor-----
175 o Text selection is limited to a single page
176 o Text searching is very naive|};;
178 open Utils;;
180 external fz_version : unit -> string = "ml_fz_version";;
181 external llpp_version : unit -> string = "ml_llpp_version";;
183 let gotourl launcher url =
184 let command = Str.global_replace Utils.Re.percent url launcher in
185 try ignore @@ spawn command []
186 with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
189 let gotouri launcher uri =
190 if emptystr launcher
191 then dolog "%s" uri
192 else
193 if nonemptystr @@ geturl uri
194 then gotourl launcher uri
195 else dolog "obtained empty url from uri %S" uri
198 let version () =
199 Printf.sprintf "llpp version %s, fitz %s, ocaml %s/%d bit"
200 (llpp_version ()) (fz_version ()) Sys.ocaml_version Sys.word_size
203 let fixup = let open Str in let gr = global_replace in
204 let dash = regexp {|\([^ ]*\) +- +\(.*\)|}
205 and head = regexp {|-----\(.*\)-----|} in
206 fun s -> gr dash "\\1\t\\2" @@ gr head "\xc2\xb7\\1" s
209 let makehelp launcher =
210 version ()
211 :: "(searching in this text works just by typing (i.e. no initial '/'))"
212 :: E.s :: String.split_on_char '\n' keys |>
213 List.map (fun s ->
214 let s = fixup s in
215 match geturl s with
216 | "" -> (s, 0, Config.Noaction)
217 | url -> (s, 0, Config.Action (fun uioh -> gotourl launcher url; uioh))