A lesson that I’ve learned tonight about symlinks are to always use the full path. I thought symlinks could be defined with relative paths if I’m already in the folder of the source files. Turns out that isn’t the case.
I have conf files for both nvim and tmux in a folder called dotfiles which is source controlled and hosted on GitHub. When creating symlinks while currently in the dotfiles, I thought the symlinks would resolve correctly with the source files in my dotfiles folder. But when re-sourcing nvim or tmux, I would get an error that the files didn’t exist.
ls -al from Terminal revealed that the symlinks weren’t correctly being linked to their source files.
# Current directoy ~/dotfiles ln -s tmux ~/.tmux.conf # Which yielded this symlink when running ls -al .tmux.conf -> tmux
So instead this is how I should’ve symlinked my tmux conf file
ln -s ~/dotfiles/tmux ~/.tmux.conf # Which now yields .tmux.conf -> ~/dotfiles/tmux
Whether in the source folder or not, should always use the full path when creating symlinks.