The XDG Base Directories plugin for Oh My Zsh sets up the XDG base directories according to the XDG Base Directory Specification. This plugin ensures that your environment is configured properly for storing user data, cache, and configuration files.
To install the XDG Base Directories plugin, follow these steps:
-
Clone the repository into your Oh My Zsh custom plugins directory:
git clone https://github.com/krahlos/xdg-basedirs.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/xdg-basedirs
-
Add the plugin to your
.zshrc
file:plugins=(... xdg-basedirs)
-
Reload your shell or restart your terminal to apply the changes:
source ~/.zshrc
If you are using Bash instead of Zsh, you can still use this plugin. Just follow the same
installation steps, but instead of adding it to your .zshrc
, add it to your .bashrc
or
.bash_profile
:
source /path/to/xdg-basedirs/xdg-basedirs.bash
Once the plugin is installed and enabled, it will automatically set up the following XDG base directories upon starting a new shell session:
$XDG_BIN_HOME: $HOME/.local/bin
$XDG_CACHE_HOME: $HOME/.cache
$XDG_CONFIG_HOME: $HOME/.config
$XDG_DATA_HOME: $HOME/.local/share
$XDG_RUNTIME_DIR: $HOME/.local/run
$XDG_STATE_HOME: $HOME/.local/state
The plugin creates these directories if they do not already exist, ensuring a clean environment for your applications.
You can customize the plugin by modifying the setup_xdg.sh
script located in the plugin directory.
Feel free to adjust the directory paths according to your preferences.
Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request.
This project is licensed under the terms of the MIT license. See the LICENSE file for details.