From 3b5ace5e7975ee69895b4951567a44f9c9c7b61f Mon Sep 17 00:00:00 2001 From: Matt Nish-Lapidus Date: Mon, 7 Jul 2025 14:20:00 -0400 Subject: [PATCH] lots of nushell updates, kanata, and more --- flake.lock | 42 +++++++++--------- modules/home/niri.nix | 3 +- modules/home/shell-conf.nix | 25 +++++++++++ modules/home/shell-conf/nushell/config.nu | 49 ++++++--------------- modules/home/shell-conf/nushell/env.nu | 15 +++++++ modules/home/shell-conf/nushell/nushell.nix | 4 -- modules/system/kanata.nix | 3 +- 7 files changed, 77 insertions(+), 64 deletions(-) diff --git a/flake.lock b/flake.lock index 6e0d718..12832dc 100644 --- a/flake.lock +++ b/flake.lock @@ -93,11 +93,11 @@ ] }, "locked": { - "lastModified": 1751607816, - "narHash": "sha256-5PtrwjqCIJ4DKQhzYdm8RFePBuwb+yTzjV52wWoGSt4=", + "lastModified": 1751854533, + "narHash": "sha256-U/OQFplExOR1jazZY4KkaQkJqOl59xlh21HP9mI79Vc=", "owner": "nix-community", "repo": "disko", - "rev": "da6109c917b48abc1f76dd5c9bf3901c8c80f662", + "rev": "16b74a1e304197248a1bc663280f2548dbfcae3c", "type": "github" }, "original": { @@ -153,11 +153,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1751819016, - "narHash": "sha256-VUH2XRvstd/AQmph85qMOrSuDdhE6Wi0NIbpWtl2j58=", + "lastModified": 1751908357, + "narHash": "sha256-7JeYhMYTdfzHsFfGZRUM+t0nx4HdYa3oaMH2B/qz9MA=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "b36094ff60e3b8e3d8cda96f2824bd57bbf32d93", + "rev": "8e4ecd7c43c5e061dd2fc4d9d1994ec4d67cab2e", "type": "github" }, "original": { @@ -644,11 +644,11 @@ ] }, "locked": { - "lastModified": 1751816429, - "narHash": "sha256-F9xzryA4OfrGTQS1N8SimJQzoD8qDMj/e2lTFE9V288=", + "lastModified": 1751824240, + "narHash": "sha256-aDDC0CHTlL7QDKWWhdbEgVPK6KwWt+ca0QkmHYZxMzI=", "owner": "nix-community", "repo": "home-manager", - "rev": "b4486ff44addd453a64fd8c176ab2fd7ad3f6eb3", + "rev": "fd9e55f5fac45a26f6169310afca64d56b681935", "type": "github" }, "original": { @@ -1073,11 +1073,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1751815493, - "narHash": "sha256-tF7Tery/v0lhBKAwj9TgBLPSng42iZzlf/MeFb7on6U=", + "lastModified": 1751866241, + "narHash": "sha256-9UJmOYKYXx/hrXTAtFCJtlrIRQmuRLQ+IKj9eTeFIXc=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "c4d9d4caa0c1e5c002679ca4b15db223b1942c2b", + "rev": "59e74c8ac38b131d664a667e046861bd72f5b651", "type": "github" }, "original": { @@ -1438,11 +1438,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1751637120, - "narHash": "sha256-xVNy/XopSfIG9c46nRmPaKfH1Gn/56vQ8++xWA8itO4=", + "lastModified": 1751792365, + "narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5c724ed1388e53cc231ed98330a60eb2f7be4be3", + "rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", "type": "github" }, "original": { @@ -2147,11 +2147,11 @@ "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1751812076, - "narHash": "sha256-h7vE7KQvHIPaPik7Ze818dy/G4YQRWVFqNyxqcBAEwI=", + "lastModified": 1751895895, + "narHash": "sha256-kJB7D+62dqdPzuBgqD5tYnk0KpqkGZFZr2KB+5RFqp8=", "owner": "sxyazi", "repo": "yazi", - "rev": "917e1f54a10445f2e25147c4b81a3c77d8233632", + "rev": "5f7c0e813f25a55da90779ec98934e2ed94a5737", "type": "github" }, "original": { @@ -2168,11 +2168,11 @@ ] }, "locked": { - "lastModified": 1751779188, - "narHash": "sha256-o1PidAPLtSSqI6isos6v/e6s7t3zQ56NBYhXVaUesXc=", + "lastModified": 1751858709, + "narHash": "sha256-xghd1GDPRSa6aD6tEk2JCuQDZWdHITlCA/stwSVoZJQ=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "b3200f40877a3e0a679070d96f8793a06105c06e", + "rev": "216dd333fa41aa013bf8aab9322d7c1a2aee5b4a", "type": "github" }, "original": { diff --git a/modules/home/niri.nix b/modules/home/niri.nix index e200f17..df6c4e3 100644 --- a/modules/home/niri.nix +++ b/modules/home/niri.nix @@ -352,8 +352,7 @@ in "Mod+Shift+A" = { hotkey-overlay.title = "Lock Session"; - action = spawn "/home/emenel/.local/bin/session-lock"; - allow-when-locked = true; + action = spawn "${pkgs.systemd}/bin/loginctl" "lock-session"; }; "XF86AudioPlay" = { diff --git a/modules/home/shell-conf.nix b/modules/home/shell-conf.nix index c2aabfc..4c42094 100644 --- a/modules/home/shell-conf.nix +++ b/modules/home/shell-conf.nix @@ -183,6 +183,31 @@ }; gitui = { enable = true; + theme = '' + ( + selected_tab: Reset, + command_fg: Black, + selection_bg: Blue, + selection_fg: White, + cmdbar_bg: Blue, + cmdbar_extra_lines_bg: Blue, + disabled_fg: DarkGray, + diff_line_add: Green, + diff_line_delete: Red, + diff_file_added: LightGreen, + diff_file_removed: LightRed, + diff_file_moved: LightMagenta, + diff_file_modified: Yellow, + commit_hash: Magenta, + commit_time: LightCyan, + commit_author: Green, + danger_fg: Red, + push_gauge_bg: Blue, + push_gauge_fg: Reset, + tag_fg: LightMagenta, + branch_fg: LightYellow, + ) +''; }; }; diff --git a/modules/home/shell-conf/nushell/config.nu b/modules/home/shell-conf/nushell/config.nu index 6492471..81d76ba 100644 --- a/modules/home/shell-conf/nushell/config.nu +++ b/modules/home/shell-conf/nushell/config.nu @@ -8,6 +8,8 @@ $env.LS_COLORS = (vivid generate one-dark) # $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = "" # $env.TRANSIENT_PROMPT_COMMAND_RIGHT = ^starship module time +alias "nuls" = ls + def --env nufzf [] {$in | each {|i| $i | to json --raw} | str join "\n" | fzf | from json} def --env doomup [...args] { @@ -16,11 +18,19 @@ def --env doomup [...args] { systemctl --user restart emacs.service } -def --env lla [...pattern: glob] { - let pattern = if ($pattern | is-empty) { [ '.' ] } else { $pattern } - nuls -alm $pattern | select name type size modified mode user +# TODO: is there a way to passthrough args? +def --env ls [...p: glob] { + let pattern = if ($p | is-empty) { [ '.' ] } else { $p } + nuls -lm ...$pattern | select name size modified mode user } +def --env lla [...p: glob] { + let pattern = if ($p | is-empty) { [ '.' ] } else { $p } + nuls -alm ...$pattern | select name size modified mode user +} + +alias "ll" = lla + # def --env pullall [] { # } @@ -32,36 +42,3 @@ def pdf-compress [...args] { def nh-switch-gc [...args] { nh os switch; nh clean all --keep 3 --nogcroots; nix store optimise; } - -def "nu-complete zoxide path" [context: string] { - let parts = $context | str trim --left | split row " " | skip 1 | each { str downcase } - let completions = ( - ^zoxide query --list --exclude $env.PWD -- ...$parts - | lines - | each { |dir| - if ($parts | length) <= 1 { - $dir - } else { - let dir_lower = $dir | str downcase - let rem_start = $parts | drop 1 | reduce --fold 0 { |part, rem_start| - ($dir_lower | str index-of --range $rem_start.. $part) + ($part | str length) - } - { - value: ($dir | str substring $rem_start..), - description: $dir - } - } - }) - { - options: { - sort: false, - completion_algorithm: substring, - case_sensitive: false, - }, - completions: $completions, - } -} - -def --env --wrapped z [...rest: string@"nu-complete zoxide path"] { - __zoxide_z ...$rest -} diff --git a/modules/home/shell-conf/nushell/env.nu b/modules/home/shell-conf/nushell/env.nu index 009ff65..2e80612 100644 --- a/modules/home/shell-conf/nushell/env.nu +++ b/modules/home/shell-conf/nushell/env.nu @@ -17,3 +17,18 @@ $completions } } + +let zoxide_completer = {|spans| + $spans | skip 1 | zoxide query -l ...$in | lines | each {|line| $line | str replace $env.HOME '~' } | where {|x| $x != $env.PWD} +} + +let external_completer = {|spans| + + match $spans.0 { + +# use zoxide completions for zoxide commands + z | zi => $zoxide_completer + __zoxide_z | __zoxide_zi => $zoxide_completer + _ => $fish_completer + } | do $in $spans +} diff --git a/modules/home/shell-conf/nushell/nushell.nix b/modules/home/shell-conf/nushell/nushell.nix index 8f3ed55..16b5c04 100644 --- a/modules/home/shell-conf/nushell/nushell.nix +++ b/modules/home/shell-conf/nushell/nushell.nix @@ -8,10 +8,6 @@ programs.nushell = { enable = true; shellAliases = { - "nuls" = "ls"; - "ls" = "ls -m"; - "ll" = "ls -m"; - "la" = "ls -am"; "lz" = "eza -l"; "lza" = "eza -al"; "y" = "job spawn { wezterm --config-file ~/.config/wezterm/launcher.lua start --always-new-process --cwd (pwd) yazi }"; diff --git a/modules/system/kanata.nix b/modules/system/kanata.nix index bc02d50..bea3133 100644 --- a/modules/system/kanata.nix +++ b/modules/system/kanata.nix @@ -18,7 +18,8 @@ let ;; layer mods spcnav (tap-hold $tap-timeout 300 spc (layer-while-held navigation)) - tabnav(multi lctrl lalt) + ;; for easy single key access to tab and pane navigation + tabnav (multi lctrl lalt) ;; space cadet shift sp-lsft (tap-hold-press $tap-timeout $hold-timeout S-9 lsft)