You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.4 KiB

#Drake's Early Shit
#Apparently, P10k removes tty access, so we need to define it up here to fix that
export GPG_TTY=$(tty)
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"
SCRIPT_SOURCE=$(readlink -f ~/.zshrc)
SCRIPT_SOURCE=${SCRIPT_SOURCE:a:h}
source $SCRIPT_SOURCE/boilerplate.zsh
# Set editor default keymap to emacs (`-e`) or vi (`-v`)
bindkey -e
#Drake's shit
#Setup Zoxide alias
alias cd="z"
#Setup doas alias
alias sudo="doas"
#Setup $PATH
PATH="./node_modules/.bin:/usr/lib/jvm/graalvm16/bin:$PATH:/home/ruthenic/.local/bin:/usr/share/code"
#Set up general-use aliases
alias npm="pnpm"
alias xbps-search="xbps-query -Rs"
alias cat="bat"
#alias micro="nvim"
alias cls="/usr/bin/clear"
alias ssh="kitty +kitten ssh -XY"
#alias clear="clear;ls"
function fullpath() {
local fptmp=${PWD}
for x ($*); do local fptmp="$fptmp/$x"; done
echo $fptmp
}
function mkcd() {
mkdir $1
cd $1
}
_zsh_autosuggest_strategy_histdb_top() {
local query="select commands.argv from
history left join commands on history.command_id = commands.rowid
left join places on history.place_id = places.rowid
where commands.argv LIKE '$(sql_escape $1)%'
group by commands.argv
order by places.dir != '$(sql_escape $PWD)', count(*) desc limit 1"
suggestion=$(_histdb_query "$query")
}
ZSH_AUTOSUGGEST_STRATEGY=histdb_top
#prompt
autoload -Uz add-zsh-hook
_git_full=
function _git_info() {
if [[ -v DISABLE_GIT ]]; then
return
fi
local modified=0;
local new=0;
_git_full=
git status --porcelain 2>/dev/null 1>/dev/null
if [ $? != 0 ]; then
return
else
_git_full+="| "
fi
branch=$(git branch --show-current)
if [[ -n $branch ]]; then
_git_full+=$'%{\e[0;32m%}'
_git_full+="$branch "
_git_full+=$'%{\e[0m%}'
fi
for x in $(git status --porcelain); do
x=$(echo $x | cut -c1)
if [ $x = "M" ] || [ $x = "D" ]; then
let modified+=1
elif [ $x = "?" ]; then
let new+=1
fi
done
if [[ $modified -gt 0 ]]; then
_git_full+=$'%{\e[0;33m%}'
_git_full+="!$modified "
_git_full+=$'%{\e[0m%}'
fi
if [[ $new -gt 0 ]]; then
_git_full+=$'%{\e[0;36m%}'
_git_full+="?$new "
_git_full+=$'%{\e[0m%}'
fi
}
alias disable_git_status="DISABLE_GIT=1"
alias enable_git_status="unset DISABLE_GIT"
add-zsh-hook precmd _git_info
PS1=$'\n| %{\e[0;31m%}%~ %{\e[0m%}| %{\e[0;34m%}%n %{\e[0m%}$_git_full \n\\\_%(!.#.$) '
RPS1=$'%{\e[A%}%{\e[0;31m%}$(date +%I:%M:%S%P)%{\e[0m%} |%{\e[B%}'