From 1b39ae8f408c31e50efcbe8102b8ef1af47ace47 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Tue, 1 Nov 2022 11:09:05 +0100 Subject: [PATCH] Some cool commands for nix --- home/fish/fish.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/home/fish/fish.nix b/home/fish/fish.nix index 6375249..e000033 100644 --- a/home/fish/fish.nix +++ b/home/fish/fish.nix @@ -10,7 +10,24 @@ programs.fish = { enable = true; package = pkgs.unstable.fish; - functions = { }; + functions = { + # Simplify nix usage! + nx = "test (count $argv) -gt 0 && nix run nixpkgs#$argv[1] -- $argv[2..]"; + nsh = "test (count $argv) -gt 0 && nix shell nixpkgs#$argv -c fish"; + # Grep stuff + eg = { + body = '' + if test (count $argv) -gt 0 + ${pkgs.ripgrep}/bin/rg --vimgrep $argv | e + else + echo "eg {ripgrep options}" + return 1 + end + ''; + wraps = "rg"; + description = "Search with ripgrep and put results into the editor"; + }; + }; tide = { nix-shell.enable = true;