Lazy-loading shell version managers

5 days ago 1

Ever opened your terminal and thought your shell starts slow?

Well, that probably happens because of the enormous amounts of version managers, etc. which are loaded in your *rc-file.

The solution: lazy load that stuff!!1!

Note

Currently only works with bash, zsh, and fish. On support for other shells is being worked on.

First clone the git repo:

git clone https://github.com/theaino/lazysh

And install the lazysh-binary:

It can be uninstalled again by:

Now, in your *rc-file (.config/fish/config.fish, .zshrc, .bashrc, ...), you have to paste a small snippet.

source $(echo ' <init commands> ' | lazysh bash)
source $(echo ' <init commands> ' | lazysh zsh)
source $(echo ' <init commands> ' | lazysh fish)

and replace <init commands> with your init commands, like rbenv init - | source, each placed on a new line.

It could look like:

source $(echo ' eval "$(zoxide init bash)" eval "$(rbenv init - bash)" ' | lazysh bash)

(or a fish equivalent):

source $(echo ' zoxide init fish | source rbenv init - | source ' | lazysh fish)

Warning

It should be common sense to only paste commands you trust in there.

That's it!

Read Entire Article