[FEATURE] Restructure Zsh config to follow XDG Base Directory

未关闭
#1,825 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@mylinuxforwork 已经在做这个了。

开始于 2026年9月6日。

评估

这个 Issue 还没有评估数据。

描述

enhancement
Is your feature request related to a problem? Please describe.

The current Zsh setup places .zshrc directly in home directory and links configs from ~/.config/zshrc/ or .zshrc_custom file that may be created in home directory. Moreover, runtime files like .zsh_history and zcompdump files end up directly in the home directory, polluting the root of home directory.

Potential conflict with existing ZDOTDIR in ~/.zshenv:
If a user already has a ~/.zshenv setting ZDOTDIR (e.g., pointing to ~/.config/zsh), Zsh will search for .zshrc inside $ZDOTDIR and completely ignore the ~/.zshrc file generated/placed by the ML4W installer in home directory. Moving to a native ZDOTDIR architecture prevents this conflict and ensures ML4W configs are loaded predictably.

Describe the solution you'd like
  • Instead of putting .zshrc in home directory, create a minimalist ~/.zshenv file that sets export ZDOTDIR="$HOME/.config/zsh".
  • Move all Zsh configuration files (.zshrc, aliases, plugins and etc) inside $ZDOTDIR/ (~/.config/zsh/).
  • Explicitly set paths inside Zsh config for history and completion dump files to keep home dir clean:
# History
HISTFILE="$ZDOTDIR/.zsh_history"

# Cache
## check if cache folder env exists and set if not
: "${XDG_CACHE_HOME:=$HOME/.cache}"

## check if ZSH folder exists in .cache folder and create if not
[[ -d "$XDG_CACHE_HOME/zsh" ]] || mkdir -p "$XDG_CACHE_HOME/zsh"

## set folder for ZSH cache
autoload -Uz compinit
compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION"
Describe alternatives you've considered

No response

Additional context

Following the XDG Base Directory Specification makes dotfiles much cleaner, modular, and easier to backup/manage.

Support or Contribution
主要语言
QML
星标
5.1k
派生
386
平均合并
16 小时 45 分钟
30 天内合并 PR
14

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mylinuxforwork/dotfiles 的其他 Issue

查看 mylinuxforwork/dotfiles 的全部 Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。