Search code examples
dotfiles

How do I handle different configuration paths on *nix and Windows with chezmoi?


I want to use chezmoi (or any other dotfile manager). I followed the instructions and added my nvim config on Windows with chezmoi.exe add ~\AppData\Local\nvim. The resulting git repository has that very path in it. When I check it out on a *nix machine and apply it with chezmoi apply, it creates a directory just like that in my home folder. However, it is expected to be .config/nvim.

I thought, chezmoi etc are designed exactly for the purpose of managing dotfiles across diverse machines. How am I supposed to manage that scenario?


Solution

  • You have to create templates for each file and then templates for each platform in the respective folder that reference the former. Round it up with some .chezmoiignore and you are done. It is all described in the documentation.