BIG REFACTOR; PLEASE BE ADVISED

finally going to commit that zshrc refactor

- smolvsdefault on altaria
- i3-utils refactor
- no need for custom scwrypt executable anymore
- time to say goodbye to the old dotwryn.env in favor of the new and improved rc.ds
- vim/rc.d refactor + QuickREPL and QuickCommand replacements for \r and \t
- going to stop tracking Archives explicitly until new hard drive
- tty-colorscheme is now referenced directly
- colorscheme/spring-sunset needed to swap primary/secondary colors for focus in i3 since it was confusing
- setup config no longer needs to create ~/.config/wryn/env.vim; added some dependencies to arch-linux
- switch from dmenu to rofi by default; allow .i3 overrides in colorschemes; tty-colorscheme is now referenced directly
This commit is contained in:
2024-05-07 16:38:40 -06:00
parent 466d4ec77d
commit ad66d50b11
64 changed files with 727 additions and 437 deletions

5
zsh/rc.d/00.config.zsh Normal file
View File

@ -0,0 +1,5 @@
: \
&& source "$HOME/.config/wryn/env.zsh" \
&& [ "$DOTWRYN" ] \
&& [ -d "$DOTWRYN" ] \
;

View File

@ -0,0 +1,29 @@
#####################################################################
HISTFILE=~/.local/zsh.history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory autocd beep notify HIST_IGNORE_SPACE
unsetopt nomatch
bindkey -v
bindkey '^R' history-incremental-search-backward
# ESC,v to use $EDITOR to modify the current command
autoload edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# zsh auto/tab-completion engine
zmodload -i zsh/complist
autoload -Uz compinit
compinit
zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' max-errors 1
zstyle ':completion:*' menu select
bindkey -M menuselect '^M' .accept-line
#####################################################################
return 0

View File

@ -0,0 +1,19 @@
#####################################################################
# I hate the default "$HOME/go" go path; hide it away
[ $GOPATH ] \
|| export GOPATH="$HOME/.local/go"
# not sure if this is needed anymore since I've moved to alacritty,
# but leaving this here since it was obnoxious to find
which kitty &>/dev/null \
&& kitty + complete setup zsh | source /dev/stdin
# many tmux workflows like to interact with the X-server; however,
# the tmux sessions frequently start before the X-session
[[ $TERM =~ tmux ]] && [ ! $DISPLAY ] && export DISPLAY=:0
#RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config"
#####################################################################
return 0

11
zsh/rc.d/10.plugins.zsh Normal file
View File

@ -0,0 +1,11 @@
#####################################################################
ZSH_PLUGINS+=(
"$DOTWRYN/colorschemes/active/getty.sh"
"$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh"
"$DOTWRYN/zsh/plugins/z/z.sh"
"$DOTWRYN/zsh/alias"
)
#####################################################################
return 0

View File

@ -0,0 +1,17 @@
#####################################################################
ZSH_PLUGINS+=(
'/usr/share/fzf/key-bindings.zsh'
'/usr/share/fzf/completion.zsh'
"$DOTWRYN/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh"
)
export FZF_DEFAULT_OPTS='--reverse --ansi --height 50% --bind=ctrl-c:cancel'
export FZF_DEFAULT_COMMAND='rg --files'
zstyle ':fzf-tab:*' accept-line enter
zstyle ':fzf-tab:*' fzf-bindings 'space:accept' ';:toggle'
zstyle ':fzf-tab:*' continuous-trigger '/'
#####################################################################
return 0

View File

@ -0,0 +1,24 @@
#####################################################################
ZSH_PLUGINS+=(
"$(scwrypts --root 2>/dev/null)/scwrypts.plugin.zsh"
)
() { # default environment name lookup
local ENVIRONMENT_NAME HOSTNAME="$(hostnamectl --static)"
for ENVIRONMENT_NAME in \
"local.${HOSTNAME}.secret" \
"local.${HOSTNAME}" \
"local" \
"dev" \
;
do
[ -f "$HOME/.config/scwrypts/environments/scwrypts/$ENVIRONMENT_NAME" ] \
&& export SCWRYPTS_ENV="$ENVIRONMENT_NAME" \
&& break
done
}
#####################################################################
return 0

View File

@ -0,0 +1,3 @@
ZSH_PLUGINS+=($(
find "$HOME/.local/zsh" -type f 2>/dev/null
))

View File

