13 Commits b79d70a5ec ... d93c50d816

Autore SHA1 Messaggio Data
  Kyle P Davis d93c50d816 feat: update shell config with more tools and more colors 6 mesi fa
  Kyle P Davis a617abfac3 feat: update my vimrc with coc 6 mesi fa
  Kyle P Davis d88d162d95 fix: remove old CHROME_BIN that should no longer be needed 1 anno fa
  Kyle P Davis d86b76b11b fix: remove global eslint config now that it's being deprecated 1 anno fa
  Kyle P Davis 08ea1a0991 feat: add Alt+Right/Left arrow movements for vim 2 anni fa
  Kyle P Davis 5744d1b7d7 feat: enable comments in zsh prompts 2 anni fa
  Kyle P Davis 8914662f77 feat: add zsh autosuggestions 2 anni fa
  Kyle P Davis 25c2d2ca45 refactor: switch zsh from antigen to zgenom 2 anni fa
  Kyle P Davis d24fc9043e feat: more zsh key bindings for common cases 2 anni fa
  Kyle P Davis e042328247 fix: remove mostly non-functional and obsolete vscode-specific handling 2 anni fa
  Kyle P Davis 1b81e24399 refactor: move bash checkwinsize down into it's behavior section to simplify things 2 anni fa
  Kyle P Davis 26f1346c87 fix: improve shell history size and duration 2 anni fa
  Kyle P Davis 336017d949 refactor(vim): nvm mvim/gvim 2 anni fa
4 ha cambiato i file con 486 aggiunte e 161 eliminazioni
  1. 0 65
      .eslintrc.js
  2. 266 78
      .profile
  3. 220 17
      .vimrc
  4. 0 1
      install.sh

+ 0 - 65
.eslintrc.js

@@ -1,65 +0,0 @@
-module.exports = {
-
-	//TODO: reorder these based on eslint docs
-
-	//"parser": "babel-eslint", // for the <3 of generator comprehensions
-
-	"parserOptions": {
-		"ecmaVersion": 2018,
-		"sourceType": "module",
-		"ecmaFeatures": {
-			"impliedStrict": true,
-			"jsx": true,
-		},
-	},
-
-	"env": {
-		"browser": true,
-		"node": true,
-		"es6": true,
-		"mocha": true,
-	},
-
-	"rules": {
-
-		// Possible Errors
-		"comma-dangle": [2, "always-multiline"],
-		"valid-jsdoc": 2,
-
-		// Best Practices
-		"block-scoped-var": 2,
-		"complexity": [2, 15],
-		"curly": [2, "multi-line"],
-		"default-case": 2,
-		"dot-location": [2, "property"],
-		"guard-for-in": 2,
-		"no-floating-decimal": 2,
-		"wrap-iife": 2, //TODO: use "any" instead?
-
-		// Strict Mode
-		"strict": [2, "global"],
-
-		// Variables
-		// …
-
-		// Node.js
-		// …
-
-		// Stylistic Issues
-		"brace-style": [2, "1tbs"],
-		"camelcase": [2, { "properties": "always" }],
-		"quotes": [2, "double", "avoidEscape"],
-		"require-jsdoc": 2,
-
-		// ECMAScript 6
-		// …
-
-		// Legacy
-		"max-depth": [2, 7],
-		"max-len": [2, 140],
-		"max-params": [2, 11],
-		"max-statements": [2, 42],
-
-	},
-
-};

+ 266 - 78
.profile

@@ -5,6 +5,14 @@
 # Non-interactive shell configuration
 ###############################################################################
 
+# utils used below
+[ "$ZSH_VERSION" ] && get_bin(){ whence -p "$1"; } || get_bin(){ which "$1"; }
+has_bin(){ get_bin "$1" >/dev/null; }
+get_func(){ typeset -f "$1"; }
+has_func(){ get_func "$1" >/dev/null; }
+is_num(){ [[ "$1" =~ ^[0-9]+$ ]]; }
+as_num(){ is_num "$1" && echo "$1"; }
+
 OS=$(uname -s)
 
 # Add user-specific bin dirs to PATH
@@ -19,10 +27,8 @@ fi
 
 # Homebrew
 if [ "$OS" = "Darwin" ]; then
-	export PATH="$PATH:$HOME/homebrew/bin"
-	BREW_BIN=$(command -v brew 2>/dev/null)
-	if [ "$BREW_BIN" ]; then
-		BREW_PREFIX=$(brew --prefix)
+	export PATH="$PATH:$HOME/homebrew/bin" # maybe keep? will this help on family laptops?
+	if [ "${BREW_BIN:=$(get_bin brew)}" ] && [ "${BREW_PREFIX:=$(brew --prefix)}" ]; then
 		export HOMEBREW_CASK_OPTS="--appdir=$HOME/Applications --require-sha"
 		export HOMEBREW_NO_INSECURE_REDIRECT=1
 		# help build tools find all the brew-based bits
@@ -35,12 +41,6 @@ fi
 # Default editor
 export EDITOR="vim"
 
