dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit 1c7c2cc6e79bdd93bc2c395f2bcee8c236d90d61
parent d3b56adcd93284fbeff97d95eb7eece4793b07bd
Author: Chris Bracken <chris@bracken.jp>
Date:   Mon,  9 Oct 2023 10:00:12 -0700

Set ZDOTDIR to XDG config location

Moves zsh config files under $XDG_CONFIG_DIR/zsh using $ZDOTDIR.

In order to pick up the new ZDOTDIR, .zshenv will need to be symlinked
to whichever directory the OS sets this to by default, or to
$HOME/.zshenv in the most common scenario, in which ZDOTDIR is not
already set.

Diffstat:
A.config/zsh/.gitignore | 3+++
R.zlogin -> .config/zsh/.zlogin | 0
R.zlogout -> .config/zsh/.zlogout | 0
R.zprofile -> .config/zsh/.zprofile | 0
A.config/zsh/.zshenv | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
R.zshrc -> .config/zsh/.zshrc | 0
D.zshenv | 67-------------------------------------------------------------------
7 files changed, 79 insertions(+), 67 deletions(-)

diff --git a/.config/zsh/.gitignore b/.config/zsh/.gitignore @@ -0,0 +1,3 @@ +.zcompdump +.zsh_history +.zsh_sessions/ diff --git a/.zlogin b/.config/zsh/.zlogin diff --git a/.zlogout b/.config/zsh/.zlogout diff --git a/.zprofile b/.config/zsh/.zprofile diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv @@ -0,0 +1,76 @@ +# .zshenv +# +# Despite setting ZDOTDIR, this file will likely need to be symlinked to +# ~/.zshenv, unless the OS itself defaults ZDOTDIR to the specified location. + +# Default read-only permissions for group/other. +umask 022 + +# If not running under a FreeDesktop session manager, set XDG_CONFIG_HOME. +if [[ -z "$XDG_CONFIG_HOME" ]]; then + export XDG_CONFIG_HOME="$HOME/.config" +fi + +# If not running under a FreeDesktop session manager, set XDG_RUNTIME_DIR. +if [[ -z "$XDG_RUNTIME_DIR" ]]; then + export XDG_RUNTIME_DIR="/tmp/user/$(id -u)" + mkdir -p "$XDG_RUNTIME_DIR" + chmod 0700 "$XDG_RUNTIME_DIR" +fi + +# Set location for remainder of zsh config files to avoid cluttering $HOME. +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" + +# Add zsh completions directory. +export FPATH="$ZDOTDIR/zfunc:$FPATH" + +# Basics +export EDITOR=vim +export PAGER=less +export LESS="-FRX" + +# Set language, date/time, currency, etc. to Japanese. +export LANG=ja_JP.UTF-8 +export LANGUAGE=ja_JP.UTF-8 +export LC_COLLATE=ja_JP.UTF-8 +export LC_CTYPE=ja_JP.UTF-8 +export LC_MEASUREMENT=ja_JP.UTF-8 +export LC_MESSAGES=ja_JP.UTF-8 +export LC_MONETARY=ja_JP.UTF-8 +export LC_NUMERIC=ja_JP.UTF-8 +export LC_PAPER=ja_JP.UTF-8 +export LC_TIME=ja_JP.UTF-8 + +# GPG directory and TTY used for pinentry. +export GNUPGHOME="$HOME/.gnupg" +export GPG_TTY="$(tty)" + +# Notmuch email indexer. +export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" + +# Google stuff. +export P4CONFIG=.p4config +export P4EDITOR=vim +export GEM_HOME="$HOME/.gem" + +# Platform-specific source directory. +[[ -d "$HOME/src" ]] && SRC_ROOT="$HOME/src" +[[ -d "$HOME/Developer" ]] && SRC_ROOT="$HOME/Developer" + +# Flutter/Fuchsia stuff. +[[ "$(uname)" == "Linux" ]] && export GOMA_DIR="$SRC_ROOT/flutter/engine/src/buildtools/linux-x64/goma" +[[ "$(uname)" == "Darwin" ]] && export GOMA_DIR="$SRC_ROOT/flutter/engine/src/buildtools/mac-x64/goma" +[[ "$(uname)" == "Darwin" ]] && export FLUTTER_GOMA_CREATE_XCODE_SYMLINKS=1 + +# Set GOPATH. +export GOPATH="$SRC_ROOT/go" + +# If a local python3 directory exists, add PYTHONPATH. +if [[ -d "$HOME/.local/lib/python3" ]]; then + export PYTHONPATH="$HOME/.local/lib/python3:$PYTHONPATH" +fi + +# If a local perl5 directory exists, add PERL5LIB. +if [[ -d "$HOME/.perl5/lib/perl5" ]]; then + export PERL5LIB="$HOME/.perl5/lib/perl5:$PERL5LIB" +fi diff --git a/.zshrc b/.config/zsh/.zshrc diff --git a/.zshenv b/.zshenv @@ -1,67 +0,0 @@ -# .zshenv - -# Default read-only permissions for group/other. -umask 022 - -# If not running under a FreeDesktop session manager, set XDG_CONFIG_HOME. -if [[ -z "$XDG_CONFIG_HOME" ]]; then - export XDG_CONFIG_HOME="$HOME/.config" -fi - -# If not running under a FreeDesktop session manager, set XDG_RUNTIME_DIR. -if [[ -z "$XDG_RUNTIME_DIR" ]]; then - export XDG_RUNTIME_DIR="/tmp/user/$(id -u)" - mkdir -p "$XDG_RUNTIME_DIR" - chmod 0700 "$XDG_RUNTIME_DIR" -fi - -# Basics -export EDITOR=vim -export PAGER=less -export LESS="-FRX" - -# Set language, date/time, currency, etc. to Japanese. -export LANG=ja_JP.UTF-8 -export LANGUAGE=ja_JP.UTF-8 -export LC_COLLATE=ja_JP.UTF-8 -export LC_CTYPE=ja_JP.UTF-8 -export LC_MEASUREMENT=ja_JP.UTF-8 -export LC_MESSAGES=ja_JP.UTF-8 -export LC_MONETARY=ja_JP.UTF-8 -export LC_NUMERIC=ja_JP.UTF-8 -export LC_PAPER=ja_JP.UTF-8 -export LC_TIME=ja_JP.UTF-8 - -# GPG directory and TTY used for pinentry. -export GNUPGHOME="$HOME/.gnupg" -export GPG_TTY="$(tty)" - -# Notmuch email indexer. -export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" - -# Google stuff. -export P4CONFIG=.p4config -export P4EDITOR=vim -export GEM_HOME="$HOME/.gem" - -# Platform-specific source directory. -[[ -d "$HOME/src" ]] && SRC_ROOT="$HOME/src" -[[ -d "$HOME/Developer" ]] && SRC_ROOT="$HOME/Developer" - -# Flutter/Fuchsia stuff. -[[ "$(uname)" == "Linux" ]] && export GOMA_DIR="$SRC_ROOT/flutter/engine/src/buildtools/linux-x64/goma" -[[ "$(uname)" == "Darwin" ]] && export GOMA_DIR="$SRC_ROOT/flutter/engine/src/buildtools/mac-x64/goma" -[[ "$(uname)" == "Darwin" ]] && export FLUTTER_GOMA_CREATE_XCODE_SYMLINKS=1 - -# Set GOPATH. -export GOPATH="$SRC_ROOT/go" - -# If a local python3 directory exists, add PYTHONPATH. -if [[ -d "$HOME/.local/lib/python3" ]]; then - export PYTHONPATH="$HOME/.local/lib/python3:$PYTHONPATH" -fi - -# If a local perl5 directory exists, add PERL5LIB. -if [[ -d "$HOME/.perl5/lib/perl5" ]]; then - export PERL5LIB="$HOME/.perl5/lib/perl5:$PERL5LIB" -fi