zsh: realized some things need to be functions
By that, I mean things that change my working directory need to be functions
This commit is contained in:
parent
cba8e92e1d
commit
06ab216290
11 changed files with 93 additions and 94 deletions
32
.zshrc
32
.zshrc
|
@ -13,13 +13,14 @@
|
|||
export EDITOR=vi
|
||||
fi
|
||||
|
||||
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local/bin}:${XDG_CONFIG_HOME:-$HOME/.config/shell/bin}"
|
||||
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local}/bin:$SHELL_CONFIG_DIR/bin"
|
||||
export SHELL_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/shell"
|
||||
export SYSTEMD_EDITOR="$EDITOR"
|
||||
|
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||
export ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
|
||||
|
||||
export ZINIT_HOME_DIR="$HOME/.local/share/zinit"
|
||||
export ZINIT_HOME_DIR="${XDG_DATA_HOME:-$HOME/.local}/share/zinit"
|
||||
|
||||
# Don't add extra space to the right side of the prompt
|
||||
ZLE_RPROMPT_INDENT=0
|
||||
|
@ -45,7 +46,7 @@
|
|||
# <<<
|
||||
|
||||
# optionally source an external environment variable file
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc"
|
||||
[ -f "$SHELL_CONFIG_DIR/shell/envrc" ] && source "$SHELL_CONFIG_DIR/shell/envrc"
|
||||
}
|
||||
# <<<
|
||||
### Aliases >>>
|
||||
|
@ -174,7 +175,7 @@
|
|||
|
||||
# <<<
|
||||
# optionally source an external alias file
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
|
||||
[ -f "$SHELL_CONFIG_DIR/shell/aliasrc" ] && source "$SHELL_CONFIG_DIR/shell/aliasrc"
|
||||
}
|
||||
|
||||
# # TODO: remove all aliases that refrence programs which do not exist >>>
|
||||
|
@ -197,11 +198,13 @@
|
|||
# <<<
|
||||
### Functions >>>
|
||||
{
|
||||
# grab all shell functions that are in files
|
||||
source "$SHELL_CONFIG_DIR"/functions/*
|
||||
|
||||
# for sending error messages from functions and whatnot
|
||||
error() {
|
||||
ERROR_CODE="$?"
|
||||
>&2 echo "An error occurred within a function in the .zshrc on line number ${1}"
|
||||
>&2 echo "(zshrc) An error occurred on line number ${1}"
|
||||
return $ERROR_CODE
|
||||
}
|
||||
|
||||
|
@ -211,24 +214,13 @@
|
|||
cd "$1" || error $LINENO
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
random-mac() {
|
||||
interfaces=(enp5s0 wlp4s0)
|
||||
for interface in "${interfaces[@]}";do
|
||||
echo " Changing interface: $interface"
|
||||
sudo ip link set dev $interface down
|
||||
sudo macchanger -r $interface
|
||||
sudo ip link set dev $interface up
|
||||
done
|
||||
}
|
||||
|
||||
# believe it or not, zsh makes for a fine calculator
|
||||
calc() {
|
||||
echo $(($*))
|
||||
}
|
||||
|
||||
# optionally source an external function file
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc"
|
||||
[ -f "$SHELL_CONFIG_DIR/fnrc" ] && source "$SHELL_CONFIG_DIR/fnrc"
|
||||
}
|
||||
# <<<
|
||||
# <<<
|
||||
|
@ -290,9 +282,9 @@
|
|||
|
||||
## Themes
|
||||
# terminal colors
|
||||
if [[ -f ~/.config/shell/colors.sh ]];then
|
||||
if [[ -f "$SHELL_CONFIG_DIR/shell/colors.sh" ]];then
|
||||
# custom colors
|
||||
source ~/.config/shell/colors.sh
|
||||
source "$SHELL_CONFIG_DIR/shell/colors.sh"
|
||||
else
|
||||
# onedark shell colors
|
||||
zinit snippet 'https://github.com/chriskempson/base16-shell/blob/master/scripts/base16-onedark.sh'
|
||||
|
@ -557,7 +549,7 @@ load_working_dir && cd - > /dev/null
|
|||
# <<<
|
||||
|
||||
# Optionally source the user's customized .zshrc
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" || true
|
||||
[ -f "$SHELL_CONFIG_DIR/zshrc.local" ] && source "$SHELL_CONFIG_DIR/zshrc.local" || true
|
||||
|
||||
# vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue