Add basic XDG compliant sh architecture

The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).

Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)

Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
This commit is contained in:
Marty Oehme 2020-02-02 15:08:40 +00:00
parent a0a02be852
commit 6380affb6f
46 changed files with 1657 additions and 677 deletions

View file

@ -1,12 +0,0 @@
export XDG_CONFIG_HOME="$HOME/.config"
# .zlogin
#
# load all files from .config/shell/login.d
if [ -d $XDG_CONFIG_HOME/shell/login.d ]; then
for file in $XDG_CONFIG_HOME/shell/login.d/*.sh; do
source $file
done
fi
export PATH="$HOME/.cargo/bin:$PATH"

6
home/.zshenv Normal file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env zsh
#
# make zsh source the correct directory
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"}
ZDOTDIR="$XDG_CONFIG_HOME/zsh"

View file

@ -1,19 +0,0 @@
#!/bin/zsh
autoload zmv
if [ -d $XDG_CONFIG_HOME/shell/rc.d ]; then
for file in $XDG_CONFIG_HOME/shell/rc.d/*.sh; do
source $file
done
fi
if [ -d $XDG_CONFIG_HOME/shell/zshrc.d ]; then
for file in $XDG_CONFIG_HOME/shell/zshrc.d/*.zsh; do
source $file
done
fi