Skip to content

Instantly share code, notes, and snippets.

@danielres
Created March 8, 2024 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielres/e02a6c810017a07bdb8cf172c0be274c to your computer and use it in GitHub Desktop.
Save danielres/e02a6c810017a07bdb8cf172c0be274c to your computer and use it in GitHub Desktop.
Running lvim with its own isolated nodejs using nix-shell
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