Remove stray spaces
[llpp.git] / help.ml
blob30d8bdfcbb60ea0be1122430e96955b38bd967ab
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 -s<number> - set scroll step (pixels)
104 -S<number> - set space between pages (pixels)
105 -R<number> - rotate
106 -v - toggle verbosity
107 -Z<number> - set zoom (percent)
108 -T - toggle trimming of margins
109 -I - invert colors
110 -M - toggle pax mode
111 -C<number> - set column count
112 -x<string> - set command to run on selection
113 -f - toggle "what's under cursor" identification
114 - (or "what's currently selected" in link navigation mode)
115 - (font name of the text under cursor or link target)
117 -----Bird's eye mode-----
118 Ctrl-9,F9,esc - leave bird's eye view
119 Ctrl-l - center the view on the currently selected page
120 (page)up/(page)down - navigate
121 home/end - go to first/last page
122 enter - select the page and leave bird's eye mode
123 primary mouse button - select the page under cursor and leave bird's eye mode
125 -----Outline/bookmark/help/info/history mode-----
126 esc - leave outline/bookmark mode
127 up/down - select previous/next item
128 alpha-numeric - quick search
129 Ctrl-s - repeat search (forward)
130 Ctrl-r - repeat search (backward)
131 Ctrl-l - center on current item
132 Ctrl-left/right - pan text left/right
133 Ctrl-up/down - scroll view up/down
134 Ctrl-insert - copy active item's text to clipboard
136 -----Outline/history mode-----
137 left/right - go up/down a level
138 Ctrl-a - toggle auto narrowing
139 / - enter auto narrowing
140 tab - begin nested narrowing
141 Ctrl-n - narrow to search pattern
142 Ctrl-u - undo narrowing
143 Ctrl-S - synchronize
145 -----Info mode-----
146 enter - toggle/enter new value for selected parameter
148 -----When entering search pattern/page number-----
149 up/down arrow - previous/next entered text
150 enter - confirm
151 Ctrl-g,esc - cancel
153 double/triple/quadruple/quintuple clicks in view mode will pipe the
154 word/line/block/page through pax command when Ctrl is held and
155 selection command otherwise
157 [1] if the document was previously visited initial backspace will
158 jump to the last visited place
160 [2] by default X11 version uses xclip to handle text copy/paste
161 https://github.com/astrand/xclip
163 [3] arguments to the command are:
164 1 = path to the document
165 2 = zero based page number
166 3 = X coordinate within the page
167 4 = Y …
169 [4] document will also be reloaded upon reception of the HUP signal
171 -----Caveat emptor-----
172 o Text selection is limited to a single page
173 o Text searching is very naive|};;
175 open Utils;;
177 let gotourl launcher url =
178 let command = Str.global_replace Utils.Re.percent url launcher in
179 try ignore @@ spawn command []
180 with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
183 let gotouri launcher uri =
184 if emptystr launcher
185 then dolog "%s" uri
186 else
187 if nonemptystr @@ geturl uri
188 then gotourl launcher uri
189 else dolog "obtained empty url from uri %S" uri
192 let version () =
193 Printf.sprintf "llpp %s, fitz %s, ocaml %s/%d bit"
194 (Ffi.llpp_version ()) (Ffi.fz_version ()) Sys.ocaml_version Sys.word_size
197 let fixup = let open Str in let gr = global_replace in
198 let dash = regexp {|\([^ ]*\) +- +\(.*\)|}
199 and head = regexp {|-----\(.*\)-----|} in
200 fun s -> gr dash "\\1\t\\2" @@ gr head "\xc2\xb7\\1" s
203 let makehelp launcher =
204 version ()
205 :: "(searching in this text works just by typing (i.e. no initial '/'))"
206 :: E.s :: String.split_on_char '\n' keys |>
207 List.map (fun s ->
208 let s = fixup s in
209 match geturl s with
210 | "" -> (s, 0, Config.Noaction)
211 | url -> (s, 0, Config.Action (fun uioh -> gotourl launcher url; uioh))