diff --git a/README.md b/README.md index e63adc3..0be3c0f 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ Install plugins using the `install` command followed by the path to the reposito fisher install jorgebucaran/nvm.fish ``` +> To install a plugin from GitLab, prefix the repository with `gitlab.com/`. + To get a specific version of a plugin add an `@` symbol after the plugin name followed by a tag, branch, or [commit](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefcommit-ishacommit-ishalsocommittish). ```console diff --git a/functions/fisher.fish b/functions/fisher.fish index 0279b7e..74b7819 100644 --- a/functions/fisher.fish +++ b/functions/fisher.fish @@ -91,6 +91,12 @@ function fisher --argument-names cmd --description "A plugin manager for Fish" set url https://api.github.com/repos/\$name[1]/tarball/\$name[2] set header 'Accept: application/vnd.github.v3+json' + if string match -q 'gitlab.com/*' \$name[1] + set bare (string replace 'gitlab.com/' '' \$name[1]) + set repo (string split '/' \$bare) + set url https://gitlab.com/{\$bare}/-/archive/{\$name[2]}/{\$repo[2]}-{\$name[2]}.tar.gz + end + echo Fetching (set_color --underline)\$url(set_color normal) if curl --silent -L -H \$header \$url | tar -xzC \$temp -f - 2>/dev/null