You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

114 lines
3.7 KiB

  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, write to the
  16. # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. # Boston, MA 02111-1307, USA.
  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. # A keybinding set implementing emacs-like keybindings
  24. #
  25. #
  26. # Bindings for GtkTextView and GtkEntry
  27. #
  28. binding "gtk-emacs-text-entry"
  29. {
  30. bind "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) }
  31. bind "<shift><ctrl>b" { "move-cursor" (logical-positions, -1, 1) }
  32. bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) }
  33. bind "<shift><ctrl>f" { "move-cursor" (logical-positions, 1, 1) }
  34. bind "<alt>b" { "move-cursor" (words, -1, 0) }
  35. bind "<shift><alt>b" { "move-cursor" (words, -1, 1) }
  36. bind "<alt>f" { "move-cursor" (words, 1, 0) }
  37. bind "<shift><alt>f" { "move-cursor" (words, 1, 1) }
  38. bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) }
  39. bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) }
  40. bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) }
  41. bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) }
  42. bind "<ctrl>w" { "cut-clipboard" () }
  43. bind "<ctrl>y" { "paste-clipboard" () }
  44. bind "<ctrl>d" { "delete-from-cursor" (chars, 1) }
  45. bind "<alt>d" { "delete-from-cursor" (word-ends, 1) }
  46. bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) }
  47. bind "<alt>backslash" { "delete-from-cursor" (whitespace, 1) }
  48. bind "<alt>space" { "delete-from-cursor" (whitespace, 1)
  49. "insert-at-cursor" (" ") }
  50. bind "<alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
  51. "insert-at-cursor" (" ") }
  52. #
  53. # Some non-Emacs keybindings people are attached to
  54. #
  55. bind "<ctrl>u" {
  56. "move-cursor" (paragraph-ends, -1, 0)
  57. "delete-from-cursor" (paragraph-ends, 1)
  58. }
  59. bind "<ctrl>h" { "delete-from-cursor" (chars, -1) }
  60. bind "<ctrl>w" { "delete-from-cursor" (word-ends, -1) }
  61. }
  62. #
  63. # Bindings for GtkTextView
  64. #
  65. binding "gtk-emacs-text-view"
  66. {
  67. bind "<ctrl>p" { "move-cursor" (display-lines, -1, 0) }
  68. bind "<shift><ctrl>p" { "move-cursor" (display-lines, -1, 1) }
  69. bind "<ctrl>n" { "move-cursor" (display-lines, 1, 0) }
  70. bind "<shift><ctrl>n" { "move-cursor" (display-lines, 1, 1) }
  71. bind "<ctrl>space" { "set-anchor" () }
  72. bind "<ctrl>KP_Space" { "set-anchor" () }
  73. }
  74. #
  75. # Bindings for GtkTreeView
  76. #
  77. binding "gtk-emacs-tree-view"
  78. {
  79. bind "<ctrl>s" { "start-interactive-search" () }
  80. bind "<ctrl>f" { "move-cursor" (logical-positions, 1) }
  81. bind "<ctrl>b" { "move-cursor" (logical-positions, -1) }
  82. }
  83. #
  84. # Bindings for menus
  85. #
  86. binding "gtk-emacs-menu"
  87. {
  88. bind "<ctrl>n" { "move-current" (next) }
  89. bind "<ctrl>p" { "move-current" (prev) }
  90. bind "<ctrl>f" { "move-current" (child) }
  91. bind "<ctrl>b" { "move-current" (parent) }
  92. }
  93. class "GtkEntry" binding "gtk-emacs-text-entry"
  94. class "GtkTextView" binding "gtk-emacs-text-entry"
  95. class "GtkTextView" binding "gtk-emacs-text-view"
  96. class "GtkTreeView" binding "gtk-emacs-tree-view"
  97. class "GtkMenuShell" binding "gtk-emacs-menu"