]> Pileus Git - ~andy/gtk/blob - gtk/gtk-keys.css.emacs
Convert the Emacs key theme to css
[~andy/gtk] / gtk / gtk-keys.css.emacs
1 /*
2  * GTK - The GIMP Toolkit
3  * Copyright (C) 2002 Owen Taylor
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 /*
22  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
23  * file for a list of people on the GTK+ Team.  See the ChangeLog
24  * files for a list of changes.  These files are distributed with
25  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
26  */
27
28 /*
29  * A keybinding set implementing Emacs-like keybindings
30  */
31
32 /*
33  * Bindings for GtkTextView and GtkEntry
34  */
35 @binding-set gtk-emacs-text-entry
36 {
37   bind "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) };
38   bind "<shift><ctrl>b" { "move-cursor" (logical-positions, -1, 1) };
39   bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) };
40   bind "<shift><ctrl>f" { "move-cursor" (logical-positions, 1, 1) };
41
42   bind "<alt>b" { "move-cursor" (words, -1, 0) };
43   bind "<shift><alt>b" { "move-cursor" (words, -1, 1) };
44   bind "<alt>f" { "move-cursor" (words, 1, 0) };
45   bind "<shift><alt>f" { "move-cursor" (words, 1, 1) };
46
47   bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) };
48   bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) };
49   bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) };
50   bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) };
51
52   bind "<ctrl>w" { "cut-clipboard" () };
53   bind "<ctrl>y" { "paste-clipboard" () };
54
55   bind "<ctrl>d" { "delete-from-cursor" (chars, 1) };
56   bind "<alt>d" { "delete-from-cursor" (word-ends, 1) };
57   bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) };
58   bind "<alt>backslash" { "delete-from-cursor" (whitespace, 1) };
59
60   bind "<alt>space" { "delete-from-cursor" (whitespace, 1)
61                       "insert-at-cursor" (" ") };
62   bind "<alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
63                          "insert-at-cursor" (" ")  };
64   /*
65    * Some non-Emacs keybindings people are attached to
66    */
67   bind "<ctrl>u" { "move-cursor" (paragraph-ends, -1, 0)
68                    "delete-from-cursor" (paragraph-ends, 1) };
69
70   bind "<ctrl>h" { "delete-from-cursor" (chars, -1) };
71   bind "<ctrl>w" { "delete-from-cursor" (word-ends, -1) };
72 };
73
74 /*
75  * Bindings for GtkTextView
76  */
77 @binding-set gtk-emacs-text-view
78 {
79   bind "<ctrl>p" { "move-cursor" (display-lines, -1, 0) };
80   bind "<shift><ctrl>p" { "move-cursor" (display-lines, -1, 1) };
81   bind "<ctrl>n" { "move-cursor" (display-lines, 1, 0) };
82   bind "<shift><ctrl>n" { "move-cursor" (display-lines, 1, 1) };
83
84   bind "<ctrl>space" { "set-anchor" () };
85   bind "<ctrl>KP_Space" { "set-anchor" () };
86 };
87
88 /*
89  * Bindings for GtkTreeView
90  */
91 @binding-set gtk-emacs-tree-view
92 {
93   bind "<ctrl>s" { "start-interactive-search" () };
94   bind "<ctrl>f" { "move-cursor" (logical-positions, 1) };
95   bind "<ctrl>b" { "move-cursor" (logical-positions, -1) };
96 };
97
98 /*
99  * Bindings for menus
100  */
101 @binding-set gtk-emacs-menu
102 {
103   bind "<ctrl>n" { "move-current" (next) };
104   bind "<ctrl>p" { "move-current" (prev) };
105   bind "<ctrl>f" { "move-current" (child) };
106   bind "<ctrl>b" { "move-current" (parent) };
107 };
108
109 GtkEntry {
110   gtk-key-bindings: gtk-emacs-text-entry;
111 }
112
113 GtkTextView {
114   gtk-key-bindings: gtk-emacs-text-entry, gtk-emacs-text-view;
115 }
116
117 GtkTreeView {
118   gtk-key-bindings: gtk-emacs-tree-view;
119 }
120
121 GtkMenuShell {
122   gtk-key-bindings: gtk-emacs-menu;
123 }