From 690617ba81bf2b69b0e66858e3a4a42aa643c579 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 May 2024 01:42:26 +0300 Subject: [PATCH] fish abbrs and etc --- apps/apps.nix | 56 ++++++++++++++++++++++++++++++++++++--- apps/socks.nix | 2 +- home/home.nix | 2 ++ hosts/intelnuc/system.nix | 13 +-------- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/apps/apps.nix b/apps/apps.nix index 94925ef..219644f 100644 --- a/apps/apps.nix +++ b/apps/apps.nix @@ -97,6 +97,7 @@ in { qrtool appimage-run trayscale + lf (pkgs.writeScriptBin "reboot" ''read -p "Do you REALLY want to reboot? (y/N) " answer; [[ $answer == [Yy]* ]] && ${pkgs.systemd}/bin/reboot'') ]); @@ -209,12 +210,11 @@ in { fen = "trans en:ru"; icat = "kitten icat"; }; - shellInit = '' + interactiveShellInit = '' set -U __done_kitty_remote_control 1 set -U __done_kitty_remote_control_password "kitty-notification-password-fish" set -U __done_notification_command "${pkgs.libnotify}/bin/notify-send --icon=kitty --app-name=kitty \$title \$argv[1]" - ''; - interactiveShellInit = '' + function last_file_in_downloads echo "\"$(find ~/Downloads -type f -printf "%C@:%p\n" -not -regex ".*Downloads/torrent_incomplete/.*" -not -regex ".*Downloads/torrent/.*" | sort -rn | head -n 1 | cut -d ':' -f2-)\"" end @@ -231,6 +231,56 @@ in { abbr -a --position command ttlfix TTLfix abbr -a --position command syspend systemctl suspend abbr -a --position command suspend systemctl suspend + abbr -- - 'cd -' + abbr cdd 'cd ~/Downloads' + + + function __pick_file + fd --type f | fzf + end + abbr -a !f --position command --function __pick_file + + function __pick_dir + fd --type d | fzf + end + abbr -a !d --position command --function __pick_dir + + function last_history_item; echo $history[1]; end + abbr -a !! --position anywhere --function last_history_item + + function __pick_grep + set RG_PREFIX "rg --column --line-number --no-heading --color=always --smart-case" + true | fzf --ansi --disabled --query "$INITIAL_QUERY" \ + --bind "start:reload:$RG_PREFIX {q}" \ + --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + | tr ':' '\n' | head -n1 + end + abbr -a !g --position anywhere --function __pick_grep + + function range_expansion + set -l value (string match --all --regex "\w*" $argv | string split ' ' --no-empty) + set -l word_before_value + set -l from_value + set -l to_value + + math $value[1] &>/dev/null + if test $status -ne 0 + # if first value is string + set word_before_value $value[1] + set from_value $value[2] + set to_value $value[3] + else + # if first value is integer + set from_value $value[1] + set to_value $value[2] + end + + echo "$word_before_value(seq $from_value $to_value)" + end + abbr --add range_expand_abbr --position anywhere --regex "\w*\{\d+\.\.\d+\}" --function range_expansion ''; }; diff --git a/apps/socks.nix b/apps/socks.nix index f3778ae..3de55ec 100644 --- a/apps/socks.nix +++ b/apps/socks.nix @@ -35,7 +35,7 @@ let # IP of the proxies is 192.168.150.2 - socksed = [ + socksed = [ # gost port 4780 direct proxy { name = "singbox-aus"; script = "sing-box run -c /run/secrets/singbox-aus"; } # port 4000 { name = "socks-warp"; script = "wireproxy -c /etc/wireguard/warp0.conf"; } # port 3333 { name = "socks-novpn"; script = "gost -L socks5://192.168.150.2:3334"; } # port 3334 diff --git a/home/home.nix b/home/home.nix index 0d96bea..d4f26e0 100644 --- a/home/home.nix +++ b/home/home.nix @@ -253,6 +253,8 @@ space.w = ":w"; space.q = ":q"; esc = [ "collapse_selection" "keep_primary_selection" ]; + C-f = [":new" ":insert-output lf -selection-path=/dev/stdout" "split_selection_on_newline" "goto_file" "goto_last_modification" "goto_last_modified_file" ":buffer-close!" ":redraw"]; + }; }; diff --git a/hosts/intelnuc/system.nix b/hosts/intelnuc/system.nix index d0e2972..618f96c 100644 --- a/hosts/intelnuc/system.nix +++ b/hosts/intelnuc/system.nix @@ -9,7 +9,7 @@ system.autoUpgrade = { enable = true; flake = "github:deltathetawastaken/dotfiles"; - dates = "hourly"; + dates = "daily"; }; systemd.services.nixos-upgrade = { # 1 hour timeout, default is too low serviceConfig.TimeoutSec= 3600; @@ -17,17 +17,6 @@ serviceConfig.TimeoutStopUSec = 3600; }; - - - # services.autoUpdate = { - # enable = true; - # configDir = "/home/delta/Documents/dotfiles"; # Directory where your NixOS configuration is cloned - # branch = "main"; # Branch to pull updates from - # frequency = "daily"; # Update frequency: daily, weekly, monthly, etc. - # timeOfDay = "03:00"; # Time of day for the update in HH:MM format - # }; - - boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/sda"; boot.loader.grub.useOSProber = true;