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