0

I am following this tutorial to use lua in setting up nvim as an IDE. I am using Mac Monterey (12.2) and Z shell. The install has a script,

#!/usr/bin/sh

NVIM_BEGINNER=~/.config/nvim-beginner

export NVIM_BEGINNER

rm -rf $NVIM_BEGINNER

mkdir -p $NVIM_BEGINNER/share

mkdir -p $NVIM_BEGINNER/nvim

stow --restow --target=$NVIM_BEGINNER/nvim .

alias nvb='XDG_DATA_HOME=$NVIM_BEGINNER/share XDG_CONFIG_HOME=$NVIM_BEGINNER nvim'

This runs just fine and the install succeeds. I get my splash screen and nvim starts. the directory structure mirrors that in the tutorial and I can create files etc.

When I quit and restart the terminal, the alias - nvb for launching this 'new' nvim IDE is not found. I have looked at the alias. I don't know where it is writing the alias assuming thats the problem. I have a .zsh_aliases file pointed to using an entry in .zshrc which works fine normally. When I put the alias alias nvb='XDG_DATA_HOME=$NVIM_BEGINNER/share XDG_CONFIG_HOME=$NVIM_BEGINNER nvim' in .zsh_aliases or .zshrc it doesnt work.

romainl
  • 186,200
  • 21
  • 280
  • 313
capnahab
  • 343
  • 3
  • 14
  • As mentioned in the tutorial, you need to source the install script like `source ./install.sh` in your shell before using the `nvb` command. The alias `nvb` depends on the env variables defined above so you can't only run it in a new shell. You can check its value by `alias nvb`. – leaf Feb 10 '22 at 09:38
  • Thanks, yes, I have done that and it works until I quit the terminal but I expected the alias to allow me to run the command from any location afterwards indefinitely. Isnt that what the alias is for?. – capnahab Feb 10 '22 at 10:22
  • 1
    You can try putting both `export NVIM_BEGINNER=~/.config/nvim-beginner` and `alias nvb='XDG_DATA_HOME=$NVIM_BEGINNER/share XDG_CONFIG_HOME=$NVIM_BEGINNER nvim'` in .zshrc and see if it works. – leaf Feb 10 '22 at 12:31
  • perfect, many thanks – capnahab Feb 10 '22 at 21:03

0 Answers0