Dotfiles Link
Status: Optional
The 40-dotfiles-link.sh script automates the creation of symbolic links from your local dotfiles repository to the system configuration directories.
How It Works
- Checks that
~/.dotfilesexists. If missing, the script exits with a warning. - Creates
~/.configif it does not already exist. - Calls
link_file()for each mapping listed below.link_fileaccepts a source path and a destination path.
Current Mappings
| Source | Destination | Type |
|---|---|---|
~/.dotfiles/config/nvim | ~/.config/nvim | Directory |
~/.dotfiles/config/starship.toml | ~/.config/starship.toml | File |
Safety
The link_file helper never overwrites existing files or directories. Before creating a symlink it checks whether the destination already exists — if it does, the link is skipped and a timestamped log message records the decision. This means you can re-run the script at any time without risking data loss.
Running
bash
bash workstation/40-dotfiles-link.shAdding Your Own
To link additional dotfiles, add a link_file call to the script:
bash
link_file "$HOME/.dotfiles/config/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"The function handles directory creation, existence checks, and logging automatically.
Source
View the full source on GitHub.