1
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;
4;; MODULE      : generic-kbd.scm
5;; DESCRIPTION : general keyboard shortcuts for all modes
6;; COPYRIGHT   : (C) 1999  Joris van der Hoeven
7;;
8;; This software falls under the GNU general public license version 3 or later.
9;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
10;; in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
11;;
12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
14(texmacs-module (generic generic-kbd)
15  (:use (texmacs keyboard prefix-kbd)
16        (utils edit variants)
17        (utils edit auto-close)
18        (utils library cursor)
19        (generic document-edit)
20        (generic generic-edit)
21        (generic format-edit)
22        (generic format-geometry-edit)
23        (source source-edit)
24        (texmacs texmacs tm-files)
25        (texmacs texmacs tm-print)
26        (doc help-funcs)))
27
28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29;; General shortcuts for all modes
30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
31
32(kbd-map
33  ("F1" (interactive docgrep-in-doc))
34  ("S-F1" (interactive docgrep-in-src)) ;; FIXME: S-F1 should be 'What is This?'
35  ;("M-F1" (load-help-buffer "about/welcome/welcome")) ; Conflict with devtools
36
37  ("<" "<less>")
38  (">" "<gtr>")
39  ("(" (make-bracket-open "(" ")"))
40  (")" (make-bracket-close ")" "("))
41  ("[" (make-bracket-open "[" "]"))
42  ("]" (make-bracket-close "]" "["))
43  ("{" (make-bracket-open "{" "}"))
44  ("}" (make-bracket-close "}" "{"))
45  ("\\" (if (or (inside? 'hybrid) (in-prog?)) (insert "\\") (make-hybrid)))
46  ("\\ var" "\\")
47  ("\\ var var" "<setminus>")
48  ("$" (make 'math))
49  ("$ var" "$")
50
51  ("-" "-")
52  ("space" (kbd-space))
53  ("tab" (kbd-tab))
54  ("return" (kbd-return))
55  ("S-space" (kbd-shift-space))
56  ("S-tab" (kbd-shift-tab))
57  ("S-return" (kbd-shift-return))
58  ("C-return" (kbd-control-return))
59  ("C-S-return" (kbd-shift-control-return))
60  ("A-return" (kbd-alternate-return))
61  ("A-S-return" (kbd-shift-alternate-return))
62
63  ("delete" (kbd-delete))
64  ("backspace" (kbd-backspace))
65  ("left" (kbd-left))
66  ("right" (kbd-right))
67  ("up" (kbd-up))
68  ("down" (kbd-down))
69  ("home" (kbd-start-line))
70  ("end" (kbd-end-line))
71  ("pageup" (kbd-page-up))
72  ("pagedown" (kbd-page-down))
73  ("S-delete" (kbd-delete))
74  ("S-backspace" (kbd-backspace))
75  ("S-left" (kbd-select kbd-left))
76  ("S-right" (kbd-select kbd-right))
77  ("S-up" (kbd-select kbd-up))
78  ("S-down" (kbd-select kbd-down))
79  ("S-home" (kbd-select kbd-start-line))
80  ("S-end" (kbd-select kbd-end-line))
81  ("S-pageup" (kbd-select kbd-page-up))
82  ("S-pagedown" (kbd-select kbd-page-down))
83
84  ("structured:cmd delete" (remove-structure-upwards))
85  ("structured:cmd backspace" (remove-structure-upwards))
86  ("structured:cmd left" (traverse-left))
87  ("structured:cmd right" (traverse-right))
88  ("structured:cmd up" (traverse-up))
89  ("structured:cmd down" (traverse-down))
90  ("structured:cmd home" (traverse-first))
91  ("structured:cmd end" (traverse-last))
92  ("structured:cmd pageup" (traverse-previous))
93  ("structured:cmd pagedown" (traverse-next))
94  ("structured:cmd section" (traverse-previous-section-title))
95  ("structured:cmd S-left" (kbd-select traverse-left))
96  ("structured:cmd S-right" (kbd-select traverse-right))
97  ("structured:cmd S-up" (kbd-select traverse-up))
98  ("structured:cmd S-down" (kbd-select traverse-down))
99  ("structured:cmd S-home" (kbd-select traverse-first))
100  ("structured:cmd S-end" (kbd-select traverse-last))
101  ("structured:cmd S-pageup" (kbd-select traverse-previous))
102  ("structured:cmd S-pagedown" (kbd-select traverse-next))
103  ("structured:cmd space" (kbd-select-enlarge))
104  ("structured:cmd tab" (variant-circulate (focus-tree) #t))
105  ("structured:cmd S-tab" (variant-circulate (focus-tree) #f))
106  ("structured:cmd *" (alternate-toggle (focus-tree)))
107  ("structured:cmd #" (numbered-toggle (focus-tree)))
108
109  ("structured:move delete" (structured-exit-right))
110  ("structured:move backspace" (structured-exit-left))
111  ("structured:move left" (structured-left))
112  ("structured:move right" (structured-right))
113  ("structured:move up" (structured-up))
114  ("structured:move down" (structured-down))
115  ("structured:move home" (structured-start))
116  ("structured:move end" (structured-end))
117  ("structured:move pageup" (structured-top))
118  ("structured:move pagedown" (structured-bottom))
119  ("structured:move S-left" (kbd-select structured-left))
120  ("structured:move S-right" (kbd-select structured-right))
121  ("structured:move S-up" (kbd-select structured-up))
122  ("structured:move S-down" (kbd-select structured-down))
123  ("structured:move S-home" (kbd-select structured-start))
124  ("structured:move S-end" (kbd-select structured-end))
125  ("structured:move S-pageup" (kbd-select structured-top))
126  ("structured:move S-pagedown" (kbd-select structured-bottom))
127
128  ("structured:insert delete" (structured-remove-right))
129  ("structured:insert backspace" (structured-remove-left))
130  ("structured:insert left" (structured-insert-left))
131  ("structured:insert right" (structured-insert-right))
132  ("structured:insert up" (structured-insert-up))
133  ("structured:insert down" (structured-insert-down))
134  ("structured:insert home" (structured-insert-start))
135  ("structured:insert end" (structured-insert-end))
136  ("structured:insert pageup" (structured-insert-top))
137  ("structured:insert pagedown" (structured-insert-bottom))
138
139  ("structured:geometry delete" (geometry-reset))
140  ("structured:geometry backspace" (geometry-reset))
141  ("structured:geometry left" (geometry-left))
142  ("structured:geometry right" (geometry-right))
143  ("structured:geometry up" (geometry-up))
144  ("structured:geometry down" (geometry-down))
145  ("structured:geometry home" (geometry-start))
146  ("structured:geometry end" (geometry-end))
147  ("structured:geometry pageup" (geometry-top))
148  ("structured:geometry pagedown" (geometry-bottom))
149  ("structured:geometry tab" (geometry-circulate #t))
150  ("structured:geometry S-tab" (geometry-circulate #f))
151  ("structured:geometry [" (geometry-slower))
152  ("structured:geometry ]" (geometry-faster))
153
154  ("altcmd \\" (make-hybrid))
155  ("altcmd a" (make-tree))
156  ("altcmd R" (make-rigid))
157  ("altcmd :" (make 'line-break))
158  ("altcmd ;" (make 'new-line))
159  ("altcmd return" (make 'next-line))
160  ("altcmd /" (make 'no-break))
161  ("altcmd !" (make-label))
162  ("altcmd ?" (make 'reference))
163  ("altcmd P" (make 'pageref))
164
165  ("accent:hat" "^")
166  ("accent:deadhat" "^")
167  ("accent:tilde" "~")
168  ("accent:acute" "'")
169  ("accent:grave" "`")
170
171  ("symbol \\" "\\")
172  ("symbol \"" "\"")
173  ("symbol $" "$")
174  ("symbol &" "&")
175  ("symbol #" "#")
176  ("symbol �" "�")
177  ("symbol %" "%")
178  ("symbol _" "_")
179  ("symbol ^" "^")
180  ("symbol (" "(")
181  ("symbol )" ")")
182  ("symbol [" "[")
183  ("symbol ]" "]")
184  ("symbol {" "{")
185  ("symbol }" "}")
186  ("symbol |" "|")
187
188  ("undo" (noop) (undo 0))
189  ("redo" (noop) (redo 0))
190  ("cancel" (noop) (clipboard-clear "primary"))
191  ("cut" (noop) (clipboard-cut "primary"))
192  ("paste" (noop) (clipboard-paste "primary"))
193  ("copy" (noop) (clipboard-copy "primary"))
194  ("find" (noop) (interactive-search))
195  ("search find" (search-next-match #t))
196  ("search again" (search-next-match #t))
197
198  ("copyto 1" (noop) (clipboard-copy "primary"))
199  ("copyto 2" (clipboard-copy "secondary"))
200  ("copyto 3" (clipboard-copy "ternary"))
201  ("copyto s" (clipboard-copy "search"))
202  ("copyto r" (clipboard-copy "replace"))
203  ("copyto *" (interactive clipboard-copy))
204  ("cutto 1" (noop) (clipboard-cut "primary"))
205  ("cutto 2" (clipboard-cut "secondary"))
206  ("cutto 3" (clipboard-cut "ternary"))
207  ("cutto s" (clipboard-cut "search"))
208  ("cutto r" (clipboard-cut "replace"))
209  ("cutto *" (interactive clipboard-cut))
210  ("pastefrom 1" (noop) (clipboard-paste "primary"))
211  ("pastefrom 2" (clipboard-paste "secondary"))
212  ("pastefrom 3" (clipboard-paste "ternary"))
213  ("pastefrom s" (clipboard-paste "search"))
214  ("pastefrom r" (clipboard-paste "replace"))
215  ("pastefrom *" (interactive clipboard-paste))
216
217  ("table N t" (make 'tabular))
218  ("table N T" (make 'tabular*))
219  ("table N w" (make 'wide-tabular))
220  ("table N b" (make 'block))
221  ("table N B" (make 'block*))
222  ("table N W" (make 'wide-block)))
223
224;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
225;; Emacs keymap
226;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
227
228(kbd-map
229  (:profile emacs)
230
231  ;; standard Emacs shortcuts
232  ("emacs a" (kbd-start-line))
233  ("emacs b" (kbd-left))
234  ;;("emacs d" (remove-text #t))
235  ("emacs d" (kbd-delete))
236  ("emacs e" (kbd-end-line))
237  ("emacs f" (kbd-right))
238  ("emacs g" (selection-cancel))
239  ("emacs j" (insert-return))
240  ("emacs k" (kill-paragraph))
241  ("emacs m" (insert-return))
242  ("emacs n" (kbd-down))
243  ("emacs p" (kbd-up))
244  ("emacs q" (make 'symbol))
245  ("emacs r" (interactive-search))
246  ("emacs s" (interactive-search))
247  ("emacs v" (kbd-page-down))
248  ("emacs w" (clipboard-cut "primary"))
249  ("emacs y" (clipboard-paste "primary"))
250  ("emacs insert" (clipboard-copy "primary"))
251  ("emacs _" (undo 0))
252  ("emacs /" (undo 0))
253
254  ("emacs:meta v" (kbd-page-up))
255  ("emacs:meta w" (clipboard-copy "primary"))
256  ("emacs:meta x" (interactive exec-interactive-command))
257  ("emacs:meta X" (interactive footer-eval))
258  ("emacs:meta <" (go-start))
259  ("emacs:meta >" (go-end))
260  ("emacs:meta $" (spell-start))
261  ("emacs:meta %" (interactive-replace))
262
263  ("emacs:prefix tab" (make 'indent))
264  ("emacs:prefix b" (interactive go-to-buffer))
265  ("emacs:prefix h" (select-all))
266  ("emacs:prefix k" (safely-kill-buffer))
267  ("emacs:prefix C-c" (safely-quit-TeXmacs))
268  ("emacs:prefix C-f" (interactive load-buffer))
269  ("emacs:prefix C-s" (save-buffer))
270  ("emacs:prefix C-w" (interactive save-buffer-as))
271
272  ("search emacs s" (search-next-match #t))
273  ("search emacs r" (search-next-match #f))
274
275  ;; not implemented
276  ;;("emacs h ..." (help ...))
277  ;;("emacs l" (recenter-window))
278  ;;("emacs o" (open-line))
279  ;;("emacs t" (transpose-chars))
280  ;;("emacs u" (universal-argument))
281  ;;("emacs z" (suspend-texmacs))
282  ;;("emacs \\" (toggle-input-method))
283  ;;("emacs ]" (abort-recursive-edit))
284  ;;("emacs:meta !" (shell-command))
285  ;;("emacs:meta (" (insert-parentheses))
286  ;;("emacs:meta )" (move-past-closed-and-reindent))
287  ;;("emacs:meta *" (pop-tag-mark))                  ;; conflict altcmd *
288  ;;("emacs:meta ," (loops-tag-continue))
289  ;;("emacs:meta ." (find-tag))
290  ;;("emacs:meta /" (dabbrev-expand))                ;; conflict altcmd /
291  ;;("emacs:meta \\" (delete-horizontal-space))      ;; conflict altcmd \
292  ;;("emacs:meta :" (interactive footer-eval))       ;; conflict altcmd :
293  ;;("emacs:meta ;" (comment-dwim))                  ;; conflict altcmd ;
294  ;;("emacs:meta =" (count-lines-region))
295  ;;("emacs:meta {" (backward-paragraph))
296  ;;("emacs:meta |" (shell-command-on-region))
297  ;;("emacs:meta }" (forward-paragraph))
298  ;;("emacs:meta @" (mark-word))
299  ;;("emacs:meta a" (traverse-up))                   ;; conflict altcmd a
300  ;;("emacs:meta b" (traverse-left))
301  ;;("emacs:meta c" (capitalize-word))
302  ;;("emacs:meta e" (traverse-down))                 ;; conflict altcmd e
303  ;;("emacs:meta f" (traverse-right))                ;; conflict altcmd f
304  ;;("emacs:meta h" (mark-paragraph))
305  ;;("emacs:meta i" (tab-to-tab-stop))               ;; conflict altcmd i
306  ;;("emacs:meta j" (indent-new-command-line))
307  ;;("emacs:meta l" (downcase-word))                 ;; conflict altcmd l
308  ;;("emacs:meta m" (back-to-indentation))
309  ;;("emacs:meta q" (fill-paragraph))
310  ;;("emacs:meta r" (move-to-window-line))
311  ;;("emacs:meta t" (transpose-words))               ;; conflict altcmd t
312  ;;("emacs:meta u" (upcase-word))
313  ;;("emacs:meta y" (yank-pop))
314  ;;("emacs:meta z" (zap-to-char))
315  ;;("emacs:prefix delete" (backward-kill-sentence))
316  ;;("emacs:prefix `" (next-error))
317  ;;("emacs:prefix 0" (delete-window))
318  ;;("emacs:prefix 1" (delete-other-windows))
319  ;;("emacs:prefix 2" (split-window-vertically))
320  ;;("emacs:prefix 3" (split-window-horizontally))
321  ;;("emacs:prefix d" (dired))
322  ;;("emacs:prefix f" (set-fill-column))
323  ;;("emacs:prefix i" (interactive insert-buffer))
324  ;;("emacs:prefix l" (count-lines-page))
325  ;;("emacs:prefix m" (compose-mail))
326  ;;("emacs:prefix o" (other-window))
327  ;;("emacs:prefix s" (save-some-buffers))
328  ;;("emacs:prefix u" (advertised-undo))
329  ;;("emacs:prefix z" (repeat))
330  ;;("emacs:prefix C-@" (pop-global-mark))
331  ;;("emacs:prefix C-d" (list-directory))
332  ;;("emacs:prefix C-e" (eval-last-expression))
333  ;;("emacs:prefix C-l" (downcase-region))
334  ;;("emacs:prefix C-n" (set-goal-column))
335  ;;("emacs:prefix C-o" (delete-blank-lines))
336  ;;("emacs:prefix C-p" (mark-page))
337  ;;("emacs:prefix C-q" (toggle-read-only))
338  ;;("emacs:prefix C-r" (interactive load-readonly-buffer))
339  ;;("emacs:prefix C-t" (transpose-lines))
340  ;;("emacs:prefix C-u" (upcase-region))
341  ;;("emacs:prefix C-v" (interactive load-alternate-buffer))
342  ;;("emacs:prefix C-x" (exchange-point-and-mark))
343  ;;("emacs:prefix C-z" (suspend-texmacs))
344
345  ;; further shortcuts for the Emacs mode
346  ("F2" (open-buffer))
347  ("S-F2" (choose-file load-buffer-in-new-window "Load file" ""))
348  ("C-F2" (revert-buffer))
349  ("M-F2" (new-buffer))
350  ("M-S-F2" (open-window))
351  ("M-C-F2" (clone-window))
352  ("F3" (save-buffer))
353  ("S-F3" (choose-file save-buffer-as "Save TeXmacs file" "texmacs"))
354  ("F4" (preview-buffer))
355  ("S-F4" (print-buffer))
356  ("C-F4" (interactive print-to-file))
357  ("M-F4" (interactive print-pages))
358  ("M-S-F4" (interactive print-pages-to-file))
359
360  ("emacs =" (interactive-replace))
361  ("emacs:meta g" (clipboard-clear "primary"))
362  ("emacs:meta [" (undo 0))
363  ("emacs:meta ]" (redo 0))
364  ("emacs:meta C-tab" (geometry-circulate #t))
365  ("emacs:meta C-S-tab" (geometry-circulate #f))
366  ("emacs:meta C-[" (geometry-slower))
367  ("emacs:meta C-]" (geometry-faster))
368
369  ("C-<" (cursor-history-backward))
370  ("C->" (cursor-history-forward))
371  ("C-#" (numbered-toggle (focus-tree)))
372  ("C-*" (alternate-toggle (focus-tree)))
373  ("C-+" (zoom-in (sqrt (sqrt 2.0))))
374  ("C--" (zoom-out (sqrt (sqrt 2.0))))
375  ("C-0" (fit-to-screen-width)))
376
377;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
378;; Standard cross-platform keybindings
379;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
380
381(kbd-map
382  (:profile std)
383
384  ;; standard cross-platform shortcuts
385  ("std a" (select-all))
386  ("std b" (toggle-bold))
387  ("std c" (clipboard-copy "primary"))
388  ("std f" (interactive-search))
389  ("std i" (toggle-italic))
390  ("std n" (new-buffer))
391  ("std N" (open-window))
392  ("std o" (open-buffer))
393  ("std p" (preview-buffer))
394  ("std q" (safely-quit-TeXmacs))
395  ("std R" (update-document "all"))
396  ("std s" (save-buffer))
397  ("std S" (choose-file save-buffer-as "Save TeXmacs file" "texmacs"))
398  ("std u" (toggle-underlined))
399  ("std v" (clipboard-paste "primary"))
400  ("std w" (safely-kill-buffer))
401  ("std W" (safely-kill-window))
402  ("std x" (clipboard-cut "primary"))
403  ("std z" (undo 0))
404  ("std Z" (redo 0))
405  ("std +" (zoom-in (sqrt (sqrt 2.0))))
406  ("std -" (zoom-out (sqrt (sqrt 2.0))))
407  ("std 0" (fit-to-screen-width))
408
409  ;; not yet implemented
410  ;;("std t" (add-tab))
411  ;;("std tab" (next-tab))
412  ;;("std S-tab" (previous-tab))
413
414  ("search std f" (search-next-match #t))   ;; added for convenience
415  ("search std F" (search-next-match #f)))  ;; added for convenience
416
417(kbd-map
418  (:profile emacs)
419  (:require (and (not (in-prog?)) (not (in-verbatim?))))
420  ("A-tab" (kbd-alternate-tab))
421  ("A-S-tab" (kbd-shift-alternate-tab))
422  ("A-space" (make-space "0.2spc"))
423  ("A-S-space" (make-space "-0.2spc"))
424  ("M-space" (make-space "0.2spc"))
425  ("M-S-space" (make-space "-0.2spc"))
426  ("M-tab" (kbd-alternate-tab))
427  ("M-S-tab" (kbd-shift-alternate-tab)))
428
429;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
430;; Gnome keymap
431;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
432
433(kbd-map
434  (:profile gnome)
435
436  ;; standard Gnome shortcuts
437  ("gnome d" (remove-text #t))
438  ("gnome h" (interactive-replace))
439  ("gnome k" (kill-paragraph))
440  ("gnome left" (traverse-left))
441  ("gnome right" (traverse-right))
442  ("gnome home" (go-start))
443  ("gnome end" (go-end))
444  ("gnome S-left" (kbd-select traverse-left))
445  ("gnome S-right" (kbd-select traverse-right))
446  ("gnome S-home" (kbd-select go-start))
447  ("gnome S-end" (kbd-select go-end))
448
449  ("F14" (undo 0))
450  ("F16" (clipboard-copy "primary"))
451  ("F18" (clipboard-paste "primary"))
452  ("F20" (clipboard-cut "primary"))
453  ("C-insert" (clipboard-copy "primary"))
454  ("S-insert" (clipboard-paste "primary"))
455  ("S-delete" (clipboard-cut "primary"))
456  ("gnome c" (clipboard-copy "primary"))
457  ("gnome v" (clipboard-paste "primary"))
458  ("gnome x" (clipboard-cut "primary"))
459  ("A-left" (cursor-history-backward))
460  ("A-right" (cursor-history-forward))
461
462  ("search F3" (search-next-match #t))
463  ("search S-F3" (search-next-match #f))
464  ("search gnome g" (search-next-match #t))
465  ("search gnome G" (search-next-match #f))
466
467  ;; not yet implemented
468  ;;("gnome delete" (delete-end-word))
469  ;;("gnome backspace" (delete-start-word))
470  ;;("forward" (next-tab))
471  ;;("back" (previous-tab))
472
473  ;; further shortcuts for Gnome look and feel
474  ("gnome g" (selection-cancel))
475  ("gnome F" (interactive-search))
476
477  ("altcmd g" (clipboard-clear "primary"))
478  ("altcmd q" (make 'symbol))
479  ("altcmd x" (interactive footer-eval))
480  ("altcmd X" (interactive exec-interactive-command))
481  ("altcmd $" (spell-start))
482
483  ("M-A-C-home" (traverse-first))
484  ("M-A-C-end" (traverse-last))
485  ("M-A-C-S-home" (kbd-select traverse-first))
486  ("M-A-C-S-end" (kbd-select traverse-last)))
487
488(kbd-map
489  (:profile gnome)
490  (:require (and (not (in-prog?)) (not (in-verbatim?))))
491  ("M-tab" (kbd-alternate-tab))
492  ("M-S-tab" (kbd-shift-alternate-tab))
493  ("M-space" (make-space "0.2spc"))
494  ("M-S-space" (make-space "-0.2spc")))
495
496;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
497;; KDE keymap
498;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
499
500(kbd-map
501  (:profile kde)
502
503  ;; standard KDE shortcuts
504  ("kde d" (remove-text #t))
505  ("kde k" (kill-paragraph))
506  ("kde r" (interactive-replace))
507  ("kde left" (traverse-left))
508  ("kde right" (traverse-right))
509  ("kde home" (go-start))
510  ("kde end" (go-end))
511  ("kde S-left" (kbd-select traverse-left))
512  ("kde S-right" (kbd-select traverse-right))
513  ("kde S-home" (kbd-select go-start))
514  ("kde S-end" (kbd-select go-end))
515
516  ("F14" (undo 0))
517  ("F16" (clipboard-copy "primary"))
518  ("F18" (clipboard-paste "primary"))
519  ("F20" (clipboard-cut "primary"))
520  ("C-insert" (clipboard-copy "primary"))
521  ("S-insert" (clipboard-paste "primary"))
522  ("S-delete" (clipboard-cut "primary"))
523  ("A-left" (cursor-history-backward))
524  ("A-right" (cursor-history-forward))
525
526  ("search F3" (search-next-match #t))
527  ("search S-F3" (search-next-match #f))
528
529  ;; not yet implemented
530  ;;("kde N" (add-tab))
531  ;;("kde delete" (delete-end-word))
532  ;;("kde backspace" (delete-start-word))
533  ;;("forward" (next-tab))
534  ;;("back" (previous-tab))
535
536  ;; further shortcuts for KDE look and feel
537  ("kde g" (selection-cancel))
538  ("kde F" (interactive-search))
539
540  ("altcmd g" (clipboard-clear "primary"))
541  ("altcmd q" (make 'symbol))
542  ("altcmd x" (interactive footer-eval))
543  ("altcmd X" (interactive exec-interactive-command))
544  ("altcmd $" (spell-start))
545
546  ("M-A-C-home" (traverse-first))
547  ("M-A-C-end" (traverse-last))
548  ("M-A-C-S-home" (kbd-select traverse-first))
549  ("M-A-C-S-end" (kbd-select traverse-last)))
550
551(kbd-map
552  (:profile kde)
553  (:require (and (not (in-prog?)) (not (in-verbatim?))))
554  ("M-tab" (kbd-alternate-tab))
555  ("M-S-tab" (kbd-shift-alternate-tab))
556  ("M-space" (make-space "0.2spc"))
557  ("M-S-space" (make-space "-0.2spc")))
558
559;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
560;; Mac OS keymap
561;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
562
563(kbd-map
564  (:profile macos)
565
566  ;; standard Mac OS keyboard shortcuts
567  ("macos ;" (spell-start))
568  ("macos ?" (interactive docgrep-in-doc))
569  ("macos ," (interactive open-preferences))
570  ("macos [" (cursor-history-backward))
571  ("macos ]" (cursor-history-forward))
572  ("macos left" (kbd-start-line))
573  ("macos right" (kbd-end-line))
574  ("macos up" (go-start))
575  ("macos down" (go-end))
576  ("macos S-left" (kbd-select kbd-start-line))
577  ("macos S-right" (kbd-select kbd-end-line))
578  ("macos S-up" (kbd-select go-start))
579  ("macos S-down" (kbd-select go-end))
580
581  ("search macos g" (search-next-match #t))
582  ("search macos G" (search-next-match #f))
583
584  ;; not yet supported
585  ;;("macos :" (display-spelling-window))
586  ;;("macos ," (open-preferences))
587  ;;("macos A-/" (toggle-antialising))
588  ;;("macos #" (capture-screen-to-file))
589  ;;("macos C-#" (capture-screen-to-clipboard))
590  ;;("macos $" (capture-selection-to-file))
591  ;;("macos C-$" (capture-selection-to-clipboard))
592  ;;("macos C" (show-colors-window))
593  ;;("macos C-c" (copy-style))
594  ;;("macos A-c" (copy-formatting))
595  ;;("macos C-d" (show-definition-word))
596  ;;("macos A-d" (toggle-doc))
597  ;;("macos e" (search-selection))
598  ;;("macos h" (hide-window))
599  ;;("macos A-h" (hide-other-windows))
600  ;;("macos A-i" (show-inspector-window))
601  ;;("macos j" (scroll-to-selection))
602  ;;("macos m" (minimize-window))
603  ;;("macos A-m" (minimize-all-windows))
604  ;;("macos P" (printer-setup))
605  ;;("macos t" (show-fonts-window))
606  ;;("macos A-t" (toggle-toolbar))
607  ;;("macos C-v" (paste-style))
608  ;;("macos C-V" (paste-match-style))
609  ;;("macos A-v" (paste-formatting))
610  ;;("macos A-w" (safely-kill-all-windows))
611  ;;("macos C-x" (cut-style))       ;; TeXmacs addition
612  ;;("macos A-x" (cut-formatting))  ;; TeXmacs addition
613
614  ;; further shortcuts for MacOS look and feel
615  ("macos r" (interactive-replace))
616  ("macos F" (toggle-full-screen-mode))
617  ("macos C-f" (toggle-full-screen-edit-mode))
618
619  ("macos A-u" (toggle-preamble))
620  ("altcmd x" (interactive footer-eval))
621  ("altcmd X" (interactive exec-interactive-command))
622
623  ;("C-a" (kbd-start-line)) ; conflict with ("text a" (make 'abbr))
624  ;("C-e" (kbd-end-line))   ; conflict with ("text e" (make-tmlist 'enumerate))
625  ("C-g" (selection-cancel))
626  ("C-k" (kill-paragraph))
627  ("C-y" (yank-paragraph))
628  ("C-q" (make 'symbol))
629  ("C-!" (make-label))
630  ("C-?" (make 'reference)))
631
632(kbd-map
633  (:profile macos)
634  (:require (and (not (in-prog?)) (not (in-verbatim?))))
635  ("C-tab" (kbd-alternate-tab))
636  ("C-S-tab" (kbd-shift-alternate-tab))
637  ("C-space" (make-space "0.2spc"))
638  ("C-S-space" (make-space "-0.2spc")))
639
640;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
641;; Windows keymap
642;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
643
644(kbd-map
645  (:profile windows)
646
647  ;; standard Windows shortcuts
648  ("windows F4" (safely-kill-buffer))
649  ("windows left" (traverse-left))
650  ("windows right" (traverse-right))
651  ("windows home" (go-start))
652  ("windows end" (go-end))
653  ("windows S-left" (kbd-select traverse-left))
654  ("windows S-right" (kbd-select traverse-right))
655  ("windows S-home" (kbd-select go-start))
656  ("windows S-end" (kbd-select go-end))
657  ("windows S-space" (make 'nbsp))
658  ("windows _" (make 'nbhyph))
659  ("windows -" "--")
660  ("windows A--" (make 'emdash))
661  ("windows A-." "<ldots>")
662  ("windows A-c" (make 'copyright))
663  ("windows e" (make 'footnote))
664  ("windows F" (make 'footnote))
665  ("windows h" (interactive-replace))
666  ("windows k" (make 'hlink))
667  ("windows K" (toggle-small-caps))
668  ("windows A-r" (make 'registered))
669  ("windows A-t" (make 'trademark))
670  ("windows y" (redo 0))
671
672  ("F2" (interactive-replace))
673  ("S-delete" (clipboard-cut "primary"))
674  ("S-insert" (clipboard-paste "primary"))
675  ("C-insert" (clipboard-copy "primary"))
676  ("A-F4" (safely-kill-buffer))
677  ("A-left" (cursor-history-backward))
678  ("A-right" (cursor-history-forward))
679
680  ("search windows g" (search-next-match #t))
681  ("search windows G" (search-next-match #f))
682  ("search F3" (search-next-match #t))
683  ("search S-F3" (search-next-match #f))
684
685  ;; not yet implemented
686  ;;("F4" (go-to-different-folder))
687  ;;("F5" (refresh-window))
688  ;;("F6" (switch-to-next-pane))
689  ;;("F8" (kbd-select-enlarge))
690  ;;("F9" (refresh-web-page))
691  ;;("C-F9" (insert-field))
692  ;;("F10" (menu-bar-options))
693  ;;("S-F10" (open-contextual-menu))
694  ;;("windows F4" (close-mdi-window))
695  ;;("windows F6" (next-tab))
696  ;;("windows S-F6" (previous-tab))
697  ;;("windows delete" (delete-end-word))
698  ;;("windows backspace" (delete-start-word))
699  ;;("windows tab" (switch-to-next-child))
700  ;;("windows escape" (open-start-menu))
701  ;;("windows S-escape" (open-task-manager))
702  ;;("windows S-return" (insert-section-break))
703  ;;("windows C" (copy-formatting))
704  ;;("windows D" (insert-endnote))
705  ;;("windows E" (review-toggle-track-changes))
706  ;;("windows g" (go-to-location))
707  ;;("windows A-m" (review-insert-comment))
708  ;;("windows V" (paste-formatting))
709  ;;("windows A-y" (search-repeat))
710  ;;("windows <" (decrease-font-size))
711  ;;("windows >" (increase-font-size))
712  ;;("windows [" (decrease-font-size-one-point))
713  ;;("windows ]" (increase-font-size-one-point))
714  ;;("windows ` `" (open-single-quotation))
715  ;;("windows ' '" (close-single-quotation))
716  ;;("windows ` C-`" (open-double-quotation))
717  ;;("windows ' C-'" (close-double-quotation))
718  ;;("S-delete" (delete-selection-immediately))
719  ;;("A-F6" (switch-to-next-window))
720  ;;("A-tab" (switch-to-next-program))
721  ;;("A-down" (open-drop-down-list-box))
722  ;;("A-space" (open-system-menu))
723  ;;("A-return" (open-properties-window))
724  ;;("A-I" (insert-citation-entry))
725  ;;("A-O" (insert-toc-entry))
726  ;;("A-X" (insert-index-entry))
727  ;;("A--" (open-child-system-menu))
728  ;;("A-_" (open-menu))
729  ;;("M-F1" (run-dialog-box))
730  ;;("M-tab" (cycle-taskbar-button))
731  ;;("M-space" (show-keyboard-shortcuts))
732  ;;("M-c" (open-control-panel))
733  ;;("M-d" (minimize-all-open-windows))
734  ;;("M-e" (open-explorer-window))
735  ;;("M-C-f" (find-computer))
736  ;;("M-f" (open-finder-window))
737  ;;("M-i" (open-mouse-properties-window))
738  ;;("M-k" (open-keyboard-properties-window))
739  ;;("M-l" (log-off-windows))
740  ;;("M-m" (minimize-all-windows))
741  ;;("M-M" (unminimize-all-windows))
742  ;;("M-p" (start-print-manager))
743  ;;("M-r" (run-dialog-box))
744  ;;("M-s" (toggle-caps-lock))
745  ;;("M-v" (start-clipboard))
746  ;;("forward" (next-tab))
747  ;;("back" (previous-tab))
748
749  ;; further shortcuts for Windows look and feel
750  ("windows g" (selection-cancel))
751
752  ("altcmd g" (clipboard-clear "primary"))
753  ("altcmd q" (make 'symbol))
754  ("altcmd x" (interactive footer-eval))
755  ("altcmd X" (interactive exec-interactive-command))
756  ("altcmd $" (spell-start))
757
758  ("M-A-C-home" (traverse-first))
759  ("M-A-C-end" (traverse-last))
760  ("M-A-C-S-home" (kbd-select traverse-first))
761  ("M-A-C-S-end" (kbd-select traverse-last)))
762
763(kbd-map
764  (:profile windows)
765  (:require (and (not (in-prog?)) (not (in-verbatim?))))
766  ("M-tab" (kbd-alternate-tab))
767  ("M-S-tab" (kbd-shift-alternate-tab))
768  ("M-space" (make-space "0.2spc"))
769  ("M-S-space" (make-space "-0.2spc")))
770