-# Help things find Google Chrome
-if [ "$OS" = "Darwin" ]; then
-	CHROME_BIN="$HOME/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
-	! [ -f "$CHROME_BIN" ]  ||  export CHROME_BIN
-fi
-
 # Configure go lang
 if [ "$OS" = "Darwin" ]; then
 	export GOROOT="$BREW_PREFIX/opt/go/libexec"
@@ -52,7 +52,7 @@ export GOPATH="$HOME/go"
 export PATH="$PATH:$GOPATH/bin"
 
 # Configure less allow colors
-export LESS="-FRX"
+export LESS="-FRXM --use-color" #NOTE: --mouse nearly works but selection breaks which is probably more important
 
 # If not running interactively, don't do anything else
 [ "$PS1" ]  ||  return
@@ -63,23 +63,18 @@ export LESS="-FRX"
 ###############################################################################
 
 # tweak history behavior a bit
-HISTSIZE=60000
+HISTSIZE=100000
 if [ ! "$ZSH_VERSION" ]; then
-	HISTFILESIZE=50000
+	HISTFILESIZE=$HISTSIZE
 	HISTCONTROL="ignoreboth"
 	shopt -s histappend
 	PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
 else
-	SAVEHIST=50000
-	setopt HIST_EXPIRE_DUPS_FIRST
-	# https://www.refining-linux.org/archives/49-ZSH-Gem-15-Shared-history.html
-	setopt INC_APPEND_HISTORY
+	SAVEHIST=$HISTSIZE
 	setopt SHARE_HISTORY
-fi
-
-# check window size after each command
-if [ ! "$ZSH_VERSION" ]; then
-	shopt -s checkwinsize
+	setopt EXTENDED_HISTORY
+	setopt HIST_EXPIRE_DUPS_FIRST
+	setopt HIST_IGNORE_SPACE # ignore if leading space
 fi
 
 # Custom shell aliases
@@ -95,12 +90,12 @@ alias ll="ls -Fla"
 alias l="ls -FC"
 alias d="l"
 alias tree="tree -C -F"
-alias grep="grep --color --exclude-dir={.svn,.git,node_modules}"
+alias grep="grep --color"
 alias man='LESS_TERMCAP_md=$(tput bold && tput setaf 4 || :) LESS_TERMCAP_me=$(tput sgr0 || :) LESS_TERMCAP_mb=$(tput blink || :) LESS_TERMCAP_us=$(tput setaf 2 || :) LESS_TERMCAP_ue=$(tput sgr0 || :) LESS_TERMCAP_so=$(tput smso || :) LESS_TERMCAP_se=$(tput rmso || :) PAGER="${commands[less]:-$PAGER}" man'
 alias vi=vim
 
 # aliases for node
-alias node-print="node -e 'let [,f=\".\",e=\"this\"]=process.argv,ctx; try{ctx=require(f)}catch{ctx=require(path.resolve(f))}; eval(\`(async function(){ with(this) return (\${e}); })\`).call(ctx).then(console.log,e=>{console.error(e);process.exit(1)})'"
+alias node-print="node -e 'let [,f=\".\",e=\"this\"]=process.argv,ctx=require(fs.existsSync(f)?path.resolve(f):f); eval(\`(async function(){ with(this) return (\${e}); })\`).call(ctx).then(console.log,e=>{console.error(e);process.exit(1)})'"
 alias node-print-json="node -e 'let [,f=\".\",e=\"this\"]=process.argv,ctx; try{ctx=require(f)}catch{ctx=require(path.resolve(f))}; eval(\`(async function(){ with(this) return (\${e}); })\`).call(ctx).then(o=>console.log(JSON.stringify(o,null,2)),e=>{console.error(e);process.exit(1)})'"
 alias node-print-table="node -e 'let [,f=\".\",e=\"this\"]=process.argv,ctx; try{ctx=require(f)}catch{ctx=require(path.resolve(f))}; eval(\`(async function(){ with(this) return (\${e}); })\`).call(ctx).then(console.table,e=>{console.error(e);process.exit(1)})'"
 alias node-print-deep="node -e 'let [,f=\".\",e=\"this\"]=process.argv,ctx; try{ctx=require(f)}catch{ctx=require(path.resolve(f))}; eval(\`(async function(){ with(this) return (\${e}); })\`).call(ctx).then(o=>console.log(require(\"util\").inspect(o,{depth:process.env.DEPTH||Infinity})),e=>{console.error(e);process.exit(1)})'"
@@ -108,57 +103,127 @@ alias node-print-repl="node -e 'let [,f=\".\",e=\"this\"]=process.argv,ctx; try{
 alias env-ts-node="TS_NODE_FILES=true NODE_OPTIONS=\"-r ts-node/register \$NODE_OPTIONS\""
 alias ts-node-print="env-ts-node node-print"
 
