Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify a custom path for my .zshrc file?

Tags:

zsh

I'm trying to move .zshrc to a folder where I keep this kind of files synced with Github.

But now whenever I start a zsh session it doesn't use that config file.

Assuming I changed the file to ~/.dotfiles how can I add ~/.dotfiles/.zshrc to the PATH(?!) to make zsh start with that config?

Doing source ~./dotfiles/.zshrc only works for that session. Doesn't work anymore if I close the terminal.

like image 901
Cândido Faísca Avatar asked Dec 26 '14 15:12

Cândido Faísca


2 Answers

You can symlink:

ln -s /path/to/original /path/to/symlink

For the zshrc you can do something like:

ln -s ~/.dotiles/.zshrc ~/.zshrc
like image 52
nitishagar Avatar answered Oct 04 '22 19:10

nitishagar


Alternatively, you can do what I do and use GNU Stow. I've got my dotfiles in a repository, one subdirectory per category, like so:

dotfilerepo/zsh/.zshrc
dotfilerepo/zsh/.zlogin
dotfilerepo/git/.gitconfig
dotfilerepo/vim/.vimrc

then I can cd into repo and do stow zsh and it'll create a symlink from ~/.zshrc to repo/zsh/.zshrc, another from zsh/.zlogin to ~/.zlogin. stow vim to create symlinks from the vim subdirectory to ~, etc.

I've got a script, install-linkfarm, that does all the stow commands so when I move onto a new machine, I clone my repo, cd to it and run install-linkfarm and am good to go.

like image 42
Joe Block Avatar answered Oct 04 '22 21:10

Joe Block