Add basic zsh connection

This commit is contained in:
Marty Oehme 2020-02-01 18:24:18 +01:00
parent 902ca7dc02
commit bb900a090f
9 changed files with 69 additions and 54 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

View file

@ -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}

View file

@ -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

View file

@ -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"

12
zsh/.config/zsh/.zprofile Normal file
View file

@ -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

20
zsh/.config/zsh/.zshenv Normal file
View file

@ -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

22
zsh/.config/zsh/.zshrc Normal file
View file

@ -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"