@@ -423,18 +423,29 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
423423 } elif [[ $tpe = local ]] {
424424 # `$plugin` contains the full source path from the zinit call
425425 # `$local_path` contains the target path inside $ZINIT[PLUGINS_DIR]
426- +zi-log "{info}Symlinking local plugin from {file}$plugin{rst} {info}to {file}$local_path{rst}"
427426
428- # Create a symlink from the dotfiles location to the zinit plugins dir
429- # This makes zinit "aware" of it for all subsequent operations.
430- command ln -s "$plugin" "$local_path"
427+ # Check for the EXISTING `link` ice-mod for consistency with snippets.
428+ if (( ${+ICE[link]} )); then
429+ # If `link` ice is present, create a symlink.
430+ +zi-log "{info}Symlinking local plugin from {file}$plugin{rst} {info}to {file}$local_path{rst}"
431+ command ln -s "$plugin" "$local_path"
432+ else
433+ # Otherwise, the default behavior is to copy the directory.
434+ +zi-log "{info}Copying local plugin from {file}$plugin{rst} {info}to {file}$local_path{rst}"
435+ command cp -R "$plugin" "$local_path"
436+ fi
431437
432438 # Create the ._zinit directory so zinit recognizes it as a managed plugin
433439 command mkdir -p "$local_path/._zinit" && echo '*' > "$local_path/._zinit/.gitignore"
434440 [[ -d "$local_path/._zinit" ]] || return 2
435441
436- # Store a flag indicating this is a local, symlinked plugin
437- builtin print -r -- "symlink" >! "$local_path/._zinit/is_local"
442+ # Store a flag indicating this is a local plugin
443+ # and whether it was copied or linked.
444+ if (( ${+ICE[link]} )); then
445+ builtin print -r -- "symlink" >! "$local_path/._zinit/is_local"
446+ else
447+ builtin print -r -- "copy" >! "$local_path/._zinit/is_local"
448+ fi
438449 } elif [[ $tpe = github ]] {
439450 case ${ICE[proto]} in
440451 (|ftp(|s)|git|http(|s)|rsync|ssh)
0 commit comments