Skip to content

Instantly share code, notes, and snippets.

@yanyingwang
Created April 30, 2022 08:42
Show Gist options
  • Save yanyingwang/dc4a9e71e27d6987611e07516e75cea6 to your computer and use it in GitHub Desktop.
Save yanyingwang/dc4a9e71e27d6987611e07516e75cea6 to your computer and use it in GitHub Desktop.
/* ~/.config/gtk-3.0/gtk.css */
/*
https://askubuntu.com/questions/221291/remove-ugly-fat-bazel-from-gnome-terminal-with-multiple-tabs
https://www.preining.info/blog/2020/03/de-uglify-gtk3-tabs-of-terminals/
https://bbs.archlinux.org/viewtopic.php?id=221876
https://wiki.archlinux.org/title/Terminator#GTK.2B_customization
*/
notebook tab {
min-height: 0;
padding: 0px;
margin: 0px;
font-size: 14px;
font-weight: 800;
}
notebook tab button {
min-height: 0;
min-width: 0;
padding: 0px;
margin: 0px;
}
/* @import url("file:///usr/share/themes/Emacs/gtk-3.0/gtk-keys.css"); */
/* A keybinding set implementing Emacs-like keybindings */
/* Bindings for GtkTextView and GtkEntry */
@binding-set gtk-emacs-text-entry
{
bind "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) };
bind "<shift><ctrl>b" { "move-cursor" (logical-positions, -1, 1) };
bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) };
bind "<shift><ctrl>f" { "move-cursor" (logical-positions, 1, 1) };
bind "<alt>b" { "move-cursor" (words, -1, 0) };
bind "<shift><alt>b" { "move-cursor" (words, -1, 1) };
bind "<ctrl><alt><shift>b" { "move-cursor" (words, -1, 1) };
bind "<alt>f" { "move-cursor" (words, 1, 0) };
bind "<shift><alt>f" { "move-cursor" (words, 1, 1) };
bind "<ctrl><alt><shift>f" { "move-cursor" (words, 1, 1) };
bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) };
bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) };
bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) };
bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) };
bind "<ctrl>w" { "cut-clipboard" () };
bind "<alt>w" { "copy-clipboard" () };
bind "<ctrl>y" { "paste-clipboard" () };
bind "<ctrl><alt>w" { "cut-clipboard" () };
bind "<ctrl><alt><shift>w" { "cut-clipboard" () };
bind "<alt>x" { "cut-clipboard" () };
bind "<alt>c" { "copy-clipboard" () };
bind "<alt>v" { "paste-clipboard" () };
bind "<ctrl>d" { "delete-from-cursor" (chars, 1) };
bind "<alt>d" { "delete-from-cursor" (word-ends, 1) };
bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) };
bind "<alt>backslash" { "delete-from-cursor" (whitespace, 1) };
bind "<alt>space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
bind "<alt><shift>space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
bind "<ctrl><alt>space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
bind "<alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
bind "<alt><shft>KP_Space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
bind "<ctrl><alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
/*
* Some non-Emacs keybindings people are attached to
*/
bind "<ctrl>u" { "move-cursor" (paragraph-ends, -1, 0)
"delete-from-cursor" (paragraph-ends, 1) };
bind "<ctrl>h" { "delete-from-cursor" (chars, -1) };
bind "<alt>h" { "delete-from-cursor" (word-ends, -1) };
bind "<ctrl><alt>h" { "delete-from-cursor" (word-ends, -1) };
/* bind "<ctrl>w" { "delete-from-cursor" (word-ends, -1) }; */
bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) };
bind "<ctrl><alt>backspace" { "delete-from-cursor" (word-ends, -1) };
}
/* Bindings for GtkTextView */
@binding-set gtk-emacs-text-view
{
bind "<ctrl>p" { "move-cursor" (display-lines, -1, 0) };
bind "<shift><ctrl>p" { "move-cursor" (display-lines, -1, 1) };
bind "<ctrl>n" { "move-cursor" (display-lines, 1, 0) };
bind "<shift><ctrl>n" { "move-cursor" (display-lines, 1, 1) };
bind "<alt>p" { "move-cursor" (display-lines, -1, 0) };
bind "<shift><alt>p" { "move-cursor" (display-lines, -1, 1) };
bind "<alt>n" { "move-cursor" (display-lines, 1, 0) };
bind "<shift><alt>n" { "move-cursor" (display-lines, 1, 1) };
bind "<ctrl>space" { "set-anchor" () };
bind "<ctrl>KP_Space" { "set-anchor" () };
}
/*
* Bindings for GtkTreeView
*/
@binding-set gtk-emacs-tree-view
{
bind "<ctrl>s" { "start-interactive-search" () };
bind "<ctrl><alt><shift>s" { "start-interactive-search" () };
bind "<ctrl>f" { "move-cursor" (logical-positions, 1) };
bind "<ctrl>b" { "move-cursor" (logical-positions, -1) };
}
/*
* Bindings for menus
*/
@binding-set gtk-emacs-menu
{
bind "<ctrl>n" { "move-current" (next) };
bind "<ctrl>p" { "move-current" (prev) };
bind "<ctrl>f" { "move-current" (child) };
bind "<ctrl>b" { "move-current" (parent) };
bind "<alt>n" { "move-current" (next) };
bind "<alt>p" { "move-current" (prev) };
bind "<alt>f" { "move-current" (child) };
bind "<alt>b" { "move-current" (parent) };
}
entry {
-gtk-key-bindings: gtk-emacs-text-entry, gtk-emacs-text-view;
}
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment