So, there was a time when I was only developing applications using Python
. And so I found out about virtual environments.
And then after a couple of months, I discovered pyenv
.
It also came to a time I had to work on multiple projects that uses different versions of nodejs
and searched something similar
so I installed nvm
.
Then, I was required to work on a Ruby
project so I installed rbenv
.
And since golang
was one of the new shiny objects that kinda got my interest, I went on and installed goenv
.
Everything was fine until I kinda felt my config.fish
file got bloated and somehow nvm
was kinda slowing down my shell startup.
I did do some optimizations such as lazy loading nvm
and used a fish
plugin called fish-nvm.
And then one day, I found out about asdf-vm.
At first, I was quite hesitant to install it since it would kinda disrupt my work flow with python projects since I heavily use pyenv virtualenv
.
But I did feel that the benefits of using asdf-vm
outweighs the cons so I went ahead and proceeded.
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.8
asdf
has a pretty good documentation to be honest. Despite brew
being my go to package manager, I chose git
as my installation method.
My reason is that asdf
requires me to add this line in my config.fish
source (brew --prefix asdf)/asdf.fish
and the brew --prefix adsf
is just too slow compared to just having this
source $HOME/.asdf/asdf.fish
Next, for the auto completions just run this command in your terminal:
$ mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions
Restart your shell so that PATH changes take effect!
You can checkout a more detailed documentation here: https://asdf-vm.com/#/core-manage-asdf-vm?id=install
Before, my config.fish
looked something like this:
set -gx PYENV_ROOT $HOME/.pyenv
set -gx PYTHON_BUILD_ARIA2_OPTS "-x 10 -k 1M"
contains $PYENV_ROOT/bin $fish_user_paths; or set -Ua fish_user_paths $PYENV_ROOT/bin
status --is-interactive; and pyenv init - | source
status --is-interactive; and pyenv virtualenv-init - | source
set -gx GOENV_GOPATH_PREFIX $HOME/.go
status --is-interactive; and goenv init - | source
status --is-interactive; and rbenv init - | source
set -gx nvm_alias_output $HOME/.node_aliases
contains $nvm_alias_output $fish_user_paths; or set -Ua fish_user_paths $nvm_alias_output
After
set -gx PYTHON_BUILD_ARIA2_OPTS "-x 10 -k 1M"
source $HOME/.asdf/asdf.fish
Again, most of the things I put here just came from the documentation: https://asdf-vm.com/#/core-manage-plugins?id=add
pyenv replacement
$ asdf plugin add python
$ asdf install python latest:3
$ asdf global python 3.8.4
rbenv replacement
$ asdf plugin add ruby
$ asdf install ruby latest
$ asdf global ruby 2.7.1
goenv replacement
$ asdf plugin add golang
$ asdf install golang latest
$ asdf global golang 1.14.6
nvm replacement
$ asdf plugin add nodejs
$ asdf install nodejs 12.18.2
$ asdf