-# color diffs
-! command -v colordiff >/dev/null  ||  alias diff="colordiff"
+# colorized cat using bat
+if [ "${BAT_BIN:=$(get_bin bat)}" ]; then
+	alias cat="$BAT_BIN -p"
+
+	# Customize theme (note also used by delta)
+	export BAT_THEME="$(defaults read -globalDomain AppleInterfaceStyle &>/dev/null && echo 'Visual Studio Dark+' || echo GitHub)"
+	#TODO: the VSCode theme in bat is not showing markdown italics, code blocks, or fenced code blocks
+	#TODO: enable --italic-text=always via here? or put config in my dotfiles…
+
+	# colorized ripgrep using batgrep
+	if [ "${BATGREP_BIN:=$(get_bin batgrep)}" ] && [ "${RG_BIN:=$(get_bin rg)}" ]; then
+		rg(){
+			if [ $# -ne 1 ] || [ "[$1]" = "[--help]" ]; then
+				"$RG_BIN" "$@";
+			else
+				"$BATGREP_BIN" --search-pattern "$1";
+				#TODO: -- can the pager be automatic instead of always while still keeping search-pattern (or similar)?
+			fi
+		}
+	fi
 
-# color json
-! command -v json >/dev/null  ||  alias json="json -o inspect"
+	#TODO: batman is currently worse/different than my current alias but change the color scheme
 
-# color theme setup for bat (not aliased to cat directly because it's a bit slow)
-command -v bat >/dev/null  ||  export BAT_THEME="$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo 'Visual Studio Dark+' || echo GitHub)"
+	# use bat for help
+	#TODO: I assume this fails if last arg… I should try to fix that first…
+	if [ "$ZSH_VERSION" ]; then
+		alias -g -- -h='-h 2>&1 | bat -p -l=help'
+		alias -g -- --help='--help 2>&1 | bat -p -l=help'
+	fi
 
-# MacVim shell aliases
-if [ "$OS" = "Darwin" ]; then
-	alias gvim="mvim"
+	# monkeypatch head to use bat to colorize things
+	if [ "${HEAD_BIN:=$(get_bin head)}" ]; then
+		head(){
+			local N=10
+			case "$1" in
+				-c*|--bytes*)
+					"$HEAD_BIN" "$@"
+					;;
+				*)
+					if [[ "$1" =~ ^-(n|-lines)$ ]] && N=$(as_num "$2"); then
+						shift 2
+					elif [[ "$1" =~ ^-(n=?|-lines=) ]] && N=$(as_num "${1##*[^0-9]}"); then
+						shift 1
+					fi
+					"$BAT_BIN" --line-range=":$N" "$@"
+			esac
+		}
+	fi
+
+	# monkeypatch git to use bat to colorize things
+	if [ "${GIT_BIN:=$(get_bin git)}" ]; then
+		git(){
+			case "$1" in
+				log)
+					# A gross hack for git log until this is fixed: https://github.com/sharkdp/bat/issues/1632
+					# NOTE: forcing `--decorate` since piping disables it; `bat` won't highlight those lines properly but the info is too useful to omit
+					"$GIT_BIN" "$@" --decorate | "$BAT_BIN" -p -l=gitlog
+					;;
+				show)
+					# Use bat to colorize showing files in other branches
+					if [[ "$2" =~ ^.+:.+ ]]; then
+						"$GIT_BIN" "$@" | "$BAT_BIN" -p --file-name "${2##*:}"
+					else
+						"$GIT_BIN" "$@";
+					fi
+					;;
+				*)
+					"$GIT_BIN" "$@";
+					;;
+			esac
+		}
+	fi
 fi
 
-# fancy shell prompts
-if [ "$ZSH_VERSION" ]; then
+if [ "${GH_BIN:=$(get_bin gh)}" ]; then
+	# monkeypatch gh to customize some of the templates
+	gh(){
+		case "$1 $2" in
+			"search prs" | "pr list")
+				"$GH_BIN" "$@" \
+					--json="url,title,author,updatedAt" \
+					--template='
+{{tablerow "URL" "TITLE" "AUTHOR" "UPDATED"}}
+{{range .}}{{tablerow (.url | autocolor "blue") .title .author.login .updatedAt}}{{end}}
+'
+				;;
+			*)
+				"$GH_BIN" "$@";
+				;;
+		esac
+	}
+fi
 
-	if [ "$OS" = "Darwin" ]; then
-		# Enable zsh completions from brew
-		ZSH_SITE_FUNC_DIR="$BREW_PREFIX/share/zsh/site-functions"
-		FPATH="$ZSH_SITE_FUNC_DIR:$FPATH"
-
-		# Auto fetch some community completions
-		for ID in _yarn; do
-			[ -f "$ZSH_SITE_FUNC_DIR/$ID" ] || curl -s -o "$ZSH_SITE_FUNC_DIR/$ID" "https://raw.githubusercontent.com/zsh-users/zsh-completions/master/src/$ID"
-		done
-	fi
+# color theme setup for bat (not aliased to cat directly because it's a bit slow)
+! has_bin bat  ||  export BAT_THEME="$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo 'Visual Studio Dark+' || echo GitHub)"
 
