reformat code, stylistic changes

This commit is contained in:
2026-02-28 14:45:41 +01:00
parent 25ee2cb422
commit db97601519
20 changed files with 232 additions and 234 deletions

View File

@@ -2,5 +2,5 @@ root = true
[{*.sh,*.bash,*.zsh,.bashrc,.zshrc,install}] [{*.sh,*.bash,*.zsh,.bashrc,.zshrc,install}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 4
max_line_length = 80 max_line_length = 80

View File

@@ -16,11 +16,11 @@ export HSTR_CONFIG="hicolor" # get more colors
shopt -s histappend # append new history items to .bash_history shopt -s histappend # append new history items to .bash_history
export HISTCONTROL="ignorespace" # leading space hides commands from history export HISTCONTROL="ignorespace" # leading space hides commands from history
export HISTFILESIZE="10000" # increase history file size (default is 500) export HISTFILESIZE="10000" # increase history file size (default is 500)
export HISTSIZE="${HISTFILESIZE}" # increase history size (default is 500) export HISTSIZE="$HISTFILESIZE" # increase history size (default is 500)
# ensure synchronization between bash memory and history file # ensure synchronization between bash memory and history file
export PROMPT_COMMAND=("history -a; history -n;" "${PROMPT_COMMAND[@]}") export PROMPT_COMMAND=("history -a; history -n;" "${PROMPT_COMMAND[@]}")
function hstrnotiocsti { function hstrnotiocsti {
{ READLINE_LINE="$({ </dev/tty hstr -- "${READLINE_LINE}"; } \ { READLINE_LINE="$({ </dev/tty hstr -- "$READLINE_LINE"; } \
2>&1 1>&3 3>&-)"; } 3>&1 2>&1 1>&3 3>&-)"; } 3>&1
READLINE_POINT="${#READLINE_LINE}" READLINE_POINT="${#READLINE_LINE}"
} }
@@ -33,13 +33,13 @@ export HSTR_TIOCSTI="n"
# ranger # ranger
ranger_cd() { ranger_cd() {
temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")" temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
ranger --choosedir="${temp_file}" -- "${@:-${PWD}}" ranger --choosedir="$temp_file" -- "${@:-$PWD}"
if chosen_dir="$(cat -- "${temp_file}")" && if chosen_dir="$(cat -- "$temp_file")" &&
[[ -n "${chosen_dir}" ]] && [[ -n "$chosen_dir" ]] &&
[[ "${chosen_dir}" != "${PWD}" ]]; then [[ "$chosen_dir" != "$PWD" ]]; then
cd -- "${chosen_dir}" || exit 1 cd -- "$chosen_dir" || exit 1
fi fi
rm -f -- "${temp_file}" rm -f -- "$temp_file"
} }
alias ranger="ranger_cd" alias ranger="ranger_cd"
@@ -52,7 +52,7 @@ alias ranger="ranger_cd"
# inside tmux, we don't know if Sway got restarted # inside tmux, we don't know if Sway got restarted
if [[ -v TMUX ]]; then if [[ -v TMUX ]]; then
swaymsg() { swaymsg() {
SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock" SWAYSOCK="$XDG_RUNTIME_DIR/sway-ipc.$UID.$(pgrep -x sway).sock"
export SWAYSOCK export SWAYSOCK
command swaymsg "$@" command swaymsg "$@"
} }

View File

@@ -1,13 +1,13 @@
take() { take() {
local -r directory="$1" local -r directory="$1"
mkdir -p "${directory}" mkdir -p "$directory"
cd "${directory}" || exit 1 cd "$directory" || exit 1
} }
# downloading from youtube # downloading from youtube
yt-dlp() { yt-dlp() {
local -a -r args=( local -a -r args=(
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser" --cookies-from-browser "chromium:$HOME/.local/share/qutebrowser"
--extractor-args "youtube:player_client=default,web_safari;player_js_version=actual" --extractor-args "youtube:player_client=default,web_safari;player_js_version=actual"
--fragment-retries infinite --fragment-retries infinite
) )

View File

@@ -3,13 +3,11 @@
# #
# load bash configuration # load bash configuration
CONF_DIR="${HOME}/.bash/conf.d" readonly conf_dir="${HOME}/.bash/conf.d"
readonly CONF_DIR
if [[ -d "${CONF_DIR}" ]]; then if [[ -d "${conf_dir}" ]]; then
for conf_file in "${CONF_DIR}"/*.bash; do for conf_file in "${conf_dir}"/*.bash; do
[[ -r "${conf_file}" ]] || continue
# shellcheck source=/dev/null # shellcheck source=/dev/null
source "${conf_file}" [[ -r "$conf_file" ]] && . "${conf_file}"
done done
fi fi

View File

@@ -2,5 +2,5 @@ root = true
[*] [*]
indent_style = space indent_style = space
indent_size = 2 indent_size = 4
max_line_length = 80 max_line_length = 80

View File

@@ -1,7 +1,7 @@
# Set PATH environment variable # Set PATH environment variable
typeset -U path PATH typeset -U path PATH
path=( path=(
"${HOME}/.local/bin" "$HOME/.local/bin"
"/usr/local/sbin" "/usr/local/sbin"
"/usr/local/bin" "/usr/local/bin"
"/usr/sbin" "/usr/sbin"
@@ -11,8 +11,8 @@ path=(
export PATH export PATH
# Configure shell history behavior # Configure shell history behavior
HISTFILE="${HOME}/.zsh_history" HISTFILE="$HOME/.zsh_history"
HISTSIZE="10000" HISTSIZE=10000
SAVEHIST="10000" SAVEHIST=10000
setopt appendhistory setopt appendhistory
setopt HIST_IGNORE_SPACE setopt HIST_IGNORE_SPACE

View File

@@ -13,14 +13,14 @@ bindkey '^U' backward-kill-line
# Change cursor shape for different vi modes # Change cursor shape for different vi modes
zle-keymap-select() { zle-keymap-select() {
if [[ "${KEYMAP}" == "vicmd" ]] || if [[ $KEYMAP == "vicmd" ]] ||
[[ "$1" == "block" ]]; then [[ $1 == "block" ]]; then
echo -ne '\e[2 q' echo -ne '\e[2 q'
psvar[1]="(cmd) " psvar[1]="(cmd) "
elif [[ "${KEYMAP}" == "main" ]] || elif [[ $KEYMAP == "main" ]] ||
[[ "${KEYMAP}" == "viins" ]] || [[ $KEYMAP == "viins" ]] ||
[[ -z "${KEYMAP}" ]] || [[ -z "$KEYMAP" ]] ||
[[ "$1" == "beam" ]]; then [[ $1 == "beam" ]]; then
echo -ne '\e[6 q' echo -ne '\e[6 q'
psvar[1]="(ins) " psvar[1]="(ins) "
fi fi

View File

@@ -1,19 +1,19 @@
if [[ -z "${TMUX}" ]]; then if [[ -z "$TMUX" ]]; then
export REAL_TERM="${TERM}" export REAL_TERM="${TERM}"
fi fi
if [[ "${REAL_TERM}" != "linux" ]]; then if [[ $REAL_TERM != "linux" ]]; then
# To customize prompt, run `p10k configure` or edit ~/.zsh/prompt/p10k.zsh. # To customize prompt, run `p10k configure` or edit ~/.zsh/prompt/p10k.zsh.
. "${HOME}/.zsh/plugins/powerlevel10k/powerlevel10k.zsh-theme" . "$HOME/.zsh/plugins/powerlevel10k/powerlevel10k.zsh-theme"
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n] # Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below. # 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 if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
. "${XDG_CACHE_HOME:-${HOME}/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" . "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi fi
[[ -f "${HOME}/.zsh/prompt/p10k.zsh" ]] && . "${HOME}/.zsh/prompt/p10k.zsh" [[ -f "$HOME/.zsh/prompt/p10k.zsh" ]] && . "$HOME/.zsh/prompt/p10k.zsh"
else else
. "${HOME}/.zsh/prompt/fallback.zsh" . "$HOME/.zsh/prompt/fallback.zsh"
fi fi

View File

@@ -1,10 +1,10 @@
## Plugins configuration ## Plugins configuration
# Automatic suggestions # Automatic suggestions
. "${HOME}/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" . "$HOME/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
# Completions # Completions
fpath=("${HOME}/.zsh/plugins/zsh-completions/src" "${fpath[@]}") fpath=("$HOME/.zsh/plugins/zsh-completions/src" "${fpath[@]}")
autoload -U compinit promptinit autoload -U compinit promptinit
compinit compinit
promptinit promptinit
@@ -14,4 +14,4 @@ promptinit
zstyle ":completion::complete:*" use-cache 1 zstyle ":completion::complete:*" use-cache 1
# Syntax highlighting in zsh prompt # Syntax highlighting in zsh prompt
. "${HOME}/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" . "$HOME/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"

View File

@@ -1,3 +1,2 @@
# emacs specific stuff # emacs specific stuff
[[ -n "${EAT_SHELL_INTEGRATION_DIR}" ]] && [[ -n "$EAT_SHELL_INTEGRATION_DIR" ]] && . "$EAT_SHELL_INTEGRATION_DIR/zsh"
. "${EAT_SHELL_INTEGRATION_DIR}/zsh"

View File

@@ -5,17 +5,17 @@ else
export EDITOR="vim" export EDITOR="vim"
fi fi
# export EDITOR="ec" # export EDITOR="ec"
export VISUAL="${EDITOR}" export VISUAL="$EDITOR"
export SUDO_EDITOR="${EDITOR}" export SUDO_EDITOR="$EDITOR"
export VIRSH_DEFAULT_CONNECT_URI="qemu:///system" export VIRSH_DEFAULT_CONNECT_URI="qemu:///system"
export BROWSER="chromium" export BROWSER="chromium"
export PAGER="less -R -F" export PAGER="less -R -F"
export BAT_PAGER="${PAGER}" export BAT_PAGER="$PAGER"
export MANPAGER="less -R --use-color -Dd+r -Du+b" export MANPAGER="less -R --use-color -Dd+r -Du+b"
[ -f "/usr/share/cowsay/cows" ] && export COWPATH="/usr/share/cowsay/cows" [ -f "/usr/share/cowsay/cows" ] && export COWPATH="/usr/share/cowsay/cows"
export CHROOT="${HOME}/arch_chroot" export CHROOT="$HOME/arch_chroot"
export AUR_REPO="whiteman808" export AUR_REPO="whiteman808"
export AURDEST="${HOME}/.cache/paru/clone" export AURDEST="$HOME/.cache/paru/clone"
export AUR_PAGER="ranger" export AUR_PAGER="ranger"
export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB" export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB"

View File

@@ -8,13 +8,13 @@ export LESS='-R --use-color -Dd+r$Du+b$'
zmodload zsh/zpty zmodload zsh/zpty
pty() { pty() {
zpty pty-${UID} ${1+$@} zpty pty-$UID ${1+$@}
if [[ ! -t 1 ]]; then if [[ ! -t 1 ]]; then
setopt local_traps setopt local_traps
trap '' INT trap '' INT
fi fi
zpty -r pty-${UID} zpty -r pty-$UID
zpty -d pty-${UID} zpty -d pty-$UID
} }
ptyless() { ptyless() {

View File

@@ -26,19 +26,19 @@ fi
# bat (debian) # bat (debian)
if command -v batcat >/dev/null 2>&1; then if command -v batcat >/dev/null 2>&1; then
alias bat=batcat alias bat="batcat"
fi fi
# ranger # ranger
ranger_cd() { ranger_cd() {
temp_file=$(mktemp -t "ranger_cd.XXXXXXXXXX") temp_file=$(mktemp -t "ranger_cd.XXXXXXXXXX")
ranger --choosedir="${temp_file}" -- "${@:-${PWD}}" ranger --choosedir="$temp_file" -- "${@:-$PWD}"
if chosen_dir=$(cat -- "${temp_file}") && if chosen_dir=$(cat -- "$temp_file") &&
[ -n "${chosen_dir}" ] && [ -n "$chosen_dir" ] &&
[ "${chosen_dir}" != "${PWD}" ]; then [ $chosen_dir != "$PWD" ]; then
cd -- "${chosen_dir}" cd -- "$chosen_dir"
fi fi
rm -f -- "${temp_file}" rm -f -- "$temp_file"
} }
alias ranger="ranger_cd" alias ranger="ranger_cd"
@@ -47,8 +47,8 @@ alias ranger="ranger_cd"
[[ -f "/usr/lib/mc/mc.sh" ]] && . "/usr/lib/mc/mc.sh" [[ -f "/usr/lib/mc/mc.sh" ]] && . "/usr/lib/mc/mc.sh"
# nix package manager # nix package manager
[[ -e "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]] &&
. "${HOME}/.nix-profile/etc/profile.d/nix.sh" . "$HOME/.nix-profile/etc/profile.d/nix.sh"
# nix shell # nix shell
if command -v nix-your-shell >/dev/null 2>&1; then if command -v nix-your-shell >/dev/null 2>&1; then
@@ -56,19 +56,19 @@ if command -v nix-your-shell >/dev/null 2>&1; then
fi fi
# node.js # node.js
export NVM_DIR="${HOME}/.nvm" export NVM_DIR="$HOME/.nvm"
[[ -s "${NVM_DIR}/nvm.sh" ]] && [[ -s "$NVM_DIR/nvm.sh" ]] &&
. "${NVM_DIR}/nvm.sh" # This loads nvm . "$NVM_DIR/nvm.sh" # This loads nvm
[[ -s "${NVM_DIR}/bash_completion" ]] && [[ -s "$NVM_DIR/bash_completion" ]] &&
. "${NVM_DIR}/bash_completion" # This loads nvm bash_completion . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# rvm # rvm
[[ -s "${HOME}/.rvm/scripts/rvm" ]] && . "${HOME}/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# pyenv # pyenv
export PYENV_ROOT="${HOME}/.pyenv" export PYENV_ROOT="$HOME/.pyenv"
if [[ -d "${PYENV_ROOT}/bin" ]]; then if [[ -d "$PYENV_ROOT/bin" ]]; then
path=("${PYENV_ROOT}/bin" "${path[@]}") path=("$PYENV_ROOT/bin" "${path[@]}")
export PATH export PATH
eval "$(pyenv init - zsh)" eval "$(pyenv init - zsh)"
eval "$(pyenv virtualenv-init -)" eval "$(pyenv virtualenv-init -)"
@@ -77,7 +77,7 @@ fi
# inside tmux, we don't know if Sway got restarted # inside tmux, we don't know if Sway got restarted
if [[ -v TMUX ]]; then if [[ -v TMUX ]]; then
swaymsg() { swaymsg() {
SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock" SWAYSOCK="$XDG_RUNTIME_DIR/sway-ipc.$UID.$(pgrep -x sway).sock"
export SWAYSOCK export SWAYSOCK
command swaymsg "$@" command swaymsg "$@"
} }

View File

@@ -1,15 +1,16 @@
take() { take() {
local -r directory="$1" local -r directory="$1"
mkdir -p "${directory}" mkdir -p "$directory"
cd "${directory}" || exit 1 cd "$directory" || exit 1
} }
# downloading from youtube # downloading from youtube
yt-dlp() { yt-dlp() {
local -a -r args=( local -a -r args=(
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser" --cookies-from-browser "chromium:$HOME/.local/share/qutebrowser"
--extractor-args "youtube:player_client=default,web_safari;player_js_version=actual" --extractor-args "youtube:player_client=default,web_safari;player_js_version=actual"
--fragment-retries infinite --fragment-retries infinite
--remote-components "ejs:github"
) )
command yt-dlp "${args[@]}" "$@" command yt-dlp "${args[@]}" "$@"
} }

View File

@@ -1,4 +1,4 @@
# load zsh configuration # load zsh configuration
for file in "${HOME}/.zsh/conf.d/"*.zsh(N); do for file in "$HOME/.zsh/conf.d/"*.zsh(N); do
source "${file}" . "$file"
done done

View File

@@ -2,5 +2,5 @@ root = true
[*] [*]
indent_style = space indent_style = space
indent_size = 2 indent_size = 4
max_line_length = 80 max_line_length = 80