Hacker News new | past | comments | ask | show | jobs | submit login

What happens when you need to link a file that does not support comments like that? For example, something which stores its config as plain JSON.

Or how about when you want to symlink an entire directory? For example something like neovim, considering that you may want to split config into separate files for organization. My neovim configuration has an "autoload setup" so any lua files inside the config directory are automatically required.

Lastly, this approach does not appear to support running commands. My dotfile install script ensures that tmux plugins are installed, the terminal font I use is available, and some other stuff that you need to invoke a command or script to achieve.

I like that the approach is simple, but I do not think it can support even relatively common use cases very well.




I'm not using a dotfiles manager, i track my ~/.config in git and have a script that globs for ~/.config/*/dot.* files to create symlinks for them. Like ~/.config/bash/dot.bashrc . Works with directories.


I prefer using ONE symlinked ~/.zshrc -> ~/dotfiles/etc/zsh/.zshrc and then using ENV-Variables within the .zshrc to specifiy other config file locations:

  # starship
  export STARSHIP_CONFIG="$HOME/dotfiles/etc/starship/starship.toml"

  # git
  export GIT_CONFIG_GLOBAL="$HOME/dotfiles/etc/git/.gitconfig"

  # vim
  export MYVIMRC="$HOME/dotfiles/etc/vim/vimrc"
  export VIMINIT='source $MYVIMRC'

  # ...
So one symlink is enough :-) Something similar can be done for ssh config (this file can not be symlinked for security reasons, so be careful working around this "feature"):

  # contents of $HOME/.ssh/config
  Include ~/dotfiles/etc/ssh/hosts.d/*


Shouldn't you at least put those environment variables in ~/.profile? You'd want to make sure applications like VS Code and whatnot pick up the configurations. ~/.zshrc would only be used for interactive zsh sessions, which not all applications would respect/use.


Yeah I should, but since it only contains tools I tend to start from zsh, I did not care too much :-) thanks for the hint though, almost forgot that.


Consult the documentation for your programs whether they already look in ~/.config and thus don't need a environment variable.


I don't want them in `.config` though :-) I'd like to specify the location to a personal git repository, that is not named `.config` :-)


The JSON hiccup occured to me - I don't have any JSON dotfiles but I guess I'd store it as hjson (https://hjson.github.io/) and add a conversion step.

Symlinking a directory - admittedly didn't come up for my dotfiles, maybe `.ln` files with a similar format in dir roots.

Commands - yes, I still keep a set of shell scripts alongside my config files.


Huh. Seems like an interesting alternative to JSONC.


Sounds like a job for a personal Ansible playbook.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: