This commit is contained in:
2026-05-26 15:01:41 +02:00
parent 789ca8a41c
commit 8aa0d0ff61
9 changed files with 293 additions and 293 deletions
@@ -1,5 +1,5 @@
if [ -d "$HOME/.zfunc" ]; then if [ -d "$HOME/.zfunc" ]; then
fpath=($HOME/.zfunc $fpath) fpath=($HOME/.zfunc $fpath)
fi fi
if [ -d "$HOME/.zsh/completions" ]; then if [ -d "$HOME/.zsh/completions" ]; then
@@ -9,9 +9,9 @@ fi
# Cache compinit: only regenerate dump once daily # Cache compinit: only regenerate dump once daily
autoload -Uz compinit autoload -Uz compinit
if [[ -n ${ZDOTDIR:-$HOME}/.zcompdump(#qN.mh+24) ]]; then if [[ -n ${ZDOTDIR:-$HOME}/.zcompdump(#qN.mh+24) ]]; then
compinit compinit
else else
compinit -C compinit -C
fi fi
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
@@ -2,19 +2,19 @@ _uy_antidote_dir="${XDG_DATA_HOME:-$HOME/.local/share}/antidote"
# Find antidote: system package → user-local clone → auto-bootstrap # Find antidote: system package → user-local clone → auto-bootstrap
if [[ -f /usr/share/zsh-antidote/antidote.zsh ]]; then if [[ -f /usr/share/zsh-antidote/antidote.zsh ]]; then
source /usr/share/zsh-antidote/antidote.zsh source /usr/share/zsh-antidote/antidote.zsh
elif [[ -f "$_uy_antidote_dir/antidote.zsh" ]]; then elif [[ -f "$_uy_antidote_dir/antidote.zsh" ]]; then
source "$_uy_antidote_dir/antidote.zsh" source "$_uy_antidote_dir/antidote.zsh"
elif (( $+commands[git] )); then elif (( $+commands[git] )); then
git clone --depth=1 https://github.com/mattmc3/antidote.git "$_uy_antidote_dir" git clone --depth=1 https://github.com/mattmc3/antidote.git "$_uy_antidote_dir"
source "$_uy_antidote_dir/antidote.zsh" source "$_uy_antidote_dir/antidote.zsh"
fi fi
if (( $+functions[antidote] )); then if (( $+functions[antidote] )); then
_uy_zsh_plugins="${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zsh_plugins.txt" _uy_zsh_plugins="${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zsh_plugins.txt"
if [[ -f "$_uy_zsh_plugins" ]]; then if [[ -f "$_uy_zsh_plugins" ]]; then
antidote load "$_uy_zsh_plugins" antidote load "$_uy_zsh_plugins"
fi fi
fi fi
unset _uy_antidote_dir _uy_zsh_plugins unset _uy_antidote_dir _uy_zsh_plugins
+37 -37
View File
@@ -10,56 +10,56 @@ zmodload zsh/datetime
: ${uy_done_exclude:='^(nvim|helix|hx|vim|vi|nano|less|more|man|ssh|top|htop|btop)$'} : ${uy_done_exclude:='^(nvim|helix|hx|vim|vi|nano|less|more|man|ssh|top|htop|btop)$'}
uy_done_get_focused_window_id() { uy_done_get_focused_window_id() {
(( $+commands[jq] )) || return (( $+commands[jq] )) || return
niri msg --json focused-window 2>/dev/null | jq -r '.id // empty' niri msg --json focused-window 2>/dev/null | jq -r '.id // empty'
} }
uy_done_preexec() { uy_done_preexec() {
uy_done_cmd="$1" uy_done_cmd="$1"
uy_done_start=$EPOCHSECONDS uy_done_start=$EPOCHSECONDS
uy_done_window_id=$(uy_done_get_focused_window_id) uy_done_window_id=$(uy_done_get_focused_window_id)
} }
uy_done_precmd() { uy_done_precmd() {
local exit_status=$? local exit_status=$?
[[ -n "$uy_done_start" ]] || return [[ -n "$uy_done_start" ]] || return
local elapsed=$(( EPOCHSECONDS - uy_done_start )) local elapsed=$(( EPOCHSECONDS - uy_done_start ))
unset uy_done_start unset uy_done_start
(( elapsed >= uy_done_min_cmd_duration )) || return (( elapsed >= uy_done_min_cmd_duration )) || return
# skip excluded commands # skip excluded commands
local cmd_name="${uy_done_cmd%% *}" local cmd_name="${uy_done_cmd%% *}"
[[ "$cmd_name" =~ $uy_done_exclude ]] && return [[ "$cmd_name" =~ $uy_done_exclude ]] && return
# skip if window is still focused # skip if window is still focused
local current_id local current_id
current_id=$(uy_done_get_focused_window_id) current_id=$(uy_done_get_focused_window_id)
[[ -n "$uy_done_window_id" && "$uy_done_window_id" = "$current_id" ]] && return [[ -n "$uy_done_window_id" && "$uy_done_window_id" = "$current_id" ]] && return
# humanize duration # humanize duration
local title duration="" urgency=low local title duration="" urgency=low
local minutes=$(( elapsed / 60 )) seconds=$(( elapsed % 60 )) local minutes=$(( elapsed / 60 )) seconds=$(( elapsed % 60 ))
local hours=$(( elapsed / 3600 )) local hours=$(( elapsed / 3600 ))
(( hours > 0 )) && duration+="${hours}h " (( hours > 0 )) && duration+="${hours}h "
(( minutes > 0 )) && duration+="$(( minutes % 60 ))m " (( minutes > 0 )) && duration+="$(( minutes % 60 ))m "
duration+="${seconds}s" duration+="${seconds}s"
local wd="${PWD/#$HOME/~}" local wd="${PWD/#$HOME/~}"
if (( exit_status == 0 )); then if (( exit_status == 0 )); then
title="Done in $duration" title="Done in $duration"
else else
title="Failed ($exit_status) after $duration" title="Failed ($exit_status) after $duration"
urgency=critical urgency=critical
fi fi
notify-send \ notify-send \
--hint=int:transient:1 \ --hint=int:transient:1 \
--urgency="$urgency" \ --urgency="$urgency" \
--icon=utilities-terminal \ --icon=utilities-terminal \
--app-name=zsh \ --app-name=zsh \
"$title" "$wd/ $uy_done_cmd" & "$title" "$wd/ $uy_done_cmd" &
} }
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
+12 -12
View File
@@ -1,29 +1,29 @@
# MANPAGER # MANPAGER
if (( $+commands[bat] )); then if (( $+commands[bat] )); then
export MANPAGER="sh -c 'col -bx | bat -l man -p'" export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANROFFOPT=-c export MANROFFOPT=-c
fi fi
# Editor # Editor
for _uy_app in nvim helix vim vi nano; do for _uy_app in nvim helix vim vi nano; do
if (( $+commands[$_uy_app] )); then if (( $+commands[$_uy_app] )); then
export EDITOR=$_uy_app export EDITOR=$_uy_app
export VISUAL=$_uy_app export VISUAL=$_uy_app
break break
fi fi
done done
unset _uy_app unset _uy_app
if (( $+commands[helix] )) && ! (( $+commands[hx] )); then if (( $+commands[helix] )) && ! (( $+commands[hx] )); then
alias hx=helix alias hx=helix
fi fi
# GPG # GPG
if (( $+commands[gpg] )); then if (( $+commands[gpg] )); then
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
fi fi
# Catppuccin Mocha — autosuggestions color # Catppuccin Mocha — autosuggestions color
@@ -39,12 +39,12 @@ fi
# fnm # fnm
if (( $+commands[fnm] )); then if (( $+commands[fnm] )); then
eval "$(fnm env --shell zsh --use-on-cd)" eval "$(fnm env --shell zsh --use-on-cd)"
fi fi
# bat # bat
if (( $+commands[bat] )); then if (( $+commands[bat] )); then
export BAT_THEME="Catppuccin Mocha" export BAT_THEME="Catppuccin Mocha"
export BAT_STYLE="default,-numbers" export BAT_STYLE="default,-numbers"
fi fi
+42 -42
View File
@@ -1,54 +1,54 @@
# Remove the last command from history (both memory and file). # Remove the last command from history (both memory and file).
# The alias has a leading space so "oops" itself is not recorded (HIST_IGNORE_SPACE). # The alias has a leading space so "oops" itself is not recorded (HIST_IGNORE_SPACE).
uy_oops_confirm() { uy_oops_confirm() {
# Flush current session to file so we operate on the latest state # Flush current session to file so we operate on the latest state
fc -W fc -W
if [[ ! -f "$HISTFILE" || ! -s "$HISTFILE" ]]; then if [[ ! -f "$HISTFILE" || ! -s "$HISTFILE" ]]; then
print -P "%F{yellow}History is empty, nothing to delete.%f" print -P "%F{yellow}History is empty, nothing to delete.%f"
return 1 return 1
fi fi
# Read the last entry (may span multiple lines if it ends with \) # Read the last entry (may span multiple lines if it ends with \)
local -a entry local -a entry
local line local line
while IFS= read -r line; do while IFS= read -r line; do
entry+=("$line") entry+=("$line")
# EXTENDED_HISTORY continuation lines end with a literal backslash # EXTENDED_HISTORY continuation lines end with a literal backslash
[[ "$line" == *'\' ]] || break [[ "$line" == *'\' ]] || break
done < <(tail -n 50 "$HISTFILE" | tac) done < <(tail -n 50 "$HISTFILE" | tac)
# entry is reversed (last line first), flip it back # entry is reversed (last line first), flip it back
local -a ordered local -a ordered
for (( i=${#entry[@]}; i>=1; i-- )); do for (( i=${#entry[@]}; i>=1; i-- )); do
ordered+=("${entry[$i]}") ordered+=("${entry[$i]}")
done done
if (( ${#ordered[@]} == 0 )); then if (( ${#ordered[@]} == 0 )); then
print -P "%F{yellow}Could not parse last history entry.%f" print -P "%F{yellow}Could not parse last history entry.%f"
return 1 return 1
fi fi
print -P "About to permanently delete the last command from history:" print -P "About to permanently delete the last command from history:"
for line in "${ordered[@]}"; do for line in "${ordered[@]}"; do
print -P " %F{red}${line}%f" print -P " %F{red}${line}%f"
done done
local reply local reply
echo -n "Proceed? [Y/n] " echo -n "Proceed? [Y/n] "
read -r reply read -r reply
if [[ -z "$reply" || "$reply" == [yY]* ]]; then if [[ -z "$reply" || "$reply" == [yY]* ]]; then
# Delete the last N lines (the full entry) from the file # Delete the last N lines (the full entry) from the file
local n=${#ordered[@]} local n=${#ordered[@]}
head -n -"$n" "$HISTFILE" > "$HISTFILE.tmp" && mv "$HISTFILE.tmp" "$HISTFILE" head -n -"$n" "$HISTFILE" > "$HISTFILE.tmp" && mv "$HISTFILE.tmp" "$HISTFILE"
# Reload history from the updated file # Reload history from the updated file
fc -R fc -R
print -P "%F{green}Deleted ($n line(s) removed).%f" print -P "%F{green}Deleted ($n line(s) removed).%f"
else else
# Reload anyway to stay in sync # Reload anyway to stay in sync
fc -R fc -R
print -P "%F{yellow}Cancelled.%f" print -P "%F{yellow}Cancelled.%f"
fi fi
} }
alias oops=' uy_oops_confirm' alias oops=' uy_oops_confirm'
+11 -11
View File
@@ -3,17 +3,17 @@
if [[ "${UY_ENABLE_GPG_AGENT_SSH:-0}" = "1" ]] && if [[ "${UY_ENABLE_GPG_AGENT_SSH:-0}" = "1" ]] &&
(( $+commands[gpg-init] )) && (( $+commands[gpgconf] )); then (( $+commands[gpg-init] )) && (( $+commands[gpgconf] )); then
: # GPG agent handles SSH — nothing to do : # GPG agent handles SSH — nothing to do
elif [[ "${UY_USING_SSH_AGENT:-0}" = "1" ]]; then elif [[ "${UY_USING_SSH_AGENT:-0}" = "1" ]]; then
sshs() { sshs() {
if ! ssh-add -l &>/dev/null; then if ! ssh-add -l &>/dev/null; then
if [[ -n "${uy_ssh_keys[*]}" ]]; then if [[ -n "${uy_ssh_keys[*]}" ]]; then
ssh-add "${uy_ssh_keys[@]}" ssh-add "${uy_ssh_keys[@]}"
else else
ssh-add ssh-add
fi fi
fi fi
ssh "$@" ssh "$@"
} }
fi fi
+151 -151
View File
@@ -1,95 +1,95 @@
# fzf # fzf
if (( $+commands[fzf] )); then if (( $+commands[fzf] )); then
source <(fzf --zsh) source <(fzf --zsh)
# use fd if available (search cwd only, skip vcs/cache junk) # use fd if available (search cwd only, skip vcs/cache junk)
if (( $+commands[fd] )); then if (( $+commands[fd] )); then
export FD_CMD="fd" export FD_CMD="fd"
elif (( $+commands[fdfind] )); then elif (( $+commands[fdfind] )); then
export FD_CMD="fdfind" export FD_CMD="fdfind"
fi fi
if [[ -n "$FD_CMD" ]]; then if [[ -n "$FD_CMD" ]]; then
export FZF_DEFAULT_COMMAND="$FD_CMD --type f --hidden --exclude .git" export FZF_DEFAULT_COMMAND="$FD_CMD --type f --hidden --exclude .git"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="$FD_CMD --type d --hidden --exclude .git" export FZF_ALT_C_COMMAND="$FD_CMD --type d --hidden --exclude .git"
fi fi
# C-y to copy fzf's output # C-y to copy fzf's output
if (( $+commands[wl-copy] )); then if (( $+commands[wl-copy] )); then
export FZF_DEFAULT_OPTS="--bind \"ctrl-y:execute-silent(echo -n {+} | wl-copy)+abort\"" export FZF_DEFAULT_OPTS="--bind \"ctrl-y:execute-silent(echo -n {+} | wl-copy)+abort\""
fi fi
# fz: fuzzy find a file and preview # fz: fuzzy find a file and preview
if (( $+commands[bat] )); then if (( $+commands[bat] )); then
alias fz="fzf --preview 'bat --style=numbers --color=always {}'" alias fz="fzf --preview 'bat --style=numbers --color=always {}'"
else else
alias fz="fzf --preview 'cat -n {}'" alias fz="fzf --preview 'cat -n {}'"
fi fi
# fe: fuzzy find a file and edit using $EDITOR # fe: fuzzy find a file and edit using $EDITOR
fe() { fe() {
local file local file
file=$(fz --header "[edit with $EDITOR]") file=$(fz --header "[edit with $EDITOR]")
[[ -n "$file" ]] && $EDITOR "$file" [[ -n "$file" ]] && $EDITOR "$file"
} }
# fkp: fuzzy find a process and kill # fkp: fuzzy find a process and kill
fkp() { fkp() {
local pids local pids
pids=$(ps -ef | fzf -m --header-lines 1 --preview 'pstree -p $(echo {} | awk "{print \$2}")' --header "[kill process]" | awk '{print $2}') pids=$(ps -ef | fzf -m --header-lines 1 --preview 'pstree -p $(echo {} | awk "{print \$2}")' --header "[kill process]" | awk '{print $2}')
echo "$pids" | xargs -r kill -${1:-9} echo "$pids" | xargs -r kill -${1:-9}
} }
# fks: fuzzy find a TCP process and kill # fks: fuzzy find a TCP process and kill
if (( $+commands[ss] )); then if (( $+commands[ss] )); then
fks() { fks() {
local pids local pids
# Call sudo separately since one cannot enter password in fzf's window # Call sudo separately since one cannot enter password in fzf's window
pids=$(sudo ss -lptn) pids=$(sudo ss -lptn)
pids=$(echo "$pids" | fzf -m --header-lines 1 --header "[kill process]" | grep -oP 'pid=\K\d+') pids=$(echo "$pids" | fzf -m --header-lines 1 --header "[kill process]" | grep -oP 'pid=\K\d+')
echo "$pids" | xargs -r sudo kill -${1:-9} echo "$pids" | xargs -r sudo kill -${1:-9}
} }
fi fi
if (( $+commands[yay] )); then if (( $+commands[yay] )); then
# fyq: fuzzy yay local query # fyq: fuzzy yay local query
alias fyq="yay -Qq | fzf --preview 'yay -Qi {}' --preview-window='right,70%,wrap'" alias fyq="yay -Qq | fzf --preview 'yay -Qi {}' --preview-window='right,70%,wrap'"
# fyi: fuzzy yay install # fyi: fuzzy yay install
fyi() { fyi() {
local pkg local pkg
pkg=$(yay -Sl | awk '{print $1"/"$2}' | fzf -m --preview 'yay -Si {}' --preview-window='right,70%,wrap' --header "[install package]" "$@") pkg=$(yay -Sl | awk '{print $1"/"$2}' | fzf -m --preview 'yay -Si {}' --preview-window='right,70%,wrap' --header "[install package]" "$@")
# yay supports "repo/package" format # yay supports "repo/package" format
[[ -n "$pkg" ]] && yay -S ${=pkg} [[ -n "$pkg" ]] && yay -S ${=pkg}
} }
# fyr: fuzzy yay remove # fyr: fuzzy yay remove
fyr() { fyr() {
local pkg local pkg
pkg=$(yay -Qq | fzf -m --preview 'yay -Qi {}' --preview-window='right,70%,wrap' --header "[remove package]" "$@") pkg=$(yay -Qq | fzf -m --preview 'yay -Qi {}' --preview-window='right,70%,wrap' --header "[remove package]" "$@")
[[ -n "$pkg" ]] && yay -Rn ${=pkg} [[ -n "$pkg" ]] && yay -Rn ${=pkg}
} }
fi fi
fi fi
# cd (zoxide) # cd (zoxide)
if (( $+commands[zoxide] )); then if (( $+commands[zoxide] )); then
eval "$(zoxide init zsh)" eval "$(zoxide init zsh)"
alias cd=z alias cd=z
fi fi
# ls # ls
if (( $+commands[eza] )); then if (( $+commands[eza] )); then
alias ll="eza -lh --group-directories-first --icons=auto" alias ll="eza -lh --group-directories-first --icons=auto"
alias la="eza -lh --group-directories-first --icons=auto --all" alias la="eza -lh --group-directories-first --icons=auto --all"
alias lt="eza --tree --level=2 --long --icons --git" alias lt="eza --tree --level=2 --long --icons --git"
else else
alias ls="ls --color=auto" alias ls="ls --color=auto"
alias ll="ls -lh --group-directories-first --color=auto" alias ll="ls -lh --group-directories-first --color=auto"
alias la="ls -lah --group-directories-first --color=auto" alias la="ls -lah --group-directories-first --color=auto"
fi fi
# directories # directories
@@ -110,29 +110,29 @@ alias diff="diff --color=auto"
# copy # copy
copy() { copy() {
if [[ $# -eq 2 && -d "$1" ]]; then if [[ $# -eq 2 && -d "$1" ]]; then
command cp -r "${1%/}" "$2" command cp -r "${1%/}" "$2"
else else
command cp "$@" command cp "$@"
fi fi
} }
# wget # wget
if (( $+commands[wget] )); then if (( $+commands[wget] )); then
alias wget="wget -c " alias wget="wget -c "
fi fi
# pacman # pacman
if (( $+commands[expac] )); then if (( $+commands[expac] )); then
alias big="expac -H M '%m\t%n' | sort -h | nl" alias big="expac -H M '%m\t%n' | sort -h | nl"
fi fi
# clock # clock
if (( $+commands[tty-clock] )); then if (( $+commands[tty-clock] )); then
alias clock="tty-clock -c -C 4" alias clock="tty-clock -c -C 4"
fi fi
# journalctl # journalctl
@@ -142,8 +142,8 @@ alias jctl="journalctl -p 3 -xb"
# nohup # nohup
nh() { nh() {
nohup "$@" >/dev/null 2>&1 & nohup "$@" >/dev/null 2>&1 &
disown disown
} }
# ffmpeg # ffmpeg
@@ -154,92 +154,92 @@ alias ffprobe="ffprobe -hide_banner"
# git # git
if (( $+commands[git] )); then if (( $+commands[git] )); then
gcp() { gcp() {
git add -A || return 1 git add -A || return 1
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
git commit -m "👐 foo:)" || return 1 git commit -m "👐 foo:)" || return 1
else else
git commit -m "$*" || return 1 git commit -m "$*" || return 1
fi fi
git push git push
} }
if (( $+commands[wl-paste] )); then if (( $+commands[wl-paste] )); then
# Get a git repo URL from clipboard, prompting if invalid # Get a git repo URL from clipboard, prompting if invalid
uy_git_repo_from_clipboard() { uy_git_repo_from_clipboard() {
local repo local repo
repo=$(wl-paste) repo=$(wl-paste)
if [[ ! "$repo" =~ '^(http|https|git|ssh)://|^git@' ]]; then if [[ ! "$repo" =~ '^(http|https|git|ssh)://|^git@' ]]; then
echo "Error: Clipboard does not contain a valid git repository URL." >&2 echo "Error: Clipboard does not contain a valid git repository URL." >&2
echo "Error: Clipboard content: $repo" >&2 echo "Error: Clipboard content: $repo" >&2
read "repo?Enter a valid git repository URL: " read "repo?Enter a valid git repository URL: "
if [[ ! "$repo" =~ '^(http|https|git|ssh)://|^git@' ]]; then if [[ ! "$repo" =~ '^(http|https|git|ssh)://|^git@' ]]; then
echo "Error: Invalid git repository URL." >&2 echo "Error: Invalid git repository URL." >&2
return 1 return 1
fi fi
fi fi
print -r -- "$repo" print -r -- "$repo"
} }
gcl() { gcl() {
local repo local repo
repo=$(uy_git_repo_from_clipboard) || return 1 repo=$(uy_git_repo_from_clipboard) || return 1
git clone "$repo" git clone "$repo"
} }
pingo() { pingo() {
builtin cd "$HOME/Repositories/Uni" || return 1 builtin cd "$HOME/Repositories/Uni" || return 1
local repo local repo
repo=$(uy_git_repo_from_clipboard) || return 1 repo=$(uy_git_repo_from_clipboard) || return 1
local dir_name="${repo:t:r}" local dir_name="${repo:t:r}"
local course="${${dir_name%%[^[:lower:]]*}:u}" local course="${${dir_name%%[^[:lower:]]*}:u}"
mkdir -p "$course" mkdir -p "$course"
builtin cd "$course" || return 1 builtin cd "$course" || return 1
if [[ ! -d "$dir_name" ]]; then if [[ ! -d "$dir_name" ]]; then
git clone "$repo" || return 1 git clone "$repo" || return 1
fi fi
builtin cd "$dir_name" builtin cd "$dir_name"
local app="$1" local app="$1"
if [[ -n "$app" ]] && (( $+commands[$app] )); then if [[ -n "$app" ]] && (( $+commands[$app] )); then
echo "Opening project with $app" echo "Opening project with $app"
# nohup "$app" . >/dev/null 2>&1 & # nohup "$app" . >/dev/null 2>&1 &
# disown # disown
if [[ ${XDG_CURRENT_DESKTOP:-} = "niri" ]]; then if [[ ${XDG_CURRENT_DESKTOP:-} = "niri" ]]; then
niri msg action spawn -- "$app" "$HOME/Repositories/Uni/$course/$dir_name" niri msg action spawn -- "$app" "$HOME/Repositories/Uni/$course/$dir_name"
else else
nohup "$app" . >/dev/null 2>&1 & nohup "$app" . >/dev/null 2>&1 &
disown disown
fi fi
fi fi
} }
fi fi
fi fi
# jj # jj
if (( $+commands[jj] )); then if (( $+commands[jj] )); then
jjc() { jjc() {
jj describe -m "$*" jj describe -m "$*"
jj new jj new
} }
jjp() { jjp() {
default_branch() { default_branch() {
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|.*/||' \ git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|.*/||' \
|| git remote show origin | awk '/HEAD branch/ {print $NF}' || echo "master" || git remote show origin | awk '/HEAD branch/ {print $NF}' || echo "master"
} }
local branch pos local branch pos
branch=${1:-$(default_branch)} branch=${1:-$(default_branch)}
pos=${2:-@-} pos=${2:-@-}
jj bookmark move "$branch" --to "$pos" jj bookmark move "$branch" --to "$pos"
jj git push jj git push
} }
fi fi
# Global aliases (can be used as part of a command) # Global aliases (can be used as part of a command)
# wl-paste # wl-paste
if (( $+commands[wl-paste] )); then if (( $+commands[wl-paste] )); then
alias -g C="| wl-copy" alias -g C="| wl-copy"
fi fi
# Redirects # Redirects
+28 -28
View File
@@ -1,15 +1,15 @@
# Detect logo capability # Detect logo capability
if [[ -z "$uy_fetch_logo_type" ]]; then if [[ -z "$uy_fetch_logo_type" ]]; then
if (( $+commands[kgp-query] )) && kgp-query 2>/dev/null; then if (( $+commands[kgp-query] )) && kgp-query 2>/dev/null; then
uy_fetch_logo_type=kitty uy_fetch_logo_type=kitty
elif (( $+commands[sixel-query] )) && sixel-query 2>/dev/null; then elif (( $+commands[sixel-query] )) && sixel-query 2>/dev/null; then
uy_fetch_logo_type=sixel uy_fetch_logo_type=sixel
elif (( $+commands[kgp-query] )) || (( $+commands[sixel-query] )); then elif (( $+commands[kgp-query] )) || (( $+commands[sixel-query] )); then
uy_fetch_logo_type=logo uy_fetch_logo_type=logo
else else
uy_fetch_logo_type=auto uy_fetch_logo_type=auto
fi fi
fi fi
: ${uy_fetch_color:="38;2;137;180;250"} : ${uy_fetch_color:="38;2;137;180;250"}
@@ -18,37 +18,37 @@ fi
case "$uy_fetch_logo_type" in case "$uy_fetch_logo_type" in
symbols) symbols)
uy_fetch_args=(--logo-type raw --logo-width 42 --logo "$HOME/.config/fastfetch/logo_ros/42x.symbols" --color "$uy_fetch_color") uy_fetch_args=(--logo-type raw --logo-width 42 --logo "$HOME/.config/fastfetch/logo_ros/42x.symbols" --color "$uy_fetch_color")
uy_fetch_args_brief=(--logo-type raw --logo-width 28 --logo "$HOME/.config/fastfetch/logo_ros/28x.symbols" --color "$uy_fetch_color") uy_fetch_args_brief=(--logo-type raw --logo-width 28 --logo "$HOME/.config/fastfetch/logo_ros/28x.symbols" --color "$uy_fetch_color")
;; ;;
logo) logo)
uy_fetch_args=(--logo-type builtin) uy_fetch_args=(--logo-type builtin)
uy_fetch_args_brief=(--logo-type small) uy_fetch_args_brief=(--logo-type small)
;; ;;
sixel) sixel)
uy_fetch_args=(--logo-type raw --logo-width 42 --logo "$HOME/.config/fastfetch/logo_ros/42x.sixel" --color "$uy_fetch_color") uy_fetch_args=(--logo-type raw --logo-width 42 --logo "$HOME/.config/fastfetch/logo_ros/42x.sixel" --color "$uy_fetch_color")
uy_fetch_args_brief=(--logo-type raw --logo-width 28 --logo "$HOME/.config/fastfetch/logo_ros/28x.sixel" --color "$uy_fetch_color") uy_fetch_args_brief=(--logo-type raw --logo-width 28 --logo "$HOME/.config/fastfetch/logo_ros/28x.sixel" --color "$uy_fetch_color")
;; ;;
*) # kitty, auto, etc. *) # kitty, auto, etc.
uy_fetch_args=(--logo-type "$uy_fetch_logo_type" --logo-width 42 --logo "$HOME/.config/fastfetch/logo_ros/ros.png" --color "$uy_fetch_color") uy_fetch_args=(--logo-type "$uy_fetch_logo_type" --logo-width 42 --logo "$HOME/.config/fastfetch/logo_ros/ros.png" --color "$uy_fetch_color")
uy_fetch_args_brief=(--logo-type "$uy_fetch_logo_type" --logo-width 28 --logo "$HOME/.config/fastfetch/logo_ros/ros.png" --color "$uy_fetch_color") uy_fetch_args_brief=(--logo-type "$uy_fetch_logo_type" --logo-width 28 --logo "$HOME/.config/fastfetch/logo_ros/ros.png" --color "$uy_fetch_color")
;; ;;
esac esac
# Functions # Functions
if (( $+commands[fastfetch] )); then if (( $+commands[fastfetch] )); then
ff() { fastfetch -c "$HOME/.config/fastfetch/config.jsonc" "${uy_fetch_args[@]}" "$@"; } ff() { fastfetch -c "$HOME/.config/fastfetch/config.jsonc" "${uy_fetch_args[@]}" "$@"; }
if [[ -f "$HOME/.config/fastfetch/brief.jsonc" ]]; then if [[ -f "$HOME/.config/fastfetch/brief.jsonc" ]]; then
ffb() { fastfetch -c "$HOME/.config/fastfetch/brief.jsonc" "${uy_fetch_args_brief[@]}" "$@"; } ffb() { fastfetch -c "$HOME/.config/fastfetch/brief.jsonc" "${uy_fetch_args_brief[@]}" "$@"; }
else else
ffb() { ff "$@"; } ffb() { ff "$@"; }
fi fi
fi fi
# Auto-fetch on startup # Auto-fetch on startup
if [[ -z "$uy_no_fetch" ]] && (( $+functions[ffb] )); then if [[ -z "$uy_no_fetch" ]] && (( $+functions[ffb] )); then
ffb ffb
fi fi