From 358763c97b42f4e323571aca32faa8ed483d41d3 Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Sun, 24 Sep 2023 14:39:34 -0400 Subject: [PATCH] config --- home/gburd/features/cli/fish.nix | 149 +++++++++++++++++- .../gburd/features/desktop/common/default.nix | 1 + home/gburd/features/desktop/common/gtk.nix | 2 +- home/gburd/features/desktop/common/slack.nix | 2 +- home/gburd/features/emacs/default.nix | 30 ++-- hosts/common/optional/gnome.nix | 3 +- 6 files changed, 164 insertions(+), 23 deletions(-) diff --git a/home/gburd/features/cli/fish.nix b/home/gburd/features/cli/fish.nix index 52da232..90d421d 100644 --- a/home/gburd/features/cli/fish.nix +++ b/home/gburd/features/cli/fish.nix @@ -82,13 +82,152 @@ in source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish" set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d" '' + + # Use Emacs bindings and cursors + # https://gist.githubusercontent.com/zuigon/8852793/raw/770d705897112a870adc2b27d056a61892aa3a9a/keybindings.fish + '' + function fish_enable_emacs_key_bindings -d "Default (Emacs-like) key bindings for fish" + + # Clear earlier bindings, if any + bind --erase --all + + # This is the default binding, i.e. the one used if no other binding matches + bind "" self-insert + + bind \n execute + + bind \ck kill-line + bind \cy yank + bind \t complete + + bind \e\n "commandline -i \n" + + bind \e\[A up-or-search + bind \e\[B down-or-search + bind -k down down-or-search + bind -k up up-or-search + + bind \e\[C forward-char + bind \e\[D backward-char + bind -k right forward-char + bind -k left backward-char + + bind -k dc delete-char + bind -k backspace backward-delete-char + bind \x7f backward-delete-char + + bind \e\[H beginning-of-line + bind \e\[F end-of-line + + # for PuTTY + # https://github.com/fish-shell/fish-shell/issues/180 + bind \e\[1~ beginning-of-line + bind \e\[3~ delete-char + bind \e\[4~ end-of-line + + # OS X SnowLeopard doesn't have these keys. Don't show an annoying error message. + bind -k home beginning-of-line 2> /dev/null + bind -k end end-of-line 2> /dev/null + bind \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-delete + + bind \e\eOC nextd-or-forward-word + bind \e\eOD prevd-or-backward-word + bind \e\e\[C nextd-or-forward-word + bind \e\e\[D prevd-or-backward-word + bind \eO3C nextd-or-forward-word + bind \eO3D prevd-or-backward-word + bind \e\[3C nextd-or-forward-word + bind \e\[3D prevd-or-backward-word + bind \e\[1\;3C nextd-or-forward-word + bind \e\[1\;3D prevd-or-backward-word + + bind \e\eOA history-token-search-backward + bind \e\eOB history-token-search-forward + bind \e\e\[A history-token-search-backward + bind \e\e\[B history-token-search-forward + bind \eO3A history-token-search-backward + bind \eO3B history-token-search-forward + bind \e\[3A history-token-search-backward + bind \e\[3B history-token-search-forward + bind \e\[1\;3A history-token-search-backward + bind \e\[1\;3B history-token-search-forward + + bind \ca beginning-of-line + bind \ce end-of-line + bind \ey yank-pop + bind \ch backward-delete-char + bind \cw backward-kill-word + bind \cp history-search-backward + bind \cn history-search-forward + bind \cf forward-char + bind \cb backward-char + bind \ct transpose-chars + bind \et transpose-words + bind \eu upcase-word + # This clashes with __fish_list_current_token + # bind \el downcase-word + bind \ec capitalize-word + bind \e\x7f backward-kill-word + bind \eb backward-word + bind \ef forward-word + bind \e\[1\;5C forward-word + bind \e\[1\;5D backward-word + bind \e\[1\;9A history-token-search-backward # iTerm2 + bind \e\[1\;9B history-token-search-forward # iTerm2 + bind \e\[1\;9C forward-word #iTerm2 + bind \e\[1\;9D backward-word #iTerm2 + # Bash compatibility + # https://github.com/fish-shell/fish-shell/issues/89 + bind \e. history-token-search-backward + bind \ed forward-kill-word + bind -k ppage beginning-of-history + bind -k npage end-of-history + bind \e\< beginning-of-buffer + bind \e\> end-of-buffer + + bind \el __fish_list_current_token + bind \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end' + bind \cl 'clear; commandline -f repaint' + bind \cc 'commandline ""' + bind \cu backward-kill-line + bind \ed kill-word + bind \cw backward-kill-path-component + bind \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end' + bind \cd delete-or-exit + + # Allow reading manpages by pressing F1 + bind -k f1 'man (basename (commandline -po; echo))[1] ^/dev/null; or echo -n \a' + + # This will make sure the output of the current command is paged using the less pager when you press Meta-p + bind \ep '__fish_paginate' + + # shift-tab does a tab complete followed by a search + bind --key btab complete-and-search + + # escape cancels stuff + bind \e cancel + + # term-specific special bindings + switch "$TERM" + case 'rxvt*' + bind \e\[8~ end-of-line + bind \eOc forward-word + bind \eOd backward-word + end + end + fish_enable_emacs_key_bindings + '' + # Use vim bindings and cursors '' - fish_vi_key_bindings - set fish_cursor_default block blink - set fish_cursor_insert line blink - set fish_cursor_replace_one underscore blink - set fish_cursor_visual block + function fish_enable_vi_key_bindings -d "Default (Emacs-like) key bindings for fish" + + # Clear earlier bindings, if any + bind --erase --all + fish_vi_key_bindings + set fish_cursor_default block blink + set fish_cursor_insert line blink + set fish_cursor_replace_one underscore blink + set fish_cursor_visual block + end '' + # Use terminal colors '' diff --git a/home/gburd/features/desktop/common/default.nix b/home/gburd/features/desktop/common/default.nix index 1c97016..32ae268 100644 --- a/home/gburd/features/desktop/common/default.nix +++ b/home/gburd/features/desktop/common/default.nix @@ -3,6 +3,7 @@ ./deluge.nix ./discord.nix ./firefox.nix + ./alacritty.nix ./font.nix ./gtk.nix # ./kdeconnect.nix diff --git a/home/gburd/features/desktop/common/gtk.nix b/home/gburd/features/desktop/common/gtk.nix index f62d59e..b1df2c3 100644 --- a/home/gburd/features/desktop/common/gtk.nix +++ b/home/gburd/features/desktop/common/gtk.nix @@ -8,7 +8,7 @@ rec { enable = true; font = { name = config.fontProfiles.regular.family; - size = 12; + size = 14; }; theme = { name = "${config.colorscheme.slug}"; diff --git a/home/gburd/features/desktop/common/slack.nix b/home/gburd/features/desktop/common/slack.nix index 4ff5f05..4bf162b 100644 --- a/home/gburd/features/desktop/common/slack.nix +++ b/home/gburd/features/desktop/common/slack.nix @@ -1,4 +1,4 @@ { pkgs, ... }: { - home.packages = [ pkgs.slack ]; + home.packages = [ pkgs.alacrity ]; } diff --git a/home/gburd/features/emacs/default.nix b/home/gburd/features/emacs/default.nix index 69e68e0..e4bb44a 100644 --- a/home/gburd/features/emacs/default.nix +++ b/home/gburd/features/emacs/default.nix @@ -4,22 +4,22 @@ enable = true; package = pkgs.emacs-gtk; - # overrides = final: _prev: { - # nix-theme = final.callPackage ./theme.nix { inherit config; }; - # }; - # extraPackages = epkgs: with epkgs; [ - # nix-theme - # nix-mode - # magit - # lsp-mode - # which-key - # mmm-mode + overrides = final: _prev: { + nix-theme = final.callPackage ./theme.nix { inherit config; }; + }; + extraPackages = epkgs: with epkgs; [ + nix-theme + nix-mode + magit + lsp-mode + which-key + mmm-mode - # evil - # evil-org - # evil-collection - # evil-surround - # ]; + evil + evil-org + evil-collection + evil-surround + ]; extraConfig = builtins.readFile ./init.el; }; diff --git a/hosts/common/optional/gnome.nix b/hosts/common/optional/gnome.nix index cc97e95..ade2ed5 100644 --- a/hosts/common/optional/gnome.nix +++ b/hosts/common/optional/gnome.nix @@ -4,13 +4,14 @@ enable = true; displayManager.gdm = { enable = true; + wayland = true; autoSuspend = false; - wayland = false; }; desktopManager.gnome = { enable = true; }; }; + excludePackages = [ pkgs.xterm ]; geoclue2.enable = true; gnome.games.enable = true; };