diff --git a/homebrew/brew.zsh b/homebrew/brew.zsh new file mode 100644 index 0000000..8fad927 --- /dev/null +++ b/homebrew/brew.zsh @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +export HOMEBREW_NO_ANALYTICS=1 diff --git a/node/nvm.zsh b/node/nvm.zsh new file mode 100644 index 0000000..ec73494 --- /dev/null +++ b/node/nvm.zsh @@ -0,0 +1,4 @@ +#!/usr/bin/env zsh + +export NVM_HOMEBREW="$(brew --prefix nvm)" +zstyle ':omz:plugins:nvm' autoload yes diff --git a/zsh/.curlrc.symlink b/zsh/.curlrc.symlink new file mode 100644 index 0000000..13a3016 --- /dev/null +++ b/zsh/.curlrc.symlink @@ -0,0 +1,6 @@ +connect-timeout = 60 # limit the timeout in seconds +location # follow HTTP redirects +show-error # show error messages + +# send a fake UA string for the HTTP servers that sniff it +user-agent = "Mozilla/5.0 Gecko" diff --git a/zsh/.zshrc.symlink b/zsh/.zshrc.symlink new file mode 100644 index 0000000..7b6d721 --- /dev/null +++ b/zsh/.zshrc.symlink @@ -0,0 +1,94 @@ +#!/usr/bin/env zsh + +# Base path. +export PATH="$HOME/bin:/usr/local/bin:$PATH" + +# Path to your oh-my-zsh installation. +export ZSH="$HOME/.oh-my-zsh" + +# Dotfiles root dir. +export DOT="$HOME/dotfiles" + +# Projects dir. +export HACK="$HOME/hackin" + +# Theme. +ZSH_THEME="typewritten" + +# Use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +HYPHEN_INSENSITIVE="true" + +# Auto-update behavior. +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the +# default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +COMPLETION_WAITING_DOTS="true" + +# Plugins to load. +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +plugins=(git zsh-syntax-highlighting zsh-autosuggestions colored-man-pages gh gulp iterm2 laravel macos npm nvm sudo thefuck) + +# iTerm2 Shell Integration +if [[ "$(uname)" == "Darwin" ]] && [[ $(mdfind "iTerm.app") ]]; then + zstyle ':omz:plugins:iterm2' shell-integration yes +fi + +# the fuck +eval $(thefuck --alias) + +# zsh completions +fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src + +source $ZSH/oh-my-zsh.sh + +# Local environment variables. +if [[ -e $HOME/.local.env ]]; then + source ~/.local.env +fi + +# All zsh dotfiles. +typeset -U config_files +config_files=($DOT/**/*.zsh) + +# Load path files first. +for file in ${(M)config_files:#*/path.zsh}; do + source $file +done + +# Load everything else, except completion. +for file in ${${config_files:#*/path.zsh}:#*/completion.zsh}; do + source $file +done + +# Initialize autocomplete. +autoload -U compinit +compinit + +# Load autocompletions. +for file in ${(M)config_files:#*/completion.zsh}; do + source $file +done + +unset config_files + +# Herd injected PHP binary. +export PATH="/Users/marley/Library/Application Support/Herd/bin/":$PATH + + +# Herd injected PHP 8.2 configuration. +export HERD_PHP_82_INI_SCAN_DIR="/Users/marley/Library/Application Support/Herd/config/php/82/" + + +# Herd injected PHP 8.3 configuration. +export HERD_PHP_83_INI_SCAN_DIR="/Users/marley/Library/Application Support/Herd/config/php/83/" + + +# Herd injected PHP 8.1 configuration. +export HERD_PHP_81_INI_SCAN_DIR="/Users/marley/Library/Application Support/Herd/config/php/81/" diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh new file mode 100644 index 0000000..bf47a9b --- /dev/null +++ b/zsh/aliases.zsh @@ -0,0 +1,87 @@ +#!/usr/bin/env zsh + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Shell aliases +alias zshconfig="$EDITOR ~/.zshrc" +alias ohmyzsh="$EDITOR ~/.oh-my-zsh" +alias rl=". ~/.zshrc" +alias c="clear" +alias e="$EDITOR" + +# Help alias +autoload -Uz run-help +autoload -Uz run-help-git +alias help=run-help + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Location alias +alias hack="cd ~/hackin" + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Default command options + +alias cp="cp -iv" +# │└─ list copied files +# └─ prompt before overwriting an existing file + +alias mkdir="mkdir -pv" +# │└─ list created directories +# └─ create intermediate directories + +alias mv="mv -iv" +# │└─ list moved files +# └─ prompt before overwriting an existing file + +alias rm="rm -rf --" + +# Colored grep output +alias grep="grep --color=auto" +alias fgrep="fgrep --color=auto" +alias egrep="egrep --color=auto" + +# Recursively delete `.DS_Store` files +alias dscleanup="find . -type f -name '*.DS_Store' -ls -delete" + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +shared_update_cmds="brew update && brew upgrade && brew cleanup; \ + npm install npm -g && npm update -g; \ + sudo gem update --system && sudo gem update && sudo gem cleanup" + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Mac aliases + +if [[ "$(uname)" == "Darwin" ]]; then + + alias clear-dns-cache="sudo dscacheutil -flushcache; \ + sudo killall -HUP mDNSResponder" + + alias o="open" + + alias u="sudo softwareupdate --install --all; $shared_update_cmds" + + # Show/hide hidden files in Finder + alias showhid="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" + alias hidehid="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" + + # Merge PDF files, preserving hyperlinks + # Usage: `mergepdf input{1,2,3}.pdf` + alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.pdf' + +fi + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Ubuntu aliases + +if [[ "$(uname)" == "Linux" ]]; then + + alias 0="xdg-open" + + alias u="sudo apt update && sudo apt upgrade; $shared_update_cmds" + +fi diff --git a/zsh/completion.zsh b/zsh/completion.zsh new file mode 100644 index 0000000..69a3338 --- /dev/null +++ b/zsh/completion.zsh @@ -0,0 +1,4 @@ +#!/usr/bin/env zsh + +# Make matches case insensitive for lowercase +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' diff --git a/zsh/config.zsh b/zsh/config.zsh new file mode 100644 index 0000000..f7b20d8 --- /dev/null +++ b/zsh/config.zsh @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh + +export EDITOR=nvim +export VISUAL="$EDITOR" + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +HISTFILE=~/.zsh_history +HISTSIZE=10000 +SAVEHIST=10000 + +# https://linux.die.net/man/1/zshoptions +setopt LOCAL_OPTIONS # allow functions to have local options +setopt LOCAL_TRAPS # allow functions to have local traps + +setopt PROMPT_SUBST # perform expansion & subsitution in prompts + +setopt HIST_VERIFY # perform history expansion (see man page linked above) +setopt HIST_IGNORE_ALL_DUPS # delete older duplicates +setopt HIST_REDUCE_BLANKS # remove superfluous blanks +setopt SHARE_HISTORY # share history between sessions via the $HISTFILE + +setopt COMPLETE_ALIASES # don't expand aliases before attempting completion diff --git a/zsh/fpath.zsh b/zsh/fpath.zsh new file mode 100644 index 0000000..7233315 --- /dev/null +++ b/zsh/fpath.zsh @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +if [[ -d "$DOT/functions" ]]; then + fpath=($DOT/functions $fpath) + autoload -U $DOT/functions/*(:t) +fi + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Add each topic folder to fpath so that they can +# add functions and completion scripts. +for topic_folder ($ZSH/*) if [ -d $topic_folder ]; then + fpath=($topic_folder $fpath) +fi