From ca5ff9918a49e29882099df8cfa1cbc6e35d0362 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Sun, 5 May 2024 04:41:17 -0400 Subject: [PATCH] global/shell: make editi universal and add edit aliases --- modules/global/shell.nix | 12 ++++++++++++ users/modules/global/shells/zsh.nix | 8 -------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/global/shell.nix b/modules/global/shell.nix index b12e752..f80ace6 100644 --- a/modules/global/shell.nix +++ b/modules/global/shell.nix @@ -80,6 +80,8 @@ in mktmp = "cd $(mktemp -d)"; edit = "$EDITOR"; + e = "edit"; + ei = "editi"; lpath = "echo \"$PATH\" | tr \":\" \"\n\""; timestamp = "date +%s -d"; @@ -87,6 +89,16 @@ in neofetch = "neowofetch"; }; + universe.packages = [ + (pkgs.writeScriptBin "editi" '' + if [[ $# -eq 0 ]] then + $EDITOR "$(fd -H -t f | fzf)" + else + $EDITOR "$(fd -H -t f | fzf -1 -q "$*")" + fi + '') + ]; + universe.variables = { FZF_DEFAULT_OPTS = "--extended"; }; diff --git a/users/modules/global/shells/zsh.nix b/users/modules/global/shells/zsh.nix index 03a8eeb..d52fe58 100644 --- a/users/modules/global/shells/zsh.nix +++ b/users/modules/global/shells/zsh.nix @@ -48,14 +48,6 @@ alias "jh"="cd ~ && j" alias "gj"="gcd && j" - - editi() { - if [[ $# -eq 0 ]] then - edit "$(fd -H -t f | fzf)" - else - edit "$(fd -H -t f | fzf -1 -q "$*")" - fi - } ''; dotDir = ".config/zsh";