ohmyzsh / ohmyzsh

🙃 A delightful community-driven (with 2,400+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community.
https://ohmyz.sh
MIT License
172.42k stars 25.81k forks source link

XDG Base Directory Specification is not being followed #9543

Open Avamander opened 3 years ago

Avamander commented 3 years ago

Describe the bug

OMZ does not follow the XDG-BD specification. Zsh's own behaviour is a separate issue.

This was previously instantly closed here: https://github.com/ohmyzsh/ohmyzsh/issues/7759

To Reproduce Steps to reproduce the behavior, for example:

  1. Install OMZ
  2. Oh My Zsh places all its stuff under $HOME/.oh-my-zsh/

Expected behavior OMZ's folder should be under $XDG_DATA_HOME/oh-my-zsh/ and some parts in $XDG_CACHE_HOME/oh-my-zsh

Desktop (please complete the following information):

CantoroMC commented 3 years ago

Zsh expected behaviour is to place the file in $ZDOTDIR or in $HOME, if the previous is not defined. Additionally, they allow you to specify a $ZSH variable before launching the installation script. ZSH="$XDG_DATA_HOME/oh-my-zsh" sh install.sh

I will not call this a bug

Avamander commented 3 years ago

@CantoroMC The defaults should follow the agreed and widespread specifications, not in the reverse. It is a bug.

CantoroMC commented 3 years ago

I also care about not have my home folder full of configuration file. But as I explain before the only file not respectful of xdg specification is .zshenv where you could specify ZDOTDIR. The issue is not related to Omz but rather to the shell itself.

Avamander commented 3 years ago

@CantoroMC

But as I explain before the only file not respectful of xdg specification is .zshenv where you could specify ZDOTDIR.

Actually no, my current install has an ~/.oh-my-zsh folder that is vital for the functioning of it. The defaults aren't correct.

CantoroMC commented 3 years ago

Ok, good luck

bound-variable commented 2 years ago

Zsh expected behaviour is to place the file in $ZDOTDIR or in $HOME, if the previous is not defined. Additionally, they allow you to specify a $ZSH variable before launching the installation script. ZSH="$XDG_DATA_HOME/oh-my-zsh" sh install.sh

I will not call this a bug

I have the $ZDOTDIR variable defined to my .config/zsh folder. The oh-my-zsh script still installed everything into my home folder.

carlosala commented 2 years ago

You can pass the variable $ZSH to the installer to change where to install it. For example, in your case:

ZSH="~/.config/zsh/oh-my-zsh" sh installer.sh
mikelpr commented 2 months ago

@carlosala It should default to XDG_DATA_HOME/oh-my-zsh then and if it isn't defined fallback to $HOME/.oh-my-zsh, instead of always ~/.oh-my-zsh unless you define that obscure ZSH envvar since most people just run the command that the green Install oh my zsh button shows at the top of the page, and anyways makes much more sense to use the XDG dirs if available instead of defaulting to polluting