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