From fa25e243517d1f1f0ac2b6c7f1ec8d4c664ec0fb Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Fri, 6 May 2022 09:44:21 -0400 Subject: [PATCH] move static fish functions --- fish.configlink/completions/nomad.fish | 9 ------- .../conf.d => macos}/nix-env.fish | 0 modules/shell/default.nix | 2 +- modules/shell/{fish.nix => fish/default.nix} | 21 ++++++---------- .../functions/commandline-git-commits.fish | 0 .../shell/fish}/functions/edit.fish | 0 .../shell/fish}/functions/fcd.fish | 0 .../functions/fish_user_key_bindings.fish | 0 .../shell/fish}/functions/fish_vi_cursor.fish | 0 .../shell/fish}/functions/git-add-fuzzy.fish | 0 .../shell/fish}/functions/git-commits.fish | 0 .../fish}/functions/git-fuzzy-branch.fish | 0 .../shell/fish}/functions/git-history.fish | 0 .../fish}/functions/git-push-upstream.fish | 0 .../shell/fish}/functions/git-show-fuzzy.fish | 0 .../shell/fish}/functions/git.fish | 0 .../shell/fish}/functions/ip.fish | 0 .../shell/fish}/functions/note.fish | 0 .../shell/fish}/functions/recent.fish | 0 .../shell/fish}/functions/syncnotes.fish | 0 .../shell/fish}/functions/uncommitted.fish | 0 modules/shell/git.nix | 25 ++++++------------- 22 files changed, 17 insertions(+), 40 deletions(-) delete mode 100644 fish.configlink/completions/nomad.fish rename {fish.configlink/conf.d => macos}/nix-env.fish (100%) rename modules/shell/{fish.nix => fish/default.nix} (83%) rename {fish.configlink => modules/shell/fish}/functions/commandline-git-commits.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/edit.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/fcd.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/fish_user_key_bindings.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/fish_vi_cursor.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/git-add-fuzzy.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/git-commits.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/git-fuzzy-branch.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/git-history.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/git-push-upstream.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/git-show-fuzzy.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/git.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/ip.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/note.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/recent.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/syncnotes.fish (100%) rename {fish.configlink => modules/shell/fish}/functions/uncommitted.fish (100%) diff --git a/fish.configlink/completions/nomad.fish b/fish.configlink/completions/nomad.fish deleted file mode 100644 index e1e3da1..0000000 --- a/fish.configlink/completions/nomad.fish +++ /dev/null @@ -1,9 +0,0 @@ - -function __complete_nomad - set -lx COMP_LINE (commandline -cp) - test -z (commandline -ct) - and set COMP_LINE "$COMP_LINE " - /usr/local/bin/nomad -end -complete -f -c nomad -a "(__complete_nomad)" - diff --git a/fish.configlink/conf.d/nix-env.fish b/macos/nix-env.fish similarity index 100% rename from fish.configlink/conf.d/nix-env.fish rename to macos/nix-env.fish diff --git a/modules/shell/default.nix b/modules/shell/default.nix index 1c85d84..5423acb 100644 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -1,6 +1,6 @@ { ... }: { imports = [ - ./fish.nix + ./fish ./starship.nix ./fzf.nix ./direnv.nix diff --git a/modules/shell/fish.nix b/modules/shell/fish/default.nix similarity index 83% rename from modules/shell/fish.nix rename to modules/shell/fish/default.nix index a969532..fc5513e 100644 --- a/modules/shell/fish.nix +++ b/modules/shell/fish/default.nix @@ -11,8 +11,7 @@ functions = { commandline-git-commits = { description = "Insert commit into commandline"; - body = builtins.readFile - ../../fish.configlink/functions/commandline-git-commits.fish; + body = builtins.readFile ./functions/commandline-git-commits.fish; }; copy = { description = "Copy file contents into clipboard"; @@ -20,7 +19,7 @@ }; edit = { description = "Open a file in Vim"; - body = builtins.readFile ../../fish.configlink/functions/edit.fish; + body = builtins.readFile ./functions/edit.fish; }; envs = { description = "Evaluate a bash-like environment variables file"; @@ -29,15 +28,12 @@ fcd = { description = "Jump to directory"; argumentNames = "directory"; - body = builtins.readFile ../../fish.configlink/functions/fcd.fish; + body = builtins.readFile ./functions/fcd.fish; }; fish_user_key_bindings = { - body = builtins.readFile - ../../fish.configlink/functions/fish_user_key_bindings.fish; - }; - ip = { - body = builtins.readFile ../../fish.configlink/functions/ip.fish; + body = builtins.readFile ./functions/fish_user_key_bindings.fish; }; + ip = { body = builtins.readFile ./functions/ip.fish; }; json = { description = "Tidy up JSON using jq"; body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS @@ -46,16 +42,15 @@ note = { description = "Edit or create a note"; argumentNames = "filename"; - body = builtins.readFile ../../fish.configlink/functions/note.fish; + body = builtins.readFile ./functions/note.fish; }; recent = { description = "Open a recent file in Vim"; - body = builtins.readFile ../../fish.configlink/functions/recent.fish; + body = builtins.readFile ./functions/recent.fish; }; syncnotes = { description = "Full git commit on notes"; - body = - builtins.readFile ../../fish.configlink/functions/syncnotes.fish; + body = builtins.readFile ./functions/syncnotes.fish; }; }; interactiveShellInit = '' diff --git a/fish.configlink/functions/commandline-git-commits.fish b/modules/shell/fish/functions/commandline-git-commits.fish similarity index 100% rename from fish.configlink/functions/commandline-git-commits.fish rename to modules/shell/fish/functions/commandline-git-commits.fish diff --git a/fish.configlink/functions/edit.fish b/modules/shell/fish/functions/edit.fish similarity index 100% rename from fish.configlink/functions/edit.fish rename to modules/shell/fish/functions/edit.fish diff --git a/fish.configlink/functions/fcd.fish b/modules/shell/fish/functions/fcd.fish similarity index 100% rename from fish.configlink/functions/fcd.fish rename to modules/shell/fish/functions/fcd.fish diff --git a/fish.configlink/functions/fish_user_key_bindings.fish b/modules/shell/fish/functions/fish_user_key_bindings.fish similarity index 100% rename from fish.configlink/functions/fish_user_key_bindings.fish rename to modules/shell/fish/functions/fish_user_key_bindings.fish diff --git a/fish.configlink/functions/fish_vi_cursor.fish b/modules/shell/fish/functions/fish_vi_cursor.fish similarity index 100% rename from fish.configlink/functions/fish_vi_cursor.fish rename to modules/shell/fish/functions/fish_vi_cursor.fish diff --git a/fish.configlink/functions/git-add-fuzzy.fish b/modules/shell/fish/functions/git-add-fuzzy.fish similarity index 100% rename from fish.configlink/functions/git-add-fuzzy.fish rename to modules/shell/fish/functions/git-add-fuzzy.fish diff --git a/fish.configlink/functions/git-commits.fish b/modules/shell/fish/functions/git-commits.fish similarity index 100% rename from fish.configlink/functions/git-commits.fish rename to modules/shell/fish/functions/git-commits.fish diff --git a/fish.configlink/functions/git-fuzzy-branch.fish b/modules/shell/fish/functions/git-fuzzy-branch.fish similarity index 100% rename from fish.configlink/functions/git-fuzzy-branch.fish rename to modules/shell/fish/functions/git-fuzzy-branch.fish diff --git a/fish.configlink/functions/git-history.fish b/modules/shell/fish/functions/git-history.fish similarity index 100% rename from fish.configlink/functions/git-history.fish rename to modules/shell/fish/functions/git-history.fish diff --git a/fish.configlink/functions/git-push-upstream.fish b/modules/shell/fish/functions/git-push-upstream.fish similarity index 100% rename from fish.configlink/functions/git-push-upstream.fish rename to modules/shell/fish/functions/git-push-upstream.fish diff --git a/fish.configlink/functions/git-show-fuzzy.fish b/modules/shell/fish/functions/git-show-fuzzy.fish similarity index 100% rename from fish.configlink/functions/git-show-fuzzy.fish rename to modules/shell/fish/functions/git-show-fuzzy.fish diff --git a/fish.configlink/functions/git.fish b/modules/shell/fish/functions/git.fish similarity index 100% rename from fish.configlink/functions/git.fish rename to modules/shell/fish/functions/git.fish diff --git a/fish.configlink/functions/ip.fish b/modules/shell/fish/functions/ip.fish similarity index 100% rename from fish.configlink/functions/ip.fish rename to modules/shell/fish/functions/ip.fish diff --git a/fish.configlink/functions/note.fish b/modules/shell/fish/functions/note.fish similarity index 100% rename from fish.configlink/functions/note.fish rename to modules/shell/fish/functions/note.fish diff --git a/fish.configlink/functions/recent.fish b/modules/shell/fish/functions/recent.fish similarity index 100% rename from fish.configlink/functions/recent.fish rename to modules/shell/fish/functions/recent.fish diff --git a/fish.configlink/functions/syncnotes.fish b/modules/shell/fish/functions/syncnotes.fish similarity index 100% rename from fish.configlink/functions/syncnotes.fish rename to modules/shell/fish/functions/syncnotes.fish diff --git a/fish.configlink/functions/uncommitted.fish b/modules/shell/fish/functions/uncommitted.fish similarity index 100% rename from fish.configlink/functions/uncommitted.fish rename to modules/shell/fish/functions/uncommitted.fish diff --git a/modules/shell/git.nix b/modules/shell/git.nix index 3034029..5cf4235 100644 --- a/modules/shell/git.nix +++ b/modules/shell/git.nix @@ -66,17 +66,13 @@ in { programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages && builtins.elem pkgs.bat home-packages) { - git = { - body = builtins.readFile ../../fish.configlink/functions/git.fish; - }; + git = { body = builtins.readFile ./fish/functions/git.fish; }; git-add-fuzzy = { - body = builtins.readFile - ../../fish.configlink/functions/git-add-fuzzy.fish; + body = builtins.readFile ./fish/functions/git-add-fuzzy.fish; }; git-fuzzy-branch = { argumentNames = "header"; - body = builtins.readFile - ../../fish.configlink/functions/git-fuzzy-branch.fish; + body = builtins.readFile ./fish/functions/git-fuzzy-branch.fish; }; git-checkout-fuzzy = { body = '' @@ -103,26 +99,21 @@ in { ''; }; git-show-fuzzy = { - body = builtins.readFile - ../../fish.configlink/functions/git-show-fuzzy.fish; + body = builtins.readFile ./fish/functions/git-show-fuzzy.fish; }; git-commits = { - body = builtins.readFile - ../../fish.configlink/functions/git-commits.fish; + body = builtins.readFile ./fish/functions/git-commits.fish; }; git-history = { - body = builtins.readFile - ../../fish.configlink/functions/git-history.fish; + body = builtins.readFile ./fish/functions/git-history.fish; }; git-push-upstream = { description = "Create upstream branch"; - body = builtins.readFile - ../../fish.configlink/functions/git-push-upstream.fish; + body = builtins.readFile ./fish/functions/git-push-upstream.fish; }; uncommitted = { description = "Find uncommitted git repos"; - body = builtins.readFile - ../../fish.configlink/functions/uncommitted.fish; + body = builtins.readFile ./fish/functions/uncommitted.fish; }; }; };