dots/stow/.zshrc

103 lines
2.1 KiB
Bash

# z shell configuration
export OSICON="?"
if [ -e /System ]; then
OSICON=""
else
. /etc/os-release &> /dev/null
if [ "$ID" = "nixos" ]; then
OSICON=""
elif [ "$ID" = "debian" ]; then
OSICON=""
elif [ "$ID" = "fedora" ]; then
OSICON="󰣇"
elif [ "$ID" = "arch" ]; then
OSICON=""
fi
fi
PROMPT="%K{blue}%F{black} %~ %K{yellow} $OSICON %k "
bindkey -e
# zstyles
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
# hist
HISTFILE="$HOME/.local/share/zsh_hist"
HISTSIZE=10000000
SAVEHIST=$HISTSIZE
setopt appendhistory
setopt sharehistory
setopt hist_save_no_dups
setopt hist_ignore_all_dups
setopt hist_find_no_dups
setopt hist_ignore_space
# shell alias
alias ls="ls -h --color=auto"
alias la="ls -ah --color=auto"
alias ll="ls -ahl --color=auto"
alias cat="bat"
alias tmux="tmux -f $HOME/.config/tmux/tmux.conf" # needed for osx systems for some reason
# env vars
export GOPATH="$HOME/.local/share/go"
export PATH="$PATH:$GOPATH/bin"
export EDITOR="nvim"
# functions
func calc() {
# why isn't this in bash by default
#
if command -v python3 > /dev/null; then
python3 -c "print($1)"
else
echo "python3 needs to be installed for this to work!"
fi
}
func 0x0() {
if [ -d "$1" ];
then
TMPFILE="$(mktemp)"
tar cf "$TMPFILE" "$1"
curl -F file=@$TMPFILE -F expires=24 https://0x0.st
else
curl -F file=@$1 -F expires=24 https://0x0.st
fi
}
# plugins
plugindir="$HOME/.local/share/zsh_plug"
func plugInstall() {
# clones a repo and then sources it.
# first arg is git url, second is source
# location
foldername=$(basename $1)
clonepath="$plugindir/$foldername"
sourcefile="$clonepath/$2"
if command -v git > /dev/null && [ ! -d "$clonepath" ]; then
git clone $1 "$clonepath" --depth=1
fi
if [ -f "$sourcefile" ]; then
source "$sourcefile"
fi
}
plugInstall https://github.com/zsh-users/zsh-syntax-highlighting zsh-syntax-highlighting.zsh
plugInstall https://github.com/Aloxaf/fzf-tab fzf-tab.zsh
# load fzf and zoxide
eval "$(fzf --zsh)"
eval "$(zoxide init zsh)"