diff --git a/home/.zprofile b/home/.zprofile deleted file mode 100644 index 87518db..0000000 --- a/home/.zprofile +++ /dev/null @@ -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" diff --git a/home/.zshenv b/home/.zshenv new file mode 100644 index 0000000..0f2caf2 --- /dev/null +++ b/home/.zshenv @@ -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" diff --git a/home/.zshrc b/home/.zshrc deleted file mode 100644 index 98cadd8..0000000 --- a/home/.zshrc +++ /dev/null @@ -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 - - - - diff --git a/sh/.config/sh/env b/sh/.config/sh/env index f6ced64..d9baa46 100644 --- a/sh/.config/sh/env +++ b/sh/.config/sh/env @@ -13,10 +13,6 @@ export PATH="$PATH:$XDG_BIN_HOME" ## BEGIN GLOBAL ENV VARS ## ############################### -############################### -## BEGIN GLOBAL ENV VARS ## -############################### - # if we forgot to set it treat bash as default export SHELL=${SHELL:-/bin/bash} diff --git a/sh/.config/sh/profile b/sh/.config/sh/profile index e568d23..afb471a 100644 --- a/sh/.config/sh/profile +++ b/sh/.config/sh/profile @@ -16,13 +16,3 @@ if [ -d "$XDG_CONFIG_HOME/sh/env.d" ]; then done unset _env fi - -# shellcheck source=alias -[ -f "$XDG_CONFIG_HOME/sh/alias" ] && . "$XDG_CONFIG_HOME/sh/alias" -# load additional aliases -if [ -d "$XDG_CONFIG_HOME/sh/alias.d" ]; then - for _alias in "$XDG_CONFIG_HOME/sh/alias.d"/*.sh; do - . "$_alias" - done - unset _alias -fi diff --git a/sh/.config/sh/xdg b/sh/.config/sh/xdg index 5bb76be..90701cb 100644 --- a/sh/.config/sh/xdg +++ b/sh/.config/sh/xdg @@ -14,20 +14,20 @@ # unless it is ignored https://github.com/koalaman/shellcheck/wiki/SC2174 # shellcheck disable=SC2174 - # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html -test "$XDG_CACHE_HOME" || export XDG_CACHE_HOME="$HOME/.cache" +test "$XDG_CACHE_HOME" || export XDG_CACHE_HOME="$HOME/.cache" test "$XDG_CONFIG_HOME" || export XDG_CONFIG_HOME="$HOME/.config" -test "$XDG_DATA_HOME" || export XDG_DATA_HOME="$HOME/.local/share" -test "$XDG_LIB_HOME" || export XDG_LIB_HOME="$HOME/.local/lib" +test "$XDG_DATA_HOME" || export XDG_DATA_HOME="$HOME/.local/share" ## Non-Standard additions # non-standard, is added to path to enable execution of any files herein -test "$XDG_BIN_HOME" || export XDG_BIN_HOME="$HOME/.local/bin" +test "$XDG_BIN_HOME" || export XDG_BIN_HOME="$HOME/.local/bin" ## ensure directories exist -test -d "$XDG_BIN_HOME" || mkdir -p -m 0700 "$XDG_BIN_HOME" -test -d "$XDG_CACHE_HOME" || mkdir -p -m 0700 "$XDG_CACHE_HOME" +test -d "$XDG_BIN_HOME" || mkdir -p -m 0700 "$XDG_BIN_HOME" +test -d "$XDG_CACHE_HOME" || mkdir -p -m 0700 "$XDG_CACHE_HOME" test -d "$XDG_CONFIG_HOME" || mkdir -p -m 0700 "$XDG_CONFIG_HOME" -test -d "$XDG_DATA_HOME" || mkdir -p -m 0700 "$XDG_DATA_HOME" -test -d "$XDG_LIB_HOME" || mkdir -p -m 0700 "$XDG_LIB_HOME" +test -d "$XDG_DATA_HOME" || mkdir -p -m 0700 "$XDG_DATA_HOME" + +## Applications that can be set through environment variables +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" diff --git a/zsh/.config/zsh/.zprofile b/zsh/.config/zsh/.zprofile new file mode 100644 index 0000000..d5d413a --- /dev/null +++ b/zsh/.config/zsh/.zprofile @@ -0,0 +1,12 @@ +#!/usr/bin/env zsh + +[ -f "$XDG_CONFIG_HOME/sh/profile" ] && . "$XDG_CONFIG_HOME/sh/profile" +# .zlogin +# +if [ -d "$XDG_CONFIG_HOME/sh/profile.d" ]; then + for file in "$XDG_CONFIG_HOME/sh/profile.d"/*.sh; do + # shellcheck disable=1090 + source "$file" + done + unset file +fi diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv new file mode 100644 index 0000000..3b40006 --- /dev/null +++ b/zsh/.config/zsh/.zshenv @@ -0,0 +1,20 @@ +#!/usr/bin/env zsh +# +# + +# load global sh env vars +[ -f "$XDG_CONFIG_HOME/sh/env" ] && source "$XDG_CONFIG_HOME/sh/env" +if [ -d "$XDG_CONFIG_HOME/sh/env.d" ]; then + for _env in "$XDG_CONFIG_HOME/sh/env.d"/*.sh; do + . "$_env" + done + unset _env +fi + +# load zsh specific env vars +if [ -d "$XDG_CONFIG_HOME/zsh/env.d" ]; then + for _env in "$XDG_CONFIG_HOME/zsh/env.d"/*.zsh; do + . "$_env" + done + unset _env +fi diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..6a5a2fb --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,22 @@ +#!/usr/bin/env zsh +# +# + +# shellcheck source=alias +[ -f "$XDG_CONFIG_HOME/sh/alias" ] && . "$XDG_CONFIG_HOME/sh/alias" +# load additional aliases +if [ -d "$XDG_CONFIG_HOME/sh/alias.d" ]; then + for _alias in "$XDG_CONFIG_HOME/sh/alias.d"/*.sh; do + . "$_alias" + done + unset _alias +fi + +# history +# +# Show the top 5 commands used in recent history +history_top() { + history | awk "{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}" | sort -rn | head +} +# Display timestamped recent command history +alias history="fc -l -d -D"