diff options
Diffstat (limited to 'fish/conf.d')
-rw-r--r-- | fish/conf.d/fzf.fish | 28 | ||||
-rw-r--r-- | fish/conf.d/nvm.fish | 28 | ||||
-rw-r--r-- | fish/conf.d/rustup.fish | 1 |
3 files changed, 57 insertions, 0 deletions
diff --git a/fish/conf.d/fzf.fish b/fish/conf.d/fzf.fish new file mode 100644 index 000000000..8156c11b8 --- /dev/null +++ b/fish/conf.d/fzf.fish @@ -0,0 +1,28 @@ +# fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup +if not status is-interactive && test "$CI" != true + exit +end + +# Because of scoping rules, to capture the shell variables exactly as they are, we must read +# them before even executing _fzf_search_variables. We use psub to store the +# variables' info in temporary files and pass in the filenames as arguments. +# This variable is global so that it can be referenced by fzf_configure_bindings and in tests +set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)' + + +# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings +fzf_configure_bindings + +# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased +function _fzf_uninstall --on-event fzf_uninstall + _fzf_uninstall_bindings + + set --erase _fzf_search_vars_command + functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings + complete --erase fzf_configure_bindings + + set_color cyan + echo "fzf.fish uninstalled." + echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings." + set_color normal +end diff --git a/fish/conf.d/nvm.fish b/fish/conf.d/nvm.fish new file mode 100644 index 000000000..e060f2fe1 --- /dev/null +++ b/fish/conf.d/nvm.fish @@ -0,0 +1,28 @@ +set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist +set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share +set --global nvm_data $XDG_DATA_HOME/nvm + +function _nvm_install --on-event nvm_install + test ! -d $nvm_data && command mkdir -p $nvm_data + echo "Downloading the Node distribution index..." 2>/dev/null + _nvm_index_update +end + +function _nvm_update --on-event nvm_update + set --query --universal nvm_data && set --erase --universal nvm_data + set --query --universal nvm_mirror && set --erase --universal nvm_mirror + set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist +end + +function _nvm_uninstall --on-event nvm_uninstall + command rm -rf $nvm_data + + set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version + + set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source + functions --erase (functions --all | string match --entire --regex -- "^_nvm_") +end + +if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version + nvm use --silent $nvm_default_version +end diff --git a/fish/conf.d/rustup.fish b/fish/conf.d/rustup.fish new file mode 100644 index 000000000..e4cb36392 --- /dev/null +++ b/fish/conf.d/rustup.fish @@ -0,0 +1 @@ +source "$HOME/.cargo/env.fish" |