-	ANTIGEN_DIR="$HOME/.antigen"
-	[ -d "$ANTIGEN_DIR" ] || mkdir "$ANTIGEN_DIR"
-	ANTIGEN_BIN="$ANTIGEN_DIR/antigen.zsh"
-	[ -f "$ANTIGEN_BIN" ] || curl -L git.io/antigen > "$ANTIGEN_BIN"
-	source "$ANTIGEN_BIN"
-
-	BUNDLES=(
-		zsh-users/zsh-syntax-highlighting
-		mafredri/zsh-async@main
-		sindresorhus/pure@main
-	)
-	for B in ${=BUNDLES}; do
-		antigen bundle "$B"
-	done
-	antigen apply
+# color diffs
+! has_bin colordiff  ||  alias diff="colordiff"
 
+#TODO: alias doesn't quite work here for delta because it breaks "diff -u" ... luckily -u is the default and I never want the other format so maybe ignore -u and move on?? 🙄
+#! has_bin delta  ||  alias diff="delta" #TODO: make this part of the above …has_bin delta… checks
+
+# color json
+! has_bin json  ||  alias json="json -o inspect"
+
+
+# fancy shell prompts
+if [ "$ZSH_VERSION" ]; then
 	# use emacs-style for most defaults
 	bindkey -e
 
-	# jump more like bash did
+	# jump more like bash did with Alt + Left/Right arrow
 	bindkey "^[f" vi-forward-word
 	bindkey "^[b" vi-backward-word
 
+	# bindings for if you're not using Options as Meta key in Terminal (e.g., VSCode)
+	bindkey "∑" vi-backward-kill-word  # Alt + w
+	bindkey "ƒ" vi-forward-word    # Alt + f
+	bindkey "∫" vi-backward-word   # Alt + b
+	bindkey "≥" insert-last-word   # Alt + .
+
 	# editor
 	autoload -z edit-command-line
 	zle -N edit-command-line
@@ -170,9 +235,144 @@ if [ "$ZSH_VERSION" ]; then
 	# allow trailing slashes on ".."
 	zstyle ':completion:*' special-dirs true
 
+	# enable inline comments since other shells allow it and sometimes they're nice to have
+	setopt interactive_comments
+
 	# ensure proper ls-style colors in completion
 	zstyle ':completion:*' list-colors 'di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
+
+	# setup zgenom and plugins for zsh
+	ZGENOM_DIR="${HOME}/.zgenom"
+	[ -d "$ZGENOM_DIR" ] || git clone https://github.com/jandamm/zgenom.git "$ZGENOM_DIR"
+	source "$ZGENOM_DIR/zgenom.zsh"
+	zgenom autoupdate
+	if ! zgenom saved; then
+		echo "Creating a zgenom save ..."
+		zgenom loadall <<EOF
+			sindresorhus/pure
+			zsh-users/zsh-autosuggestions
+			zsh-users/zsh-syntax-highlighting
+EOF
+		zgenom save
+	fi
+	ZSH_AUTOSUGGEST_IGNORE_WIDGETS+=(backward-kill-word)
+
+	# My Visual Studio Dark+ zsh-syntax-highlighting theme
+	[[ $COLORTERM =~ (24bit|truecolor) ]] || zmodload zsh/nearcolor # use nearest for 256-color terminals
+	typeset -A ZSH_HIGHLIGHT_STYLES
+	export ZSH_HIGHLIGHT_STYLES
+	ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets cursor regexp)
+	# zsh-syntax-highlighting: main
+	ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#F44747'
+	ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=#C586C0' # if, for, then, etc.
+	ZSH_HIGHLIGHT_STYLES[alias]='fg=#DCDCAA'
+	ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=#DCDCAA'
+	ZSH_HIGHLIGHT_STYLES[global-alias]='fg=#DCDCAA'
+	ZSH_HIGHLIGHT_STYLES[builtin]='fg=#DCDCAA'
+	ZSH_HIGHLIGHT_STYLES[function]='fg=#DCDCAA' # foo in foo(){}
+	ZSH_HIGHLIGHT_STYLES[command]='fg=#DCDCAA'  # date in $(date)
+	ZSH_HIGHLIGHT_STYLES[precommand]='fg=#DCDCAA,italic' # builtin, command, exec
+	ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#D4D4D4' # ;, &&, ||
+	ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=#FF0000' # what's this?
+	ZSH_HIGHLIGHT_STYLES[autodirectory]='fg=#6A9955,italic'
+	ZSH_HIGHLIGHT_STYLES[path]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[path_pathseparator]='fg=#FF79C6'
+	ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]='fg=#FF79C6'
+	ZSH_HIGHLIGHT_STYLES[globbing]='fg=#569CD6'
+	ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=#BD93F9'
+	ZSH_HIGHLIGHT_STYLES[command-substitution]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[command-substitution-unquoted]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[command-substitution-quoted]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-unquoted]='fg=#CE9178' # $( … ) -- not the …
+	ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-quoted]='fg=#CE9178' # "$( … )" -- not the …
+	ZSH_HIGHLIGHT_STYLES[process-substitution]='fg=???'
+	ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[arithmetic-expansion]='fg=#CE9178' # $(( … )) -- not the …
+	ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=#9CDCFE' # -h
+	ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=#9CDCFE' # --help
+	ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=#BD93F9'
+	ZSH_HIGHLIGHT_STYLES[back-quoted-argument-unclosed]='fg=#F44747'
+	ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]='fg=#F44747'
+	ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]='fg=#F44747'
+	ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument-unclosed]='fg=#F44747'
+	ZSH_HIGHLIGHT_STYLES[rc-quote]='fg=#CE9178'
+	ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=#9CDCFE'
+	ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=#D7BA7D' # "\\"" -- only the \\"
+	ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=#D4D4D4'
+	ZSH_HIGHLIGHT_STYLES[assign]='fg=#9CDCFE' # X=123 -- the X=
+	ZSH_HIGHLIGHT_STYLES[redirection]='fg=#D4D4D4'
+	ZSH_HIGHLIGHT_STYLES[comment]='fg=#6A9955'
+	ZSH_HIGHLIGHT_STYLES[named-fd]='fg=#D4D4D4'
+	ZSH_HIGHLIGHT_STYLES[numeric-fd]='fg=#D4D4D4'
+	ZSH_HIGHLIGHT_STYLES[arg0]='fg=#DCDCAA'
+	ZSH_HIGHLIGHT_STYLES[default]='fg=#D4D4D4'
+	# zsh-syntax-highlighting: brackets
+	ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=#D7BA7D' # [[[ -- but only the 1st
+	ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=#C586C0' # [[[ -- but only the 2nd
+	ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=#FFB86C' # [[[ -- but only the 3rd
+	# zsh-syntax-highlighting: cursor
+	ZSH_HIGHLIGHT_STYLES[cursor]='standout'
+	# zsh-syntax-highlighting: regexp
+	typeset -A ZSH_HIGHLIGHT_REGEXP
+	 #TODO: bug: highlighting unfound vars with same color… ideally undefined vars would be red or dimmed or something
+	ZSH_HIGHLIGHT_REGEXP+=('[$][0-9]' fg=#9CDCFE) # $… -- non-quoted dollar-argument
+	ZSH_HIGHLIGHT_REGEXP+=('[$][a-zA-Z_][a-zA-Z0-9_]*' fg=#9CDCFE) # $… -- non-quoted dollar-argument
+	# ZSH_HIGHLIGHT_REGEXP+=('[$]{[a-zA-Z_][a-zA-Z0-9_]*[:-=/#}]{1,2}' fg=#9CDCFE) # $… -- brace-wrapped dollar-argument
+	ZSH_HIGHLIGHT_REGEXP+=(' -[^= ]*' fg=#9CDCFE) # -xyz
+	ZSH_HIGHLIGHT_REGEXP+=(' --[^= ]*' fg=#9CDCFE) # --flags=
+	ZSH_HIGHLIGHT_REGEXP+=('[#][ ]?[A-Z]{3,13}:' ${ZSH_HIGHLIGHT_STYLES[comment]},bold) # #TODO: <-- comment leaders
+	ZSH_HIGHLIGHT_REGEXP+=(' [^ ]+://[^ ?&#]*' ${ZSH_HIGHLIGHT_STYLES[assign]},bold) # proto://some/path <-- URL-like strings
+
+	# Enable zsh completions from brew
+	ZSH_SITE_FUNC_DIR="$BREW_PREFIX/share/zsh/site-functions"
+	FPATH="$ZSH_SITE_FUNC_DIR:$FPATH"
+
+	# Auto fetch some community completions
+	RERUN_ZCOMP=
+	for ID in _node _yarn; do
+		F="$ZSH_SITE_FUNC_DIR/$ID"; [ -f "$F" ] || curl -s -o "$ZSH_SITE_FUNC_DIR/$ID" "https://raw.githubusercontent.com/zsh-users/zsh-completions/master/src/$ID"  &&  RERUN_ZCOMP=1
+	done
+
+	# Setup for bun
+	if has_bin bun; then
+		F="$ZSH_SITE_FUNC_DIR/_bun"; [ -f "$F" ] || curl -s -o "$F" "https://raw.githubusercontent.com/oven-sh/bun/refs/heads/main/completions/bun.zsh"
+		source "$F"
+	fi
+
+	# Setup for rustup
+	if [ "${RUSTUP_BIN:=$(get_bin rustup)}" ]; then
+		# Add rustup completions
+		F="$ZSH_SITE_FUNC_DIR/_rustup";  [ -f "$F" ]  &&  ! [ "$RUSTUP_BIN" -nt "$F" ]  ||  rustup completions zsh > "$F"
+		source "$F"
+	fi
+
+	# Setup for cargo
+	F="$HOME/.cargo/env";  ! [ -f "$F" ]  ||  source "$F"
+	if [ "${CARGO_BIN:=$(get_bin cargo)}" ]; then
+		# Add cargo completions
+		F="$ZSH_SITE_FUNC_DIR/_cargo"; [ -f "$F" ]  &&  ! [ "$CARGO_BIN" -nt "$F" ]  ||  rustup completions zsh cargo > "$F"
+		# source "$F" -- TODO: fix this… it's not working on my zsh for some reason
+	fi
+
+	# Setup for dprint
+	if [ "${DPRINT_BIN=$(get_bin dprint)}" ]; then
+		# Add dprint completions
+		F="$ZSH_SITE_FUNC_DIR/_dprint";  [ -f "$F" ]  &&  ! [ "$DPRINT_BIN" -nt "$F" ]  ||  dprint completions zsh > "$F"
+		source "$F"
+	fi
+
+	# recompile completions
+	[ -z "$RERUN_ZCOMP" ] || compinit
 else
+	# check window size after each command
+	shopt -s checkwinsize
+
 	# tab completion FTW
 	if [ "$OS" = "Darwin" ]; then
 		F="$BREW_PREFIX/etc/bash_completion";  ! [ -f "$F" ]  ||  source "$F"
@@ -180,28 +380,16 @@ else
 	else
 		F="/etc/bash_completion";  ! [ -f "$F" ]  ||  source "$F"
 	fi
+
 	F="$HOME/.liquidprompt/liquidprompt";  ! [ -f "$F" ]  ||  source "$F"
 fi
 
 # gimme gimme
 [ -d "$HOME/.gimme" ]  ||  curl -fsSL "https://github.com/KylePDavis/gimme/raw/master/gimme" | bash -
-#F="$HOME/.gimme/gimme";  ! [ -f "$F" ]  ||  source "$F"
 
-# The VS Code terminal needs a few tweaks
-if [ "$TERM_PROGRAM" = "vscode" ]; then
+# Remove any PATH duplicates for simplicity
+export PATH="$(echo "$PATH" | tr : '\n' | awk '!has[$0]++' | tr '\n' :)"
 
-	# patch to restore some of the option as meta escape key in VS Code on Mac
-	if [ "$ZSH_VERSION" ]; then
-		bindkey "≥" insert-last-word
-	fi
+# gimme completions
+F="$HOME/.gimme/gimme";  ! [ -f "$F" ]  ||  source "$F"
 
-	# detect if in a fully resolved HOME path and cd back to the shorter version
-	if [ "$PWD" != "$HOME" ]; then
-		ABS_HOME="$(cd "$HOME" && pwd -P)"
-		if [ "$ABS_HOME" != "$HOME" ]; then
-			if [[ "$PWD" =~ $ABS_HOME* ]]; then
-				cd "$HOME${PWD##"$ABS_HOME"}" || :
-			fi
-		fi
-	fi
-fi

+ 220 - 17
.vimrc

@@ -8,7 +8,6 @@ set nowrap
 " give me all of teh colors!!
 set t_Co=256
 set bg=dark
-colorscheme elflord
 syntax on
 
 " misc
@@ -38,6 +37,12 @@ imap <S-Tab> <Esc><<i
 set foldmethod=syntax
 set foldlevelstart=99
 
+" map Alt+Right/Left arrow to movements
+nmap <Esc>f <Esc>e
+nmap <Esc>b <Esc>b
+imap <Esc>f <Esc>lei
+imap <Esc>b <Esc>bi
+
 " simplify working with the system clipboard
 vmap <C-c> "+y
 nmap <C-c> V"+y
@@ -49,23 +54,68 @@ imap <C-v> <Esc>"+Pi
 nmap Q <nop>
 
 " force syntax on a few file types
-autocmd BufNewFile,BufReadPost *.json set filetype=json syntax=javascript
-autocmd BufNewFile,BufReadPost *.md set filetype=markdown
-autocmd BufNewFile,BufReadPost *.go set filetype=go
+filetype plugin indent on
+"autocmd BufNewFile,BufReadPost *.ts set filetype=typescript syntax=typescript
+"autocmd BufNewFile,BufReadPost *.tsx set filetype=typescript syntax=typescriptreact
+"autocmd BufNewFile,BufReadPost *.json set filetype=json syntax=javascript
+"autocmd BufNewFile,BufReadPost *.md set filetype=markdown
+"autocmd BufNewFile,BufReadPost *.go set filetype=go
+
+" force syntax for fenced code blocks in markdown
+let g:markdown_fenced_languages = [
+\ 'sh',
+\ 'bash=sh',
+\ 'zsh',
+\ 'help',
+\ 'log=apache',
+\ 'json=javascript',
+\ 'javascript=typescript',
+\ 'js=typescript',
+\ 'jsx=typescriptreact',
+\ 'ts=typescript',
+\ 'tsx=typescriptreact',
+\ 'html',
+\ 'css',
+\ 'mermaid',
+\ 'swift',
+\ 'rust',
+\ 'zig',
+\ 'cpp',
+\ 'c',
+\ 'py=python',
+\ 'go',
+\ 'ruby',
+\ 'clojure',
+\ ]
+
+" formatters
+"TODO: failing on simple JSON files...
+autocmd FileType * set formatprg=bunx\ -q\ prettier\ --stdin-filepath\ % | let $F=&formatprg | set equalprg=$F
+autocmd FileType rust set formatprg=rustfmt | let $F=&formatprg | set equalprg=$F
+
+" auto-format on save
+"autocmd BufWritePre * normal gg=G''
+
+" compilers/build tools
+"autocmd FileType rust compiler cargo | cabbrev cargo make | command Cargo make
 
 " prefer ripgrep if available
 if executable('rg')
 	set grepprg=rg\ --vimgrep\ $*
 	set grepformat^=%f:%l:%c:%m
+	" add a silent Grep and use that instead
+	command! -nargs=+ -complete=file Grep execute 'silent grep! <args>' | redraw! | copen
 endif
 
 " VIM-PLUG PLUGINS (WITH FIRST-RUN AUTOINSTALL)
 if empty(glob('~/.vim/autoload/plug.vim'))
-	silent !mkdir -p "$HOME/.vim/autoload"; U="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim";  F="$HOME/.vim/autoload/plug.vim";  curl -fLo "$F" "$U" 2>/dev/null  ||  wget -qLO "$F" "$U"
+	silent !D="$HOME/.vim/autoload"; mkdir -p "$D"; U="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim";  F="$D/plug.vim";  curl -fLo "$F" "$U" 2>/dev/null  ||  wget -qLO "$F" "$U"
 	autocmd VimEnter * PlugInstall
 endif
 call plug#begin()
 
+Plug 'tomasiser/vim-code-dark'  " VSCode Dark+ theme
+
 Plug 'tpope/vim-commentary'  " comment stuff out
 
 Plug 'vim-airline/vim-airline'  " more helpful tab line and status lines with colors
@@ -74,8 +124,6 @@ let g:airline#extensions#tabline#show_buffers = 0
 set laststatus=2
 set ttimeoutlen=50
 
-Plug 'mg979/vim-visual-multi'  " multiple cursor support
-
 Plug 'editorconfig/editorconfig-vim'
 
 Plug 'vim-syntastic/syntastic'  " multi-language syntax checker
@@ -87,11 +135,9 @@ Plug 'ntpeters/vim-better-whitespace'  " whitespace!!
 let g:strip_whitespace_on_save = 1
 
 Plug 'nathanaelkane/vim-indent-guides'  " pretty indent guides with softtabs
+let g:indent_guides_enable_on_vim_startup = 1
 let g:indent_guides_guide_size = 1
-let g:indent_guides_auto_colors = 0
-autocmd VimEnter * :highlight IndentGuidesOdd ctermbg=233
-autocmd VimEnter * :highlight IndentGuidesEven ctermbg=234
-autocmd VimEnter * :IndentGuidesEnable
+let g:indent_guides_auto_colors = 1
 
 Plug 'lilydjwg/colorizer'  " colorize CSS inline
 
@@ -102,16 +148,173 @@ let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-stand
 
 Plug 'tpope/vim-fugitive'  " git commands and statusline
 
-Plug 'mhinz/vim-signify'  " label VCS changes in gutter
+Plug 'airblade/vim-gitgutter'  " git changes in gutter
+
+"# COC SETUP
+if executable('node')
+	Plug 'neoclide/coc.nvim', {'branch': 'release'}  " amazing code completions
+	let g:coc_global_extensions = [
+		\ 'coc-git',
+		\ 'coc-json',
+		\ 'coc-tsserver',
+		\ 'coc-eslint',
+		\ 'coc-biome',
+		\ 'coc-prettier',
+		\ 'coc-java',
+		\ ]
+	if executable('zls') | call add(g:coc_global_extensions, 'coc-zig') | endif
+
+	set encoding=utf-8
+	set updatetime=300 " helps make some UI interactions more responsive
+	set signcolumn=yes " always enable to avoid UI shifting on init
+
+	" Use tab for trigger completion with characters ahead and navigate
+	" NOTE: There's always complete item selected by default, you may want to enable
+	" no select by `"suggest.noselect": true` in your configuration file
+	" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
+	" other plugin before putting this into your config
+	inoremap <silent><expr> <TAB>
+		\ coc#pum#visible() ? coc#pum#next(1) :
+		\ CheckBackspace() ? "\<Tab>" :
+		\ coc#refresh()
+	inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
+
+	" Make <CR> to accept selected completion item or notify coc.nvim to format
+	" <C-g>u breaks current undo, please make your own choice
+	inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
+		\ : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
+
+	function! CheckBackspace() abort
+		let col = col('.') - 1
+		return !col || getline('.')[col - 1]  =~# '\s'
+	endfunction
+
+	" Use <c-space> to trigger completion
+	if has('nvim')
+		inoremap <silent><expr> <c-space> coc#refresh()
+	else
+		inoremap <silent><expr> <c-@> coc#refresh()
+	endif
+
+	" Use `[g` and `]g` to navigate diagnostics
+	" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
+	nmap <silent> [g <Plug>(coc-diagnostic-prev)
+	nmap <silent> ]g <Plug>(coc-diagnostic-next)
+
+	" GoTo code navigation
+	nmap <silent> gd <Plug>(coc-definition)
+	nmap <silent> gy <Plug>(coc-type-definition)
+	nmap <silent> gi <Plug>(coc-implementation)
+	nmap <silent> gr <Plug>(coc-references)
+
+	" Use K to show documentation in preview window
+	nnoremap <silent> K :call ShowDocumentation()<CR>
+
+	function! ShowDocumentation()
+		if CocAction('hasProvider', 'hover')
+			call CocActionAsync('doHover')
+		else
+			call feedkeys('K', 'in')
+		endif
+	endfunction
 
-Plug 'pangloss/vim-javascript'  " better JavaScript support
+	" Highlight the symbol and its references when holding the cursor
+	autocmd CursorHold * silent call CocActionAsync('highlight')
 
-Plug 'moll/vim-node'  " nodejs extras
+	" Symbol renaming
+	nmap <leader>rn <Plug>(coc-rename)
 
-Plug 'leafgarland/typescript-vim'  " TypeScript support
-autocmd QuickFixCmdPost [^l]* nested cwindow
-autocmd QuickFixCmdPost    l* nested lwindow
+	" Formatting selected code
+	xmap <leader>f  <Plug>(coc-format-selected)
+	nmap <leader>f  <Plug>(coc-format-selected)
+
+	augroup mygroup
+		autocmd!
+		" Setup formatexpr specified filetype(s)
+		autocmd FileType typescript,javascript,json setl formatexpr=CocAction('formatSelected')
+	augroup end
+
+	" Applying code actions to the selected code block
+	" Example: `<leader>aap` for current paragraph
+	xmap <leader>a  <Plug>(coc-codeaction-selected)
+	nmap <leader>a  <Plug>(coc-codeaction-selected)
+
+	" Remap keys for applying code actions at the cursor position
+	nmap <leader>ac  <Plug>(coc-codeaction-cursor)
+	" Remap keys for apply code actions affect whole buffer
+	nmap <leader>as  <Plug>(coc-codeaction-source)
+	" Apply the most preferred quickfix action to fix diagnostic on the current line
+	nmap <leader>qf  <Plug>(coc-fix-current)
+
+	" Remap keys for applying refactor code actions
+	nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
+	xmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)
+	nmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)
+
+	" Run the Code Lens action on the current line
+	nmap <leader>cl  <Plug>(coc-codelens-action)
+
+	" Map function and class text objects
+	" NOTE: Requires 'textDocument.documentSymbol' support from the language server
+	xmap if <Plug>(coc-funcobj-i)
+	omap if <Plug>(coc-funcobj-i)
+	xmap af <Plug>(coc-funcobj-a)
+	omap af <Plug>(coc-funcobj-a)
+	xmap ic <Plug>(coc-classobj-i)
+	omap ic <Plug>(coc-classobj-i)
+	xmap ac <Plug>(coc-classobj-a)
+	omap ac <Plug>(coc-classobj-a)
+
+	" Remap <C-f> and <C-b> to scroll float windows/popups
+	if has('nvim-0.4.0') || has('patch-8.2.0750')
+	nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
+	nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
+	inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
+	inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
+	vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
+	vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
+	endif
+
+	" Use CTRL-S for selections ranges
+	" Requires 'textDocument/selectionRange' support of language server
+	nmap <silent> <C-s> <Plug>(coc-range-select)
+	xmap <silent> <C-s> <Plug>(coc-range-select)
+
+	" Add `:Format` command to format current buffer
+	command! -nargs=0 Format :call CocActionAsync('format')
+
+	" Add `:Fold` command to fold current buffer
+	command! -nargs=? Fold :call     CocAction('fold', <f-args>)
+
+	" Add `:OR` command for organize imports of the current buffer
+	command! -nargs=0 OR   :call     CocActionAsync('runCommand', 'editor.action.organizeImport')
+
+	" statusline support
+	let g:airline#extensions#coc#enabled = 1
+
+	" Mappings for CoCList
+	" Show all diagnostics
+	nnoremap <silent><nowait> <space>a  :<C-u>CocList diagnostics<cr>
+	" Manage extensions
+	nnoremap <silent><nowait> <space>e  :<C-u>CocList extensions<cr>
+	" Show commands
+	nnoremap <silent><nowait> <space>c  :<C-u>CocList commands<cr>
+	" Find symbol of current document
+	nnoremap <silent><nowait> <space>o  :<C-u>CocList outline<cr>
+	" Search workspace symbols
+	nnoremap <silent><nowait> <space>s  :<C-u>CocList -I symbols<cr>
+	" Do default action for next item
+	nnoremap <silent><nowait> <space>j  :<C-u>CocNext<CR>
+	" Do default action for previous item
+	nnoremap <silent><nowait> <space>k  :<C-u>CocPrev<CR>
+	" Resume latest coc list
+	nnoremap <silent><nowait> <space>p  :<C-u>CocListResume<CR>
+
+	"# COC SETUP END
+endif
 
 Plug 'rust-lang/rust.vim'
 
 call plug#end()
+
+colorscheme codedark

+ 0 - 1
install.sh

@@ -27,7 +27,6 @@ link() {
 FILES="
 	.profile
 	.vimrc
-	.eslintrc.js
 	.irbrc
 "