From a2422d1f4e603c8f8ef0b533ecfeb2a0fd7151f1 Mon Sep 17 00:00:00 2001 From: xinyangli Date: Sat, 24 Aug 2024 13:43:37 +0800 Subject: [PATCH] home-manager/shell: add cosmic-term and change ls colors --- modules/home-manager/alacritty.nix | 2 +- modules/home-manager/cosmic-term.nix | 16 +++++++++++++++ modules/home-manager/default.nix | 1 + modules/home-manager/fish.nix | 3 ++- modules/home-manager/zellij.nix | 30 +++++++++++++++------------- 5 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 modules/home-manager/cosmic-term.nix diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index b4b7c2a..7e39710 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, lib, ... }: with lib; let diff --git a/modules/home-manager/cosmic-term.nix b/modules/home-manager/cosmic-term.nix new file mode 100644 index 0000000..727a8c2 --- /dev/null +++ b/modules/home-manager/cosmic-term.nix @@ -0,0 +1,16 @@ +{ config, pkgs, lib, ... }: + +let + inherit (lib) mkEnableOption mkIf; + + cfg = config.custom-hm.cosmic-term; +in +{ + options.custom-hm.cosmic-term = { + enable = mkEnableOption "cosmic-term"; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.cosmic-term ]; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 14159ce..c7408b7 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,6 +1,7 @@ { imports = [ ./alacritty.nix + ./cosmic-term.nix ./direnv.nix ./fish.nix ./git.nix diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index 927b69f..a5dc2be 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -60,9 +60,10 @@ in function fish_command_not_found ${pkgs.comma}/bin/comma $argv end + set -gx LS_COLORS (${lib.getExe pkgs.vivid} generate catppuccin-mocha) '' else ""; in '' - fish_config prompt choose arrow + fish_config prompt choose default '' + extraInit; functions = mkIf cfg.functions.enable { gitignore = "curl -sL https://www.gitignore.io/api/$argv"; diff --git a/modules/home-manager/zellij.nix b/modules/home-manager/zellij.nix index e03047c..1a3f737 100644 --- a/modules/home-manager/zellij.nix +++ b/modules/home-manager/zellij.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, lib, ... }: with lib; @@ -14,20 +14,22 @@ in enable = true; settings = { default_shell = "fish"; - keybinds = { - unbind = [ - "Ctrl p" - "Ctrl n" - ]; - shared_except = { - _args = [ "pane" "locked" ]; - bind = { - _args = [ "Ctrl b"]; - SwitchToMode = "Pane"; - }; - }; - }; }; }; + xdg.configFile."zellij/config.kdl".text = '' + keybinds { + shared_except "pane" "locked" { + bind "Ctrl b" { SwitchToMode "Pane"; } + } + shared_except "locked" { + bind "Ctrl h" { MoveFocusOrTab "Left"; } + bind "Ctrl l" { MoveFocusOrTab "Right"; } + bind "Ctrl j" { MoveFocus "Down"; } + bind "Ctrl k" { MoveFocus "Up"; } + unbind "Alt h" "Alt l" "Alt j" "Alt k" + } + unbind "Ctrl p" "Ctrl n" + } + ''; }; }