Skip to content

Commit

Permalink
bash, fish: Switch to bash version of nvm
Browse files Browse the repository at this point in the history
Ensures Node installations are managed by nvm for all terminal environments. An `nvm.fish` function is defined to call bash-flavoured nvm under fish.

Reference: https://eshlox.net/2019/01/27/how-to-use-nvm-with-fish-shell
  • Loading branch information
huntie committed Oct 17, 2023
1 parent d9acf5f commit a0d59f3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions bash/.profile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ if [[ -d $HOME/Library/Application\ Support/JetBrains/Toolbox/scripts ]]; then
export PATH=$HOME/Library/Application\ Support/JetBrains/Toolbox/scripts:$PATH
fi

# nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

# Rust
if [ -f $HOME/.cargo/env ]; then
source "$HOME/.cargo/env"
Expand Down
3 changes: 0 additions & 3 deletions fish/.config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ set -x FZF_OPEN_COMMAND $FZF_DEFAULT_COMMAND
# ripgrep
set -x RIPGREP_CONFIG_PATH $HOME/.config/ripgrep/rc

# nvm
set -x nvm_default_version '16'

if [ -n $VIM ]
# Explicitly set 24-bit colors in NeoVim terminal windows
# https://github.com/neovim/neovim/issues/10836
Expand Down
2 changes: 1 addition & 1 deletion fish/.config/fish/fish_plugins
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
jorgebucaran/fisher
edc/bass
franciscolourenco/done
jorgebucaran/autopair.fish
jorgebucaran/nvm.fish
jethrokuan/fzf
jethrokuan/z
4 changes: 2 additions & 2 deletions fish/.config/fish/functions/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ fisher.fish
__fzf*.fish
__z*.fish
_autopair*.fish
_nvm*.fish
nvm.fish
__bass*
bass.fish
3 changes: 3 additions & 0 deletions fish/.config/fish/functions/nvm.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function nvm
bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
end

0 comments on commit a0d59f3

Please sign in to comment.