Created
March 8, 2024 12:05
-
-
Save danielres/e02a6c810017a07bdb8cf172c0be274c to your computer and use it in GitHub Desktop.
Running lvim with its own isolated nodejs using nix-shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v() { | |
# runs nvim in a nix-shell with nodejs_20 | |
# sets NPM_GLOBAL_DIR so no sudo is needed to install global npm packages | |
NODE_STR="nodejs_20" | |
NPM_GLOBAL_DIR="/home/$USER/.npm-global/$NODE_STR" | |
mkdir -p $NPM_GLOBAL_DIR | |
echo "running lvim $1" | |
echo "within nix-shell -p $NODE_STR" | |
PATH=$NPM_GLOBAL_DIR/bin:$PATH NPM_CONFIG_PREFIX=$NPM_GLOBAL_DIR nix-shell -p $NODE_STR --run "lvim $1" | |
} | |
# useful aliases | |
alias vv="v ." | |
alias vz="v ~/.zshrc" | |
alias voh="v ~/.oh-my-zsh" | |
alias vc="v ~/.config/lvim/config.lua" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment