diff --git a/dotfiles/config/gtk-3.0/gtk.css b/dotfiles/config/gtk-3.0/gtk.css deleted file mode 100644 index e4a84cd1..00000000 --- a/dotfiles/config/gtk-3.0/gtk.css +++ /dev/null @@ -1,90 +0,0 @@ -@binding-set gtk-emacs-text-entry -{ - bind "b" { "move-cursor" (logical-positions, -1, 0) }; - bind "b" { "move-cursor" (logical-positions, -1, 1) }; - bind "f" { "move-cursor" (logical-positions, 1, 0) }; - bind "f" { "move-cursor" (logical-positions, 1, 1) }; - - bind "b" { "move-cursor" (words, -1, 0) }; - bind "b" { "move-cursor" (words, -1, 1) }; - bind "f" { "move-cursor" (words, 1, 0) }; - bind "f" { "move-cursor" (words, 1, 1) }; - - bind "a" { "move-cursor" (paragraph-ends, -1, 0) }; - bind "a" { "move-cursor" (paragraph-ends, -1, 1) }; - bind "e" { "move-cursor" (paragraph-ends, 1, 0) }; - bind "e" { "move-cursor" (paragraph-ends, 1, 1) }; - - bind "w" { "cut-clipboard" () }; - bind "y" { "paste-clipboard" () }; - - bind "d" { "delete-from-cursor" (chars, 1) }; - bind "d" { "delete-from-cursor" (word-ends, 1) }; - bind "BackSpace" { "delete-from-cursor" (word-ends, -1) }; - bind "k" { "delete-from-cursor" (paragraph-ends, 1) }; - - bind "space" { "delete-from-cursor" (whitespace, 1) - "insert-at-cursor" (" ") }; - bind "KP_Space" { "delete-from-cursor" (whitespace, 1) - "insert-at-cursor" (" ") }; - /* - * Some non-Emacs keybindings people are attached to - */ - bind "u" { "move-cursor" (paragraph-ends, -1, 0) - "delete-from-cursor" (paragraph-ends, 1) }; - - bind "h" { "delete-from-cursor" (chars, -1) }; - bind "w" { "delete-from-cursor" (word-ends, -1) }; -} - -/* - * Bindings for GtkTextView - */ -@binding-set gtk-emacs-text-view -{ - bind "p" { "move-cursor" (display-lines, -1, 0) }; - bind "p" { "move-cursor" (display-lines, -1, 1) }; - bind "n" { "move-cursor" (display-lines, 1, 0) }; - bind "n" { "move-cursor" (display-lines, 1, 1) }; - - bind "space" { "set-anchor" () }; - bind "KP_Space" { "set-anchor" () }; -} - -/* - * Bindings for GtkTreeView - */ -@binding-set gtk-emacs-tree-view -{ - bind "s" { "start-interactive-search" () }; - bind "f" { "move-cursor" (logical-positions, 1) }; - bind "b" { "move-cursor" (logical-positions, -1) }; -} - -/* - * Bindings for menus - */ -@binding-set gtk-emacs-menu -{ - bind "n" { "move-current" (next) }; - bind "p" { "move-current" (prev) }; - bind "f" { "move-current" (child) }; - bind "b" { "move-current" (parent) }; -} - -entry { - -gtk-key-bindings: gtk-emacs-text-entry; -} - -textview { - -gtk-key-bindings: gtk-emacs-text-entry, gtk-emacs-text-view; -} - -treeview { - -gtk-key-bindings: gtk-emacs-tree-view; -} - -GtkMenuShell { - -gtk-key-bindings: gtk-emacs-menu; -} -@import 'colors.css'; \ No newline at end of file diff --git a/dotfiles/gitignore b/dotfiles/gitignore index c8a1edcb..4be869d3 100644 --- a/dotfiles/gitignore +++ b/dotfiles/gitignore @@ -74,6 +74,7 @@ cabal.project.local # .direnv /dotfiles/config/gtk-3.0/settings.ini +/dotfiles/config/gtk-3.0/gtk.css /untracked diff --git a/nixos/home-manager.nix b/nixos/home-manager.nix index b11c2f42..13fb88f9 100644 --- a/nixos/home-manager.nix +++ b/nixos/home-manager.nix @@ -283,5 +283,98 @@ in { gtk-xft-hintstyle = "hintslight"; gtk-xft-rgba = "rgb"; }; + + gtk3.extraCss = '' + @binding-set gtk-emacs-text-entry + { + bind "b" { "move-cursor" (logical-positions, -1, 0) }; + bind "b" { "move-cursor" (logical-positions, -1, 1) }; + bind "f" { "move-cursor" (logical-positions, 1, 0) }; + bind "f" { "move-cursor" (logical-positions, 1, 1) }; + + bind "b" { "move-cursor" (words, -1, 0) }; + bind "b" { "move-cursor" (words, -1, 1) }; + bind "f" { "move-cursor" (words, 1, 0) }; + bind "f" { "move-cursor" (words, 1, 1) }; + + bind "a" { "move-cursor" (paragraph-ends, -1, 0) }; + bind "a" { "move-cursor" (paragraph-ends, -1, 1) }; + bind "e" { "move-cursor" (paragraph-ends, 1, 0) }; + bind "e" { "move-cursor" (paragraph-ends, 1, 1) }; + + bind "w" { "cut-clipboard" () }; + bind "y" { "paste-clipboard" () }; + + bind "d" { "delete-from-cursor" (chars, 1) }; + bind "d" { "delete-from-cursor" (word-ends, 1) }; + bind "BackSpace" { "delete-from-cursor" (word-ends, -1) }; + bind "k" { "delete-from-cursor" (paragraph-ends, 1) }; + + bind "space" { "delete-from-cursor" (whitespace, 1) + "insert-at-cursor" (" ") }; + bind "KP_Space" { "delete-from-cursor" (whitespace, 1) + "insert-at-cursor" (" ") }; + /* + * Some non-Emacs keybindings people are attached to + */ + bind "u" { "move-cursor" (paragraph-ends, -1, 0) + "delete-from-cursor" (paragraph-ends, 1) }; + + bind "h" { "delete-from-cursor" (chars, -1) }; + bind "w" { "delete-from-cursor" (word-ends, -1) }; + } + + /* + * Bindings for GtkTextView + */ + @binding-set gtk-emacs-text-view + { + bind "p" { "move-cursor" (display-lines, -1, 0) }; + bind "p" { "move-cursor" (display-lines, -1, 1) }; + bind "n" { "move-cursor" (display-lines, 1, 0) }; + bind "n" { "move-cursor" (display-lines, 1, 1) }; + + bind "space" { "set-anchor" () }; + bind "KP_Space" { "set-anchor" () }; + } + + /* + * Bindings for GtkTreeView + */ + @binding-set gtk-emacs-tree-view + { + bind "s" { "start-interactive-search" () }; + bind "f" { "move-cursor" (logical-positions, 1) }; + bind "b" { "move-cursor" (logical-positions, -1) }; + } + + /* + * Bindings for menus + */ + @binding-set gtk-emacs-menu + { + bind "n" { "move-current" (next) }; + bind "p" { "move-current" (prev) }; + bind "f" { "move-current" (child) }; + bind "b" { "move-current" (parent) }; + } + + entry { + -gtk-key-bindings: gtk-emacs-text-entry; + } + + textview { + -gtk-key-bindings: gtk-emacs-text-entry, gtk-emacs-text-view; + } + + treeview { + -gtk-key-bindings: gtk-emacs-tree-view; + } + + GtkMenuShell { + -gtk-key-bindings: gtk-emacs-menu; + } + @import 'colors.css'; + ''; }; }