diff --git a/functions/addpaths.fish b/functions/addpaths.fish new file mode 100644 index 0000000..389adca --- /dev/null +++ b/functions/addpaths.fish @@ -0,0 +1,5 @@ +function addpaths + contains -- $argv $fish_user_paths + or set -U fish_user_paths $fish_user_paths $argv + echo "Updated PATH: $PATH" +end diff --git a/functions/findstr.fish b/functions/findstr.fish new file mode 100644 index 0000000..fec0674 --- /dev/null +++ b/functions/findstr.fish @@ -0,0 +1,10 @@ +function findstr + if test (count $argv) -lt 1 + echo "Usage: findstr " + return 1 + end + + set query $argv[1] + + find . -type f -exec grep -Hn "$query" {} \; +end diff --git a/functions/removepath.fish b/functions/removepath.fish new file mode 100644 index 0000000..5bd6f26 --- /dev/null +++ b/functions/removepath.fish @@ -0,0 +1,8 @@ +function removepath + if set -l index (contains -i $argv[1] $PATH) + set --erase --universal fish_user_paths[$index] + echo "Updated PATH: $PATH" + else + echo "$argv[1] not found in PATH: $PATH" + end +end diff --git a/functions/search.fish b/functions/search.fish new file mode 100644 index 0000000..bc62a2b --- /dev/null +++ b/functions/search.fish @@ -0,0 +1,15 @@ +function search + if test (count $argv) -lt 1 + echo "Usage: search [directory]" + return 1 + end + + set query $argv[1] + set dir "." + + if test (count $argv) -ge 2 + set dir $argv[2] + end + + rg "$query" "$dir" +end