diff --git a/README.md b/README.md index 545a13e..2f80fa7 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,16 @@ set fish_function_path $fish_path/functions $fish_function_path set fish_complete_path $fish_path/completions $fish_complete_path ``` +### How do I have fisherman copy plugin files instead of linking? + +By default, fisherman will create symlinks to plugin files. + +To have fisherman copy files: + +```fish +set -U fisher_copy true +``` + ### What is a fishfile and how do I use it? The fishfile lists what you've installed, and it's automatically updated as you install / remove plugins. diff --git a/fisher.fish b/fisher.fish index 62d478b..e9e3cb8 100644 --- a/fisher.fish +++ b/fisher.fish @@ -116,6 +116,10 @@ function $fisher_cmd_name -d "fish plugin manager" set -g fisher_file "$fish_path/fishfile" end + if test -z "$fisher_copy" + set -g fisher_copy false + end + switch "$argv[1]" case --complete __fisher_complete @@ -800,7 +804,11 @@ function __fisher_plugin_enable -a path command mv -f "$target" "$backup_target" ^ /dev/null end - command ln -sf "$file" "$target" + if test $fisher_copy = true + command cp -Rf "$file" "$target" + else + command ln -sf "$file" "$target" + end builtin source "$target" ^ /dev/null @@ -815,19 +823,31 @@ function __fisher_plugin_enable -a path for file in $path/{functions/,}*.{py,awk} set -l base (basename "$file") - command ln -sf "$file" "$fish_path/functions/$base" + if test $fisher_copy = true + command cp -Rf "$file" "$fish_path/functions/$base" + else + command ln -sf "$file" "$fish_path/functions/$base" + end end for file in $path/conf.d/*.{py,awk} set -l base (basename "$file") - command ln -sf "$file" "$fish_path/conf.d/$base" + if test $fisher_copy = true + command cp -Rf "$file" "$fish_path/conf.d/$base" + else + command ln -sf "$file" "$fish_path/conf.d/$base" + end end for file in $path/conf.d/*.fish set -l base (basename "$file") set -l target "$fish_path/conf.d/$base" - command ln -sf "$file" "$target" + if test $fisher_copy = true + command cp -Rf "$file" "$target" + else + command ln -sf "$file" "$target" + end builtin source "$target" ^ /dev/null end @@ -835,7 +855,11 @@ function __fisher_plugin_enable -a path set -l base (basename "$file") set -l target "$fish_path/completions/$base" - command ln -sf "$file" "$target" + if test $fisher_copy = true + command cp -Rf "$file" "$target" + else + command ln -sf "$file" "$target" + end builtin source "$target" ^ /dev/null end