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:
80
zsh/alias
80
zsh/alias
@ -1,5 +1,7 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
### basic alias #####################################################
|
||||
#####################################################################
|
||||
|
||||
alias pd='pushd'
|
||||
alias qd='popd'
|
||||
@ -8,10 +10,23 @@ alias lsd='dirs'
|
||||
alias pdo='pwd | xclip' # [p]aste [d]irectory [o]n clipboard
|
||||
alias cdo='cd $(xclip -o)' # [c]hange to [d]irectory [o]n clipboard
|
||||
|
||||
alias restart='clear; source ~/.zshrc'
|
||||
#####################################################################
|
||||
### default command override ########################################
|
||||
#####################################################################
|
||||
|
||||
alias fix='vim $(git diff --name-only | uniq) -p'
|
||||
alias ls='ls --color=auto --group-directories-first'
|
||||
|
||||
command -v bat >/dev/null 2>&1 \
|
||||
&& alias cat='bat --style="plain"'
|
||||
|
||||
command -v startplasma-x11 >/dev/null 2>&1 \
|
||||
&& alias startk="startx '$DOTWRYN/config/xinitrc.kde'"
|
||||
|
||||
command -v i3 >/dev/null 2>&1 \
|
||||
&& alias starti="startx '$DOTWRYN/config/xinitrc.i3'"
|
||||
|
||||
#####################################################################
|
||||
### fancy alias (not technically an "alias" but makes sense here) ###
|
||||
#####################################################################
|
||||
|
||||
w() { # fancy(?) version of "alias w='watch -tcn1 '"
|
||||
@ -37,20 +52,57 @@ w() { # fancy(?) version of "alias w='watch -tcn1 '"
|
||||
watch ${WATCH_ARGS[@]} "zsh -c 'source ~/.zshrc >/dev/null 2>&1; $(while read e; do printf 'export '; printf '%q ' "$e"; echo; done < <(env) | grep '='); echo \" $@\n---------------------------------------------------- \$(date +%H:%m:%S)\"; $@'"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
erg() { # [e]dit files with [r]ip[g]rep matches
|
||||
$EDITOR $(rg --color=never --files-with-matches $@)
|
||||
}
|
||||
|
||||
command -v bat >/dev/null 2>&1 \
|
||||
&& alias cat='bat --style="plain"'
|
||||
fix() { # [fix] merge conflicts
|
||||
local PREFIX="$(git rev-parse --show-toplevel)"
|
||||
[ $PREFIX ] || return 128
|
||||
|
||||
command -v startplasma-x11 >/dev/null 2>&1 \
|
||||
&& alias startk="startx '$DOTWRYN/config/xinitrc.kde'"
|
||||
local FILE FILES=()
|
||||
for FILE in $(git diff --name-only 2>/dev/null | sort -u)
|
||||
do
|
||||
echo "diff detected in $(basename -- $(dirname -- "$FILE"))/$(basename -- "$FILE")" >&2
|
||||
FILES+=("$PREFIX/$FILE")
|
||||
done
|
||||
|
||||
command -v i3 >/dev/null 2>&1 \
|
||||
&& alias starti="startx '$DOTWRYN/config/xinitrc.i3'"
|
||||
|
||||
#####################################################################
|
||||
|
||||
alias erg='EDIT_RIPGREP_FILE_MATCHES'
|
||||
EDIT_RIPGREP_FILE_MATCHES() { $EDITOR $(rg --color=never -l $@); }
|
||||
[[ ${#FILES[@]} -eq 0 ]] && {
|
||||
echo "no merge conflicts detected"
|
||||
return 0
|
||||
}
|
||||
|
||||
$EDITOR ${FILES[@]}
|
||||
}
|
||||
|
||||
restart() { # reload zshrc with some bonus options
|
||||
local _S EXECUTION_MODE=quiet
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
_S=1
|
||||
case $1 in
|
||||
( -h | --help ) which restart; return 0 ;;
|
||||
( -v | --verbose ) EXECUTION_MODE=verbose ;;
|
||||
( -l | --login ) EXECUTION_MODE=login ;;
|
||||
esac
|
||||
shift $_S
|
||||
done
|
||||
|
||||
case $EXECUTION_MODE in
|
||||
login )
|
||||
echo "--- fresh start c: ---" >&2
|
||||
zsh -l
|
||||
echo "--- fresh end :c ---" >&2
|
||||
;;
|
||||
verbose )
|
||||
source "$HOME/.zshrc"
|
||||
;;
|
||||
quiet )
|
||||
clear
|
||||
source "$HOME/.zshrc" 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
return 0
|
||||
|
@ -1,9 +0,0 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
alias ls='ls --color=auto --group-directories-first'
|
||||
|
||||
[ -f "$HOME/.config/wryn/tty-colorscheme" ] \
|
||||
&& source "$HOME/.config/wryn/tty-colorscheme"
|
||||
|
||||
#####################################################################
|
54
zsh/rc
54
zsh/rc
@ -1,51 +1,9 @@
|
||||
#!/bin/zsh
|
||||
source "$HOME/.config/wryn/env.zsh"
|
||||
#####################################################################
|
||||
INTERNAL_PLUGINS=(
|
||||
"$DOTWRYN/zsh/config" # must load first
|
||||
$(find "$DOTWRYN/zsh" -mindepth 1 -maxdepth 1 -type f \
|
||||
| grep -v '/rc$' \
|
||||
| grep -v '/config$' \
|
||||
| grep -v '/\.[^/]\+$' \
|
||||
)
|
||||
)
|
||||
|
||||
SET_PREFERRED_EDITOR() {
|
||||
# load preference from environment
|
||||
[[ ${#PREFERRED_EDITOR[@]} -eq 0 ]] && {
|
||||
echo 'unable to find $PREFERRED_EDITOR environment variable'
|
||||
for RC_FILE in $(find "${0:a:h}/rc.d/" -type f | sort)
|
||||
do
|
||||
source "$RC_FILE" || {
|
||||
echo "something went wrong in '$RC_FILE'; aborting dotwryn load"
|
||||
return 1
|
||||
}
|
||||
|
||||
[[ $EDITOR == "${PREFERRED_EDITOR[-1]}" ]] \
|
||||
&& [[ $VISUAL == "${PREFERENCE[-1]}" ]] \
|
||||
&& return 0
|
||||
|
||||
local AVAILABLE_EDITOR=$EDITOR
|
||||
|
||||
for program in $PREFERRED_EDITOR
|
||||
do
|
||||
which $program >/dev/null 2>&1 \
|
||||
&& AVAILABLE_EDITOR="$program" \
|
||||
&& break
|
||||
done
|
||||
|
||||
export EDITOR="$AVAILABLE_EDITOR"
|
||||
export VISUAL="$AVAILABLE_EDITOR"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
for p in $INTERNAL_PLUGINS; do source $p; done
|
||||
for p in $EXTERNAL_PLUGINS; do [ -f $p ] && source $p; done
|
||||
SET_PREFERRED_EDITOR
|
||||
WELCOME
|
||||
|
||||
echo $PATH | grep -q "^\\(.*:\\|\\)$HOME/.local/bin\\(:.*\\|\\)$" \
|
||||
|| export PATH="$HOME/.local/bin:$PATH"
|
||||
#####################################################################
|
||||
|
||||
[[ $TERM =~ alacritty ]] \
|
||||
&& [[ $(tmux -L omni.socket list-clients | wc -l) -eq 0 ]] \
|
||||
&& scwrypts tmux omni
|
||||
|
||||
true
|
||||
done
|
||||
return 0
|
||||
|
5
zsh/rc.d/00.config.zsh
Normal file
5
zsh/rc.d/00.config.zsh
Normal file
@ -0,0 +1,5 @@
|
||||
: \
|
||||
&& source "$HOME/.config/wryn/env.zsh" \
|
||||
&& [ "$DOTWRYN" ] \
|
||||
&& [ -d "$DOTWRYN" ] \
|
||||
;
|
@ -1,32 +1,29 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
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
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
#####################################################################
|
||||
|
||||
which kitty >/dev/null && kitty + complete setup zsh | source /dev/stdin
|
||||
return 0
|
19
zsh/rc.d/09.config-misc.zsh
Normal file
19
zsh/rc.d/09.config-misc.zsh
Normal 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
11
zsh/rc.d/10.plugins.zsh
Normal 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
|
17
zsh/rc.d/11.plugins-fzf.zsh
Normal file
17
zsh/rc.d/11.plugins-fzf.zsh
Normal 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
|
24
zsh/rc.d/15.plugins-scwrypts.zsh
Normal file
24
zsh/rc.d/15.plugins-scwrypts.zsh
Normal 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
|
3
zsh/rc.d/19.plugins-local.zsh
Normal file
3
zsh/rc.d/19.plugins-local.zsh
Normal file
@ -0,0 +1,3 @@
|
||||
ZSH_PLUGINS+=($(
|
||||
find "$HOME/.local/zsh" -type f 2>/dev/null
|
||||
))
|
19
zsh/rc.d/20.setup-path.zsh
Normal file
19
zsh/rc.d/20.setup-path.zsh
Normal 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
|
||||
}
|
16
zsh/rc.d/25.setup-editor.zsh
Normal file
16
zsh/rc.d/25.setup-editor.zsh
Normal 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
|
||||
}
|
13
zsh/rc.d/26.setup-unipicker.zsh
Normal file
13
zsh/rc.d/26.setup-unipicker.zsh
Normal 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
|
10
zsh/rc.d/40.import-plugins.zsh
Normal file
10
zsh/rc.d/40.import-plugins.zsh
Normal file
@ -0,0 +1,10 @@
|
||||
() {
|
||||
local PLUGIN
|
||||
|
||||
for PLUGIN in ${ZSH_PLUGINS[@]}
|
||||
do
|
||||
[ -f "$PLUGIN" ] && source "$PLUGIN"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
command -v op >/dev/null 2>&1 && {
|
||||
@ -12,4 +11,4 @@ command -v flux >/dev/null 2>&1 && {
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
true
|
||||
return 0
|
@ -1,4 +1,4 @@
|
||||
#!/bin/zsh
|
||||
#####################################################################
|
||||
|
||||
PS1__GET_DIRECTORY() {
|
||||
local _DIRECTORY="%B%F{yellow}%6~"
|
||||
@ -26,7 +26,7 @@ PS1__GET_GIT_BRANCH() {
|
||||
echo $_GIT_BRANCH
|
||||
}
|
||||
|
||||
GENERATE_PS1() {
|
||||
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"
|
||||
@ -39,4 +39,7 @@ GENERATE_PS1() {
|
||||
}
|
||||
|
||||
setopt PROMPT_SUBST
|
||||
export PS1="$(GENERATE_PS1)"
|
||||
export PS1="$(PS1__GENERATE)"
|
||||
|
||||
#####################################################################
|
||||
return 0
|
12
zsh/rc.d/99.welcome.zsh
Normal file
12
zsh/rc.d/99.welcome.zsh
Normal 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
|
@ -1,10 +0,0 @@
|
||||
#!/bin/zsh
|
||||
command -v unipicker >/dev/null 2>&1 || return 0
|
||||
|
||||
__ZSH_SHORTCUT__UNIPICKER() {
|
||||
LBUFFER+="$(unipicker)"
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N unipicker __ZSH_SHORTCUT__UNIPICKER
|
||||
bindkey unipicker
|
Reference in New Issue
Block a user