@ -0,0 +1,19 @@
() { # create path entries
local PATH_ENTRY
for PATH_ENTRY in \
"$HOME/.local/bin" \
"$(go env GOPATH 2>/dev/null)/bin" \
"$HOME/.$(hostnamectl --static)" \
;
do
echo "$PATH" | sed 's/:/\n/g' | grep -q "^$PATH_ENTRY$" \
&& continue # avoid duplicate PATH entries
mkdir -p "$PATH_ENTRY" 2>/dev/null \
|| continue # avoid invalid PATH entries
export PATH="$PATH_ENTRY:$PATH"
done
return 0
}

View File

@ -0,0 +1,16 @@
() { # set EDITOR/VISUAL variables
[[ ${#PREFERRED_EDITORS[@]} -eq 0 ]] && {
echo 'unable to find $PREFERRED_EDITORS environment variable'
return 1
}
local PROGRAM PROGRAM_EXECUTABLE
for PROGRAM in ${PREFERRED_EDITORS[@]}
do
PROGRAM_EXECUTABLE="$(which $PROGRAM 2>/dev/null)"
[ -f "$PROGRAM_EXECUTABLE" ] \
&& export EDITOR="$PROGRAM_EXECUTABLE" \
&& export VISUAL="$PROGRAM_EXECUTABLE" \
&& break
done
}

View File

@ -0,0 +1,13 @@
command -v unipicker &>/dev/null || return 0
#####################################################################
__ZSH_SHORTCUT__UNIPICKER() {
LBUFFER+="$(unipicker)"
zle reset-prompt
}
zle -N unipicker __ZSH_SHORTCUT__UNIPICKER
bindkey  unipicker
#####################################################################
return 0

View File

@ -0,0 +1,10 @@
() {
local PLUGIN
for PLUGIN in ${ZSH_PLUGINS[@]}
do
[ -f "$PLUGIN" ] && source "$PLUGIN"
done
return 0
}

View File

@ -0,0 +1,14 @@
#####################################################################
command -v op >/dev/null 2>&1 && {
eval "$(op completion zsh)"
compdef _op op
export OP_FORMAT=json
}
command -v flux >/dev/null 2>&1 && {
. <(flux completion zsh)
}
#####################################################################
return 0

45
zsh/rc.d/91.ps1.zsh Normal file
View File

@ -0,0 +1,45 @@
#####################################################################
PS1__GET_DIRECTORY() {
local _DIRECTORY="%B%F{yellow}%6~"
local GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
[ $GIT_ROOT ] && {
local PROJECT_NAME=$(basename $GIT_ROOT)
[[ $PROJECT_NAME =~ ^code$ ]] && PROJECT_NAME=$(basename $(dirname $GIT_ROOT))
local RESOLVED_WD=$(readlink -f "$(pwd)")
local RELATIVE_DIRECTORY=${${RESOLVED_WD#$GIT_ROOT}:1}
[[ ${#${RELATIVE_DIRECTORY//[^\/]}} -gt 3 ]] && RELATIVE_DIRECTORY='*/%4~'
_DIRECTORY="%B%F{green}$PROJECT_NAME%B%F{yellow}:$RELATIVE_DIRECTORY"
}
echo $_DIRECTORY
}
PS1__GET_GIT_BRANCH() {
local _GIT_BRANCH=$(\
git branch --no-color 2>/dev/null \
| sed "/^[^*]/d; s/* \(.*\)/ %B%F{cyan}$PS1_BRANCH_SYMBOL \1/" \
)
echo $_GIT_BRANCH
}
PS1__GENERATE() {
local _INDICATOR="%B%(?.%F{green}.%F{red}) $PS1_INDICATOR_SYMBOL"
local _USER="%B%F{magenta}$PS1_USER"
local _SEPARATOR="%b%F{red}$PS1_SEPARATOR"
local _DIRECTORY='$(PS1__GET_DIRECTORY)'
local _GIT_BRANCH='$(PS1__GET_GIT_BRANCH)'
local _PROMPT=$'\n'' %B%F{blue}%# %b%f'
echo "$_INDICATOR $_USER $_SEPARATOR $_DIRECTORY $_GIT_BRANCH $_PROMPT"
}
setopt PROMPT_SUBST
export PS1="$(PS1__GENERATE)"
#####################################################################
return 0

12
zsh/rc.d/99.welcome.zsh Normal file
View File

@ -0,0 +1,12 @@
case $TERM in
*kitty* | *alacritty* )
# when using desktop terminal emulators, automatically launch tmux/omni
# if no active omni client can be found
: \
&& [[ $(tmux -L omni.socket list-clients 2>/dev/null | wc -l) -eq 0 ]] \
&& scwrypts tmux omni \
|| WELCOME \
;
;;
* ) WELCOME ;;
esac