Remove CACHE_PAGEREFS "optimization"
[llpp.git] / help.ml
blob1f5c60b1ace1f6828effb5e8f931bf87025b9840
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 left/right arrow - pan left/right (when zoomed in)
10 Ctrl-arrows - half a screen width/height scoll/pan
11 space - go to the next page
12 delete - go to the previous page
13 pageup/pagedown - go forward/backward one screen-full
14 g, G - go to first/last page
15 home/end - go to first/last page
17 -----Advanced Movement / History-----
18 backspace - go back after jumping (clicking link and suchlike)[1]
19 Alt-left/right arrow - go backward/forward in history
20 0..9 - enter page number to jump to
21 t - align top of the screen with the top of the page
22 <,> - rotate
23 Ctrl-pageup/pagedown - align top of the screen with first/last visible page
24 F - go to hinted link
25 if auto scrolling is active:
26 up/down arrows and mouse buttons 3/4 will make scrolling go faster/slower
28 -----Mouse-----
29 primary mouse button - click on link or select text[2]
30 when Shift is held - run "synctex command" with coordinates of the point[3]
31 when Ctrl is held - pan
32 zoom to block - when in block zoom mode
33 otherwise - pan if there's no text/link under the cursor
34 mouse buttons 3/4 - scroll up/down (aka mouse wheel)
35 when Ctrl is held - zoom
36 mouse buttons 5/6 - pan left/right (aka horizontal mouse wheel)
37 secondary mouse button - select rectangle to zoom to
38 when Shift is held - add text annotation
40 Note:
41 moving mouse while holding primary mouse button will pan the page,
42 if the mouse is over selectable element (text/link) holding Ctrl
43 will make the page pan instead of the default action (selecting text/
44 clicking link)
46 -----Bookmarks-----
47 m - create named bookmark
48 ~ - create quick bookmark
50 -----Zoom-----
51 Ctrl+Shift up/down - set previous zoom level
52 B - toggle zoom block mode
53 w - change height of the window to encompass all of the page
54 Alt-c - center view
55 Ctrl-+/Ctrl-= - zoom in
56 Ctrl-- - zoom out
57 Ctrl-0 - reset zoom and panning
58 Ctrl-1 - fit tallest page
59 Ctrl-2 - fit tallest page height exactly
60 Ctrl-3 - cycle fit models
61 Ctrl-4 - 1:1 zoom
62 Ctrl-9/F9 - enter bird's eye view
64 -----Actions-----
65 u - dehighlight
66 r - reload document[4]
67 y - select link and paste its description to the clipboard
68 | - pipe selection through specified command
69 x - run pax command on selected region
70 Ctrl-p - launch a command with the document path as an argument
71 return - (in link navigation mode) follow link
72 = - show current position
73 e - view error log
75 -----Search-----
76 /,? - enter text to search for (/ - forward, ? - backward)
77 n - repeat last search (forward)
78 p, N - repeat last search (backward)
79 z[zbt] - "zoom in" on the first search result
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)
101 -----Tunables-----
102 -i - toggle case sensitivity of searches
103 -R<number> - rotate
104 -v - toggle verbosity
105 -Z<number> - set zoom (percent)
106 -T - toggle trimming of margins
107 -I - invert colors
108 -M - toggle pax mode
109 -C<number> - set column count
110 -x<string> - set command to run on selection
111 -f - toggle "what's under cursor" identification
112 - (or "what's currently selected" in link navigation mode)
113 - (font name of the text under cursor or link target)
115 -----Bird's eye mode-----
116 Ctrl-9,F9,esc - leave bird's eye view
117 Ctrl-l - center the view on the currently selected page
118 (page)up/(page)down - navigate
119 home/end - go to first/last page
120 enter - select the page and leave bird's eye mode
121 primary mouse button - select the page under cursor and leave bird's eye mode
123 -----Outline/bookmark/help/info/history mode-----
124 esc - leave outline/bookmark mode
125 up/down - select previous/next item
126 alpha-numeric - quick search
127 Ctrl-s - repeat search (forward)
128 Ctrl-r - repeat search (backward)
129 Ctrl-l - center on current item
130 Ctrl-left/right - pan text left/right
131 Ctrl-up/down - scroll view up/down
132 Ctrl-insert - copy active item's text to clipboard
134 -----Outline/history mode-----
135 left/right - go up/down a level
136 Ctrl-a - toggle auto narrowing
137 / - enter auto narrowing
138 tab - begin nested narrowing
139 Ctrl-n - narrow to search pattern
140 Ctrl-u - undo narrowing
141 Ctrl-S - synchronize
143 -----Info mode-----
144 enter - toggle/enter new value for selected parameter
146 -----When entering search pattern/page number-----
147 up/down arrow - previous/next entered text
148 enter - confirm
149 Ctrl-g,esc - cancel
151 double/triple/quadruple/quintuple clicks in view mode will pipe the
152 word/line/block/page through pax command when Ctrl is held and
153 selection command otherwise
155 [1] if the document was previously visited initial backspace will
156 jump to the last visited place
158 [2] by default X11 version uses xclip to handle text copy/paste
159 https://github.com/astrand/xclip
161 [3] arguments to the command are:
162 1 = path to the document
163 2 = zero based page number
164 3 = X coordinate within the page
165 4 = Y …
167 [4] document will also be reloaded upon reception of the HUP signal
169 -----Caveat emptor-----
170 o Text selection is limited to a single page
171 o Text searching is very naive|};;
173 open Utils;;
175 let gotourl launcher url =
176 let command = Str.global_replace Utils.Re.percent url launcher in
177 try ignore @@ spawn command []
178 with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
181 let gotouri launcher uri =
182 if emptystr launcher
183 then dolog "%s" uri
184 else
185 if nonemptystr @@ geturl uri
186 then gotourl launcher uri
187 else dolog "obtained empty url from uri %S" uri
190 let version () =
191 Printf.sprintf "llpp %s, fitz %s, ocaml %s/%d bit"
192 (Ffi.llpp_version ()) (Ffi.fz_version ()) Sys.ocaml_version Sys.word_size
195 let fixup = let open Str in let gr = global_replace in
196 let dash = regexp {|\([^ ]*\) +- +\(.*\)|}
197 and head = regexp {|-----\(.*\)-----|} in
198 fun s -> gr dash "\\1\t\\2" @@ gr head "\xc2\xb7\\1" s
201 let makehelp launcher =
202 version ()
203 :: "(searching in this text works just by typing (i.e. no initial '/'))"
204 :: E.s :: String.split_on_char '\n' keys |>
205 List.map (fun s ->
206 let s = fixup s in
207 match geturl s with
208 | "" -> (s, 0, Config.Noaction)
209 | url -> (s, 0, Config.Action (fun uioh -> gotourl launcher url; uioh))