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
		
			
				
	
	
		
			109 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/zsh
 | |
| #####################################################################
 | |
| ### basic alias #####################################################
 | |
| #####################################################################
 | |
| 
 | |
| alias pd='pushd'
 | |
| alias qd='popd'
 | |
| 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
 | |
| 
 | |
| #####################################################################
 | |
| ### default command override ########################################
 | |
| #####################################################################
 | |
| 
 | |
| 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 '"
 | |
| 	local WATCH_ARGS=()
 | |
| 
 | |
| 	WATCH_ARGS+=(--no-title)
 | |
| 	WATCH_ARGS+=(--color)
 | |
| 	WATCH_ARGS+=(--interval 1)
 | |
| 
 | |
| 	# don't add delay if command is available to /bin/sh
 | |
| 	/bin/sh -c "command -v $1" >/dev/null 2>&1 && {
 | |
| 		watch ${WATCH_ARGS[@]} $@
 | |
| 		return $?
 | |
| 	}
 | |
| 
 | |
| 	# quickly reduce first-order aliases
 | |
| 	alias $1 >/dev/null 2>&1 && {
 | |
| 		watch ${WATCH_ARGS[@]} $(which $1 | sed 's/.*aliased to //') ${@:2}
 | |
| 		return $?
 | |
| 	}
 | |
| 
 | |
| 	# import zshrc and inject current environment
 | |
| 	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 $@)
 | |
| }
 | |
| 
 | |
| fix() {  # [fix] merge conflicts
 | |
| 	local PREFIX="$(git rev-parse --show-toplevel)"
 | |
| 	[ $PREFIX ] || return 128
 | |
| 
 | |
| 	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
 | |
| 
 | |
| 	[[ ${#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
 |