Skip to content

Instantly share code, notes, and snippets.

@demicuz
Created September 15, 2022 01:29
Show Gist options
  • Save demicuz/487b98066b4cf03d2337ff61d40ac6d6 to your computer and use it in GitHub Desktop.
Save demicuz/487b98066b4cf03d2337ff61d40ac6d6 to your computer and use it in GitHub Desktop.
Fish shell has `fish_add_path` to add directories to PATH. But doesn't have a remove function, so here it is.
# Source: superuser.com/questions/776008
function fish_remove_path --description "Remove paths from the PATH"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment