Skip to content

Instantly share code, notes, and snippets.

@avsej
Created July 1, 2010 08:40
Show Gist options
  • Save avsej/459731 to your computer and use it in GitHub Desktop.
Save avsej/459731 to your computer and use it in GitHub Desktop.
vi-like keybindings for GTK
# A key-binding set for vi-like key-bindings
binding "gtk-vi-text-view"
{
bind "<ctrl>d" { "move-cursor" (display-lines, 5, 0) }
bind "<ctrl>f" { "move-cursor" (display-lines, 5, 0) }
bind "<ctrl>u" { "move-cursor" (display-lines, -5, 0) }
bind "<ctrl>b" { "move-cursor" (display-lines, -5, 0) }
bind "<ctrl>e" { "move-cursor" (display-lines, -1, 0) }
bind "<ctrl>y" { "move-cursor" (display-lines, 1, 0) }
}
binding "gtk-vi-tree-view"
{
bind "j" { "move-cursor" (display-lines, 1) }
bind "k" { "move-cursor" (display-lines, -1) }
bind "l" { "move-cursor" (logical-positions, 1) }
bind "h" { "move-cursor" (logical-positions, -1) }
}
class "GtkTextView" binding "gtk-vi-text-view"
class "GtkTreeView" binding "gtk-vi-tree-view"
binding "gtk-vi-text-entry" {
bind "<ctrl>h" { "delete-from-cursor" (chars, -1) }
bind "<ctrl>u" { "delete-from-cursor" (paragraph-ends, -1) }
bind "<ctrl>w" { "delete-from-cursor" (word-ends, -1) }
}
class "GtkEntry" binding "gtk-vi-text-entry"
class "GtkTextView" binding "gtk-vi-text-entry"
binding "gtk-binding-menu" {
bind "j" { "move-current" (next) }
bind "k" { "move-current" (prev) }
bind "h" { "move-current" (parent) }
bind "l" { "move-current" (child) }
}
class "GtkMenuShell" binding "gtk-binding-menu"
cp gtkrc ~/.themes/vim/gtk-2.0-key/gtkrc
gconftool-2 -s /desktop/gnome/interface/gtk_key_theme --type string "vi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment