diff --git a/fisher.fish b/fisher.fish index a689018..c96714e 100644 --- a/fisher.fish +++ b/fisher.fish @@ -35,9 +35,21 @@ function fisher -a cmd -d "fish package manager" _fisher_self_complete end + if test -e "$fisher_path/conf.d/fisher.fish" + command rm -f $fisher_path/conf.d/fisher.fish + end + + switch "$version" + case \*-\* + case 2\* + echo "fisher copy-user-key-bindings" > $fisher_path/conf.d/fisher.fish + end + switch "$cmd" case self-complete _fisher_self_complete + case copy-user-key-bindings + _fisher_copy_user_key_bindings case ls _fisher_ls | command sed "s|$HOME|~|" case -v {,--}version @@ -79,6 +91,20 @@ function _fisher_self_complete end end +function _fisher_copy_user_key_bindings + if functions -q fish_user_key_bindings + functions -c fish_user_key_bindings fish_user_key_bindings_copy + end + function fish_user_key_bindings + for file in $fisher_path/conf.d/*_key_bindings.fish + source $file >/dev/null 2>/dev/null + end + if functions -q fish_user_key_bindings_copy + fish_user_key_bindings_copy + end + end +end + function _fisher_ls set -l pkgs $fisher_config/*/*/* for pkg in $pkgs @@ -135,7 +161,7 @@ end function _fisher_self_uninstall set -l current_pkgs $fisher_config/*/*/* - for path in $fisher_cache (_fisher_pkg_remove_all $current_pkgs) $fisher_config $fisher_path/{functions,completions}/fisher.fish $fish_config/fishfile + for path in $fisher_cache (_fisher_pkg_remove_all $current_pkgs) $fisher_config $fisher_path/{functions,completions,conf.d}/fisher.fish $fish_config/fishfile echo "removing $path" command rm -rf $path 2>/dev/null end | command sed "s|$HOME|~|" >&2