shitton of changes to zsh as i am moving back to it

master
Drake 2 years ago
parent 64ade7c45e
commit b9e68ca25d

@ -13,8 +13,6 @@ zmodule input
#
# Prompt
#
# Exposes to prompts how long the last command took to execute, used by asciiship.
zmodule duration-info
# Exposes git repository status information to prompts, used by asciiship.
zmodule git-info
@ -32,8 +30,6 @@ zmodule zsh-users/zsh-syntax-highlighting
# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting
zmodule zsh-users/zsh-history-substring-search
zmodule romkatv/powerlevel10k
zmodule romkatv/zsh-prompt-benchmark
zmodule zpm-zsh/ls
zmodule larkery/zsh-histdb
zmodule ajeetdsouza/zoxide

104
.zshrc

@ -2,52 +2,13 @@
#Apparently, P10k removes tty access, so we need to define it up here to fix that
export GPG_TTY=$(tty)
GITSTATUS_LOG_LEVEL=DEBUG
SCRIPT_SOURCE=$(readlink -f ~/.zshrc)
SCRIPT_SOURCE=${SCRIPT_SOURCE:a:h}
source $SCRIPT_SOURCE/boilerplate.zsh
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Set editor default keymap to emacs (`-e`) or vi (`-v`)
bindkey -e
# Remove path separator from WORDCHARS.
WORDCHARS=${WORDCHARS//[\/]}
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242'
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
# Update static initialization script if it does not exist or it's outdated, before sourcing it
source ${ZIM_HOME}/zimfw.zsh init -q
fi
source ${ZIM_HOME}/init.zsh
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# Bind up and down keys
zmodload -F zsh/terminfo +p:terminfo
if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
bindkey ${terminfo[kcuu1]} history-substring-search-up
bindkey ${terminfo[kcud1]} history-substring-search-down
fi
# Lines configured by zsh-newuser-install
HISTFILE=~/.zshhistory
HISTSIZE=1000
SAVEHIST=10000
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/ruthenic/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
#Drake's shit
#Setup Zoxide alias
@ -58,11 +19,6 @@ alias sudo="doas"
#Setup $PATH
PATH="/usr/lib/jvm/graalvm16/bin:$PATH:/home/ruthenic/.local/bin:/usr/share/code"
#Make ZSH highlighting colors more Fish-like
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=blue,underline
ZSH_HIGHLIGHT_STYLES[precommand]=fg=blue,underline
ZSH_HIGHLIGHT_STYLES[arg0]=fg=blue
#Set up general-use aliases
alias npm="pnpm"
alias xbps-search="xbps-query -Rs"
@ -80,8 +36,6 @@ function mkcd() {
cd $1
}
export JAVA_HOME=${JAVA_HOME=/usr/lib/jvm/graalvm16}
_zsh_autosuggest_strategy_histdb_top() {
local query="select commands.argv from
history left join commands on history.command_id = commands.rowid
@ -93,11 +47,49 @@ order by places.dir != '$(sql_escape $PWD)', count(*) desc limit 1"
}
ZSH_AUTOSUGGEST_STRATEGY=histdb_top
alias luamake=/home/ruthenic/lua-language-server/3rd/luamake/luamake
#prompt
autoload -Uz add-zsh-hook
_git_full=
function _git_info() {
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
}
# bun completions
[ -s "/home/ruthenic/.bun/_bun" ] && source "/home/ruthenic/.bun/_bun"
add-zsh-hook precmd _git_info
# Bun
export BUN_INSTALL="/home/ruthenic/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
PS1=$'\n| %{\e[0;31m%}%~ %{\e[0m%}| %{\e[0;34m%}%n %{\e[0m%}$_git_full \n\\\_%(!.#.$) '
RPS1=$'%{\e[0;31m%}$(date +%I:%M:%S%P)%{\e[0m%} |'

@ -0,0 +1,38 @@
# Remove path separator from WORDCHARS.
WORDCHARS=${WORDCHARS//[\/]}
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242'
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
# Update static initialization script if it does not exist or it's outdated, before sourcing it
source ${ZIM_HOME}/zimfw.zsh init -q
fi
source ${ZIM_HOME}/init.zsh
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# Bind up and down keys
zmodload -F zsh/terminfo +p:terminfo
if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
bindkey ${terminfo[kcuu1]} history-substring-search-up
bindkey ${terminfo[kcud1]} history-substring-search-down
fi
# Lines configured by zsh-newuser-install
HISTFILE=~/.zshhistory
HISTSIZE=1000
SAVEHIST=10000
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/ruthenic/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
#Make ZSH highlighting colors more Fish-like
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=blue,underline
ZSH_HIGHLIGHT_STYLES[precommand]=fg=blue,underline
ZSH_HIGHLIGHT_STYLES[arg0]=fg=blue
Loading…
Cancel
Save