Add .config/zsh/.p10k.zsh

Add .config/zsh/.zfunc/prompt_jinks_setup
Add .config/zsh/.zshrc
Add .config/zsh/.zsh_history
Add .config/zsh/.zshenv
Add .config/zsh/.p10k.zsh.zwc
This commit is contained in:
Jinks 2025-06-10 11:51:25 +02:00
parent 73d3142fee
commit e1b13231e2
6 changed files with 12924 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,90 @@
prompt_jinks_help () {
cat <<EOH
This prompt is color-scheme-able. You can invoke it thus:
prompt jinks [<hostname+clock-color> [<user-color> [<root-color>]]]
The default colors are green for host and green/red for user/root.
This theme works best with a dark background.
EOH
}
prompt_jinks_setup () {
GITBRANCH=`which git 2>/dev/null`
precmd () {
psvar=()
if [[ -n ${GITBRANCH} ]]; then
BRANCH=($(git branch 2>/dev/null | grep '*')); BRANCH=$BRANCH[2]
if [ $BRANCH ]; then
BRANCH="(git: $BRANCH) "
psvar[1]=$BRANCH
fi
fi
}
setopt promptsubst
local host_col=${1:-'green'}
local user_col=${2:-'green'}
local root_col=${3:-'red'}
local parens_col=blue
colors
PR_TITLEBAR=''
PR_STITLE=''
case $TERM in
xterm*|rxvt*)
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | %y\a%}'
;;
screen)
PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | %y\e\\%}'
PR_STITLE=$'%{\ekzsh\e\\%}'
;;
*)
PR_TITLEBAR=''
;;
esac
local parens="%{$fg_bold[$parens_col]%}"
local host="%{$fg_bold[$host_col]%}"
local usr="%{$fg_bold[$user_col]%}"
local root="%{$fg_bold[$root_col]%}"
local reset="%{$reset_color%}"
local lpar="$parens($reset"
local rpar="$parens)$reset"
local lbra="$parens%\[$reset"
local rbra="$parens%\]$reset"
local clock="$lpar%{$fg_bold[$host_col]%}%T$rpar"
local userstr="%(!.$root.$usr)%n"
local hoststr="%{$fg_no_bold[yellow]%}@$host%m"
local dirstr="%{$fg_bold[cyan]%}%~"
[[ -n $SCHROOT_SESSION_ID ]] && local schroot="$lpar%{$fg_bold[red]%}${SCHROOT_SESSION_ID%%-*}$rpar"
PS2="$lpar%{$fg_bold[cyan]%}%_$rpar%{$fg_bold[yellow]%} ->$reset "
RPROMPT="(%B%(?.%{$fg_bold[green]%}%?.%{$fg_bold[red]%}%?)%b$reset)"
PROMPT="$PR_STITLE${(e)PR_TITLEBAR}$schroot$clock$lbra$userstr$hoststr$rbra$dirstr$reset %v%# "
}
prompt_jinks_preview () {
local color colors
colors=(red yellow green blue magenta)
if (( ! $#* )); then
for (( i = 1; i <= $#colors; i++ )); do
color=$colors[$i]
prompt_preview_theme jinks $color
(( i < $#colors )) && print
done
else
prompt_preview_theme jinks "$@"
fi
}
prompt_jinks_setup "$@"
# vim: ft=zsh:

View file

@ -0,0 +1,252 @@
# Personal Zsh configuration file. It is strongly recommended to keep all
# shell customization and configuration (including exported environment
# variables such as PATH) in this file or in files sourced from it.
#
# Documentation: https://github.com/romkatv/zsh4humans/blob/v5/README.md.
# Periodic auto-update on Zsh startup: 'ask' or 'no'.
# You can manually run `z4h update` to update everything.
zstyle ':z4h:' auto-update 'no'
# Ask whether to auto-update this often; has no effect if auto-update is 'no'.
zstyle ':z4h:' auto-update-days '28'
# Keyboard type: 'mac' or 'pc'.
zstyle ':z4h:bindkey' keyboard 'pc'
# Don't start tmux.
zstyle ':z4h:' start-tmux no
# Mark up shell's output with semantic information.
zstyle ':z4h:' term-shell-integration 'yes'
# Right-arrow key accepts one character ('partial-accept') from
# command autosuggestions or the whole thing ('accept')?
zstyle ':z4h:autosuggestions' forward-char 'accept'
# Recursively traverse directories when TAB-completing files.
zstyle ':z4h:fzf-complete' recurse-dirs 'no'
# Enable direnv to automatically source .envrc files.
zstyle ':z4h:direnv' enable 'no'
# Show "loading" and "unloading" notifications from direnv.
zstyle ':z4h:direnv:success' notify 'yes'
# Enable ('yes') or disable ('no') automatic teleportation of z4h over
# SSH when connecting to these hosts.
zstyle ':z4h:ssh:example-hostname1' enable 'yes'
zstyle ':z4h:ssh:zeus' enable 'yes'
zstyle ':z4h:ssh:*.example-hostname2' enable 'no'
# The default value if none of the overrides above match the hostname.
zstyle ':z4h:ssh:*' enable 'no'
# Send these files over to the remote host when connecting over SSH to the
# enabled hosts.
zstyle ':z4h:ssh:*' send-extra-files '~/.nanorc' '~/.env.zsh'
# Clone additional Git repositories from GitHub.
#
# This doesn't do anything apart from cloning the repository and keeping it
# up-to-date. Cloned files can be used after `z4h init`. This is just an
# example. If you don't plan to use Oh My Zsh, delete this line.
z4h install ohmyzsh/ohmyzsh || return
# Install or update core components (fzf, zsh-autosuggestions, etc.) and
# initialize Zsh. After this point console I/O is unavailable until Zsh
# is fully initialized. Everything that requires user interaction or can
# perform network I/O must be done above. Everything else is best done below.
z4h init || return
# Extend PATH.
path=(~/bin $path)
# Export environment variables.
export GPG_TTY=$TTY
# Source additional local files if they exist.
z4h source ~/.env.zsh
# Use additional Git repositories pulled in with `z4h install`.
#
# This is just an example that you should delete. It does nothing useful.
z4h source ohmyzsh/ohmyzsh/lib/diagnostics.zsh # source an individual file
z4h load ohmyzsh/ohmyzsh/plugins/emoji-clock # load a plugin
# Define key bindings.
z4h bindkey z4h-backward-kill-word Ctrl+Backspace Ctrl+H
z4h bindkey z4h-backward-kill-zword Ctrl+Alt+Backspace
z4h bindkey undo Ctrl+/ Shift+Tab # undo the last command line change
z4h bindkey redo Alt+/ # redo the last undone command line change
z4h bindkey z4h-cd-back Alt+Left # cd into the previous directory
z4h bindkey z4h-cd-forward Alt+Right # cd into the next directory
z4h bindkey z4h-cd-up Alt+Up # cd into the parent directory
z4h bindkey z4h-cd-down Alt+Down # cd into a child directory
# Autoload functions.
autoload -Uz zmv
# Define functions and completions.
function md() { [[ $# == 1 ]] && mkdir -p -- "$1" && cd -- "$1" }
compdef _directories md
# Define named directories: ~w <=> Windows home directory on WSL.
[[ -z $z4h_win_home ]] || hash -d w=$z4h_win_home
# Define aliases.
alias tree='tree -a -I .git'
# Add flags to existing aliases.
alias ls="${aliases[ls]:-ls} -A"
# Set shell options: http://zsh.sourceforge.net/Doc/Release/Options.html.
setopt glob_dots # no special treatment for file names with a leading dot
setopt no_auto_menu # require an extra TAB press to open the completion menu
# Personal settings
# Some extra configuration
setopt numericglobsort # sort filenames numerically when it makes sense
# History configurations
HISTSIZE=50000
SAVEHIST=30000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_all_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt inc_append_history # Write to the history file immediately, not when the shell exits. -- conflicts with share_history
setopt share_history # share command history data
setopt extended_history # Write the history file in the ":start:elapsed;command" format.
setopt hist_save_no_dups # Don't write duplicate entries in the history file.
setopt hist_reduce_blanks # Remove superfluous blanks before recording entry.
# force zsh to show the complete history
alias history="history 0"
# enable additional color support
if [ -x /usr/bin/dircolors ]; then
alias fgrep='fgrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
fi
# Distro specific settings
[[ -a /etc/gentoo-release ]] && export DISTRO=gentoo
[[ -a /etc/arch-release ]] && export DISTRO=arch
[[ -a /etc/debian_version ]] && export DISTRO=debian
case $DISTRO in
(debian)
sudo="sudo "
alias agi="${sudo}apt install"
alias pai="${sudo}apt install"
alias acs="apt search"
alias pas="apt search"
alias acp="apt policy"
alias acss="apt show"
alias agu="${sudo}apt update"
alias agdu="${sudo}apt dist-upgrade"
;;
(gentoo)
export PALUDIS_OPTIONS="--dl-reinstall-scm weekly"
export PALUDIS_NO_WRITE_CACHE_CLEAN=yes
alias emerge='echo "Use Paludis!"'
alias pap='paludis -pi'
alias pai='nice -n 20 paludis -i'
alias pas='inquisitio -s'
alias paq='paludis -q'
alias qlop='pint.rb'
alias pao='paludis -o'
alias pal='paludis --contents'
;;
(arch)
pkgman="pacman"
sudo="sudo "
if [ -x /usr/bin/yay ]; then
pkgman="yay"
sudo=""
fi
if [ -x /usr/bin/paru ]; then
pkgman="paru"
sudo=""
alias yay=paru
fi
alias pai="${sudo}${pkgman} -S ${aur}"
alias paR="${sudo}${pkgman} -Rnsc ${aur}"
alias pas="${pkgman} -Ss ${aur}"
alias pao="${pkgman} -Qo"
alias pal="${pkgman} -Ql"
alias paq="yes n |${sudo}${pkgman} -Si ${aur}"
alias padu="${sudo}${pkgman} -Syu"
alias y="${sudo}${pkgman} ${aur}"
;;
esac
# Functions
hex() { echo ${$(echo "obase=16; $1" | bc):l} }
int() { echo $(echo "ibase=16; ${1:u}" | bc) }
# Bash Versions:
# hex() { I=$(echo "obase=16; $1" | bc); echo ${I,,}; }
# int() { H=${1^^}; echo $(echo "ibase=16; $H" | bc); }
clearcaches()
{
echo "Before:"
free -m
echo -n 'syncing... '
sync
echo 'clearing caches...\n'
echo -n '3' > /proc/sys/vm/drop_caches
echo 'After:'
free -m
}
saneperms()
{
find . -type d -print0| xargs -0 chmod 755
find . -type f -print0| xargs -0 chmod ${1:=644}
}
lowercase()
{
print -n 'Really lowercase all files? (yn) '
if read -q ; then
for i in * ; do
mv $i $i:l
done
fi
}
dirdiff()
{
# Shell-escape each path:
DIR1=$(printf '%q' "$1"); shift
DIR2=$(printf '%q' "$1"); shift
nvim $@ -c "DirDiff $DIR1 $DIR2"
}
# Global aliases -- These do not have to be at the beginning of
# the command line.
alias -g :g='| grep' # Easy grepping
alias -g :p='| $PAGER' # Easy piping one
alias -g :sp='| sort | $PAGER' # Easy piping two
alias -g :n='&> /dev/null' # Easy piping to /dev/null
alias -g :sn='1> /dev/null' # See above
alias -g :en='2> /dev/null' # Ditto
# Directories
hash -d KSP='/mnt/games/Steam/steamapps/common/Kerbal Space Program'
# Aliases
alias quickweb='python -m http.server'
alias df='pydf'
alias screen='tmux'
alias pp='python -mjson.tool'
alias vim='nvim'
alias vimdiff='nvim -d'
if (( _z4h_use[zsh-history-substring-search] )); then
# Move cursor one line up or fetch the previous command from LOCAL history.
bindkey '^[[A' z4h-up-substring-global # up
# Move cursor one line down or fetch the next command from LOCAL history.
bindkey '^[[B' z4h-down-substring-global # down
else
# Move cursor one line up or fetch the previous command from LOCAL history.
bindkey '^[[A' z4h-up-prefix-global # up
# Move cursor one line down or fetch the next command from LOCAL history.
bindkey '^[[B' z4h-down-prefix-global # down
fi

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,45 @@
# Documentation: https://github.com/romkatv/zsh4humans/blob/v5/README.md.
#
# Do not modify this file unless you know exactly what you are doing.
# It is strongly recommended to keep all shell customization and configuration
# (including exported environment variables such as PATH) in ~/.zshrc or in
# files sourced from ~/.zshrc. If you are certain that you must export some
# environment variables in ~/.zshenv, do it where indicated by comments below.
if [ -n "${ZSH_VERSION-}" ]; then
# If you are certain that you must export some environment variables
# in ~/.zshenv (see comments at the top!), do it here:
#
# export GOPATH=$HOME/go
#
# Do not change anything else in this file.
: ${ZDOTDIR:=~}
setopt no_global_rcs
[[ -o no_interactive && -z "${Z4H_BOOTSTRAPPING-}" ]] && return
setopt no_rcs
unset Z4H_BOOTSTRAPPING
fi
Z4H_URL="https://raw.githubusercontent.com/romkatv/zsh4humans/v5"
: "${Z4H:=${XDG_CACHE_HOME:-$HOME/.cache}/zsh4humans/v5}"
umask o-w
if [ ! -e "$Z4H"/z4h.zsh ]; then
mkdir -p -- "$Z4H" || return
>&2 printf '\033[33mz4h\033[0m: fetching \033[4mz4h.zsh\033[0m\n'
if command -v curl >/dev/null 2>&1; then
curl -fsSL -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
elif command -v wget >/dev/null 2>&1; then
wget -O- -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
else
>&2 printf '\033[33mz4h\033[0m: please install \033[32mcurl\033[0m or \033[32mwget\033[0m\n'
return 1
fi
mv -- "$Z4H"/z4h.zsh.$$ "$Z4H"/z4h.zsh || return
fi
. "$Z4H"/z4h.zsh || return
setopt rcs

Binary file not shown.