Consistency
[llpp.git] / help.ml
blob1df71008895283b348774be736a00494efcf72ee
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 Shift-left/right - go to prev/next item of same or higher level
137 Ctrl-a - toggle auto narrowing
138 / - enter auto narrowing
139 tab - begin nested narrowing
140 Ctrl-n - narrow to search pattern
141 Ctrl-u - undo narrowing
142 Ctrl-S - synchronize
144 -----Info mode-----
145 enter - toggle/enter new value for selected parameter
147 -----When entering search pattern/page number-----
148 up/down arrow - previous/next entered text
149 enter - confirm
150 Ctrl-g,esc - cancel
152 double/triple/quadruple/quintuple clicks in view mode will pipe the
153 word/line/block/page through pax command when Ctrl is held and
154 selection command otherwise
156 [1] if the document was previously visited initial backspace will
157 jump to the last visited place
159 [2] by default X11 version uses xclip to handle text copy/paste
160 https://github.com/astrand/xclip
162 [3] arguments to the command are:
163 1 = path to the document
164 2 = zero based page number
165 3 = X coordinate within the page
166 4 = Y …
168 [4] document will also be reloaded upon reception of the HUP signal
170 -----Caveat emptor-----
171 o Text selection is limited to a single page
172 o Text searching is very naive|};;
174 open Utils;;
176 let gotourl launcher url =
177 let command = Str.global_replace Utils.Re.percent url launcher in
178 try ignore @@ spawn command []
179 with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
182 let gotouri launcher uri =
183 if emptystr launcher
184 then dolog "%s" uri
185 else
186 if nonemptystr @@ geturl uri
187 then gotourl launcher uri
188 else dolog "obtained empty url from uri %S" uri
191 let version () =
192 Printf.sprintf "llpp %s, fitz %s, ocaml %s/%d bit"
193 (Ffi.llpp_version ()) (Ffi.fz_version ()) Sys.ocaml_version Sys.word_size
196 let fixup = let open Str in let gr = global_replace in
197 let dash = regexp {|\([^ ]*\) +- +\(.*\)|}
198 and head = regexp {|-----\(.*\)-----|} in
199 fun s -> gr dash "\\1\t\\2" @@ gr head "\xc2\xb7\\1" s
202 let makehelp launcher =
203 version ()
204 :: "(searching in this text works just by typing (i.e. no initial '/'))"
205 :: E.s :: String.split_on_char '\n' keys |>
206 List.map (fun s ->
207 let s = fixup s in
208 match geturl s with
209 | "" -> (s, 0, Config.Noaction)
210 | url -> (s, 0, Config.Action (fun uioh -> gotourl launcher url; uioh))