freshshell / fresh

Keep your dotfiles fresh.
https://freshshell.com/
1.17k stars 87 forks source link

linking from outside of $home #149

Closed smaftoul closed 6 years ago

smaftoul commented 7 years ago

Is it possible to link files outside of $home ? My usecase: I installed neovim with brew which creates a /usr/local/bin/nvim. Now I want to replace vi and vim with nvim and in order to do so , I thought I might link /usr/local/bin/nvim to ~/bin/vi[m] , but I can't seem to find a way to achieve this with freshshell. Is this something possible ?

jasoncodes commented 7 years ago

If you want to symlink a file into your bin directory as a part of building your dotfiles, the best way to do this would be to define a fresh_after_build function in your freshrc file:

fresh_after_build() {
  ln -sf /usr/local/bin/nvim ~/bin/vim
  ln -sf vim ~/bin/vi
}

Another option is to use a wrapper bin script like the following:

#!/bin/sh
exec /usr/local/bin/nvim "$@"

Aside: Homebrew’s vim formula provides a --with-override-system-vi option which can be used like brew install vim --with-override-system-vi which I use to accomplish this but it seems the neovim formula doesn’t have this feature.

smaftoul commented 6 years ago

Thanks for these tips ! Closing , it's never too late ;)