A zsh plugin that automatically detects changes to the .zshrc file and syncs it to the GitHub repository when zsh exits.
- Check if the remote .zshrc file is different from the local one, and if so, pull the latest version from the remote repository and overwrite the local configuration.
- Automatically detects changes to the
.zshrcfile and syncs it to the GitHub repository. - Automatically syncs the
.zshrcfile when zsh exits. - Backs up the current
.zshrcfile to$HOME/.zshrc-bak. - Uses a symbolic link to link the
.zshrcfile to the copy in the GitHub repository.
-
Ensure that Git is installed.
-
Set the following variables in your
.zshrcfile:ZSHRC_REPO_URL: The URL of your GitHub repository.ZSHRC_FILE_PATH: The full path to your.zshrcfile.
For example:
export ZSHRC_REPO_URL='git@github.com:usename/myzshrc.git' export ZSHRC_FILE_PATH="$HOME/.zshrc"
-
Install the plugin using
zplug:zplug "Skylor-Tang/zshrc-sync", use:zshrc-sync.zsh, from:github, at:main -
Reload the zsh configuration file:
source ~/.zshrc
The plugin will automatically detects changes to the .zshrc file and syncs it to the GitHub repository when zsh exits.
You can manually call the sync_zshrc() function to immediately sync the .zshrc file.
- Ensure that the
ZSHRC_REPO_URLandZSHRC_FILE_PATHvariables are set correctly before zplug tries to load the zshrc-sync plugin. - The plugin will create a Git repository in the
$HOME/.zshrc-syncdirectory, so make sure this directory is writable. - The plugin will back up the current
.zshrcfile to$HOME/.zshrc-bak.
This project is licensed under the MIT License.