1
mirror of https://github.com/jakejarvis/dotfiles.git synced 2025-04-28 04:10:28 -04:00

support all debian-based machines, not just codespaces

This commit is contained in:
Jake Jarvis 2023-01-26 10:06:04 -05:00
parent 19b9e5aa23
commit bab66d06a5
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
21 changed files with 505 additions and 317 deletions

1
.gitignore vendored
View File

@ -2,4 +2,3 @@
**/.ssh/known_hosts* **/.ssh/known_hosts*
*id_rsa* *id_rsa*
*id_ed25519* *id_ed25519*
**/*.local*

217
Brewfile
View File

@ -1,51 +1,76 @@
###############################
# Taps #
###############################
tap "1password/tap"
tap "dart-lang/dart"
tap "hashicorp/tap"
tap "homebrew/aliases"
tap "homebrew/autoupdate"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-drivers"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
tap "ngrok/ngrok"
tap "planetscale/tap"
tap "sass/sass"
tap "sidneys/homebrew"
############################### ###############################
# Binaries # # Binaries #
############################### ###############################
# Perhaps most importantly... # Perhaps most importantly...
brew "zsh" brew "zsh" unless OS.linux?
# Better bash as a backup # Better bash as a backup
brew "bash" brew "bash" unless OS.linux?
# GNU utilities (those that come with macOS are outdated) # GNU utilities (those that come with macOS are outdated)
brew "coreutils" brew "coreutils"
brew "moreutils"
brew "findutils" brew "findutils"
brew "gnutls"
brew "gnu-indent" brew "gnu-indent"
brew "gnu-sed" brew "gnu-sed"
brew "gnu-tar" brew "gnu-tar"
brew "gnu-indent"
brew "gnu-which" brew "gnu-which"
# wget with IRI support
brew "wget" #, args: ["with-iri"]
# GnuPG to enable PGP-signing commits
brew "gnupg" brew "gnupg"
brew "gnutls"
# More recent versions of some macOS tools
brew "vim" #, args: ["with-override-system-vi"]
brew "gcc"
brew "grep" brew "grep"
brew "make" brew "make"
brew "moreutils"
# More recent versions of some macOS tools
brew "curl", link: true
brew "gcc"
brew "gmp"
brew "nano" brew "nano"
brew "openssh" brew "openssh"
brew "screen" brew "screen"
brew "gmp" brew "unzip", link: true
brew "curl", link: true brew "vim" #, args: ["with-override-system-vi"]
# Other useful binaries # Other useful binaries
brew "ack" brew "ack"
brew "imagemagick" #, args: ["with-webp"] brew "autoconf"
brew "automake"
brew "ffmpeg" #, args: ["with-libvpx"] brew "ffmpeg" #, args: ["with-libvpx"]
brew "imagemagick" #, args: ["with-webp"]
brew "jemalloc"
brew "less" brew "less"
brew "libsass", args: ["HEAD"]
brew "libyaml"
brew "mtr" brew "mtr"
brew "openssl@1.1" if OS.mac?
brew "p7zip" brew "p7zip"
brew "rename" brew "pkg-config"
brew "readline"
brew "sidneys/homebrew/unrar" if OS.mac?
brew "ssh-copy-id", link: true brew "ssh-copy-id", link: true
brew "tmux"
brew "tree" brew "tree"
brew "wget" #, args: ["with-iri"]
# Git # Git
brew "git" brew "git"
@ -53,126 +78,107 @@ brew "git-lfs"
brew "gh" brew "gh"
# Mostly ordinary binaries # Mostly ordinary binaries
brew "1password/tap/1password-cli" brew "1password/tap/1password-cli" if OS.mac?
brew "aws-shell"
brew "awscli"
brew "angular-cli" brew "angular-cli"
brew "asciinema" brew "asciinema"
brew "autoconf" brew "aws-shell"
brew "automake" brew "awscli"
brew "azure-cli"
brew "carthage" brew "carthage"
brew "certbot"
brew "cloudflare/cloudflare/cloudflared"
brew "cocoapods" brew "cocoapods"
brew "composer" brew "composer"
brew "dart-lang/dart/dart" brew "dart-lang/dart/dart"
brew "deno" brew "deno"
brew "doctl" brew "doctl"
brew "elixir" brew "fx"
brew "erlang"
brew "go" brew "go"
brew "guetzli" brew "guetzli"
brew "heroku/brew/heroku" brew "hashicorp/tap/packer"
brew "heroku/brew/heroku-node" brew "hashicorp/tap/terraform"
brew "hashicorp/tap/vault"
brew "htop" brew "htop"
brew "httpie" brew "httpie"
brew "httrack"
brew "hugo", args: ["HEAD"] brew "hugo", args: ["HEAD"]
brew "hydra" brew "ipinfo-cli"
brew "iproute2mac" brew "iproute2mac"
brew "jq" brew "jq"
brew "libsass", args: ["HEAD"] brew "mariadb"
brew "mas" brew "mas" if OS.mac?
brew "mhash" brew "mhash"
brew "mkcert" brew "mkcert"
brew "mariadb"
brew "mysql-client" brew "mysql-client"
brew "ncurses" brew "ncurses"
brew "neofetch"
brew "netcat" brew "netcat"
brew "openjdk"
brew "openvpn" brew "openvpn"
brew "optipng" brew "optipng"
brew "pandoc" brew "pandoc"
brew "php" brew "php"
brew "pkg-config"
brew "planetscale/tap/pscale" brew "planetscale/tap/pscale"
brew "pngcheck"
brew "pngcrush" brew "pngcrush"
brew "postgresql" brew "postgresql"
brew "python@3" brew "protobuf"
brew "python" brew "pyenv" unless OS.linux?
brew "pyenv" # brew "python"
# brew "python@3"
brew "qemu" brew "qemu"
# brew "ruby" brew "rbenv" unless OS.linux?
brew "ruby-build"
brew "rust"
brew "rbenv"
brew "rclone" brew "rclone"
brew "rlwrap"
brew "ruby-build" unless OS.linux?
# brew "ruby"
brew "rust"
brew "s3cmd" brew "s3cmd"
brew "sass/sass/migrator" brew "sass/sass/dart-sass-embedded"
brew "sass/sass/sass" brew "sass/sass/sass"
brew "serverless" brew "serverless"
brew "shellcheck" brew "shellcheck"
brew "shfmt"
brew "sqlite" brew "sqlite"
brew "sub2srt" brew "subversion"
brew "svn" brew "svn"
brew "tor" brew "tor"
brew "torsocks" brew "torsocks"
brew "volta" brew "volta" unless OS.linux?
brew "whois", link: true brew "whois", link: true
brew "wireguard-tools" brew "wireguard-tools"
brew "wireguard-go"
brew "wp-cli" brew "wp-cli"
brew "xz" brew "xz"
# brew "youtube-dl" # brew "youtube-dl"
brew "yt-dlp"
brew "yq" brew "yq"
brew "yt-dlp"
brew "zopfli" brew "zopfli"
# Android SDK
# cask "android-platform-tools"
# brew "ant"
# brew "maven"
# brew "gradle"
# cask "android-sdk"
# cask "android-ndk"
# Pentesting tools # Pentesting tools
brew "aircrack-ng" brew "aircrack-ng"
# brew "apktool" brew "apktool"
brew "bfg" brew "bettercap"
brew "binutils" brew "binutils"
brew "binwalk" brew "binwalk"
brew "cifer" brew "dnsx"
brew "dex2jar"
brew "dns2tcp"
brew "fcrackzip" brew "fcrackzip"
brew "foremost" brew "geoip"
brew "hashpump" brew "hashcat"
brew "httpx"
brew "hydra" brew "hydra"
brew "john" brew "john"
brew "knock" brew "knock"
brew "massdns" brew "massdns"
brew "mitmproxy" brew "mitmproxy"
brew "netpbm" brew "naabu"
brew "nikto"
brew "nmap" brew "nmap"
brew "nuclei"
brew "pdfcrack" brew "pdfcrack"
brew "pngcheck" brew "pngcheck"
brew "socat"
brew "sqlmap" brew "sqlmap"
brew "subfinder"
brew "tcpdump"
brew "tcpflow" brew "tcpflow"
brew "tcpreplay" brew "tcpreplay"
brew "tcptrace" brew "tcptrace"
brew "xpdf" brew "vbindiff"
brew "bettercap"
brew "hashcat"
brew "nikto"
brew "tcpdump"
# brew "wpscanteam/tap/wpscan"
brew "dnsx"
brew "httpx"
brew "naabu"
brew "nuclei"
brew "subfinder"
############################### ###############################
# macOS Apps via Cask # # macOS Apps via Cask #
@ -181,10 +187,11 @@ brew "subfinder"
cask_args appdir: "/Applications" cask_args appdir: "/Applications"
# System Utilities # System Utilities
cask "airbuddy"
cask "appcleaner" cask "appcleaner"
cask "backblaze" cask "backblaze"
cask "backblaze-downloader"
cask "carbon-copy-cloner" cask "carbon-copy-cloner"
cask "cleanmymac"
cask "coconutbattery" cask "coconutbattery"
cask "daisydisk" cask "daisydisk"
cask "dropbox" cask "dropbox"
@ -201,24 +208,27 @@ cask "1password"
cask "authy" cask "authy"
cask "gpg-suite" cask "gpg-suite"
cask "little-snitch" cask "little-snitch"
cask "tor-browser" cask "tailscale"
cask "tunnelblick" cask "tunnelblick"
cask "yubico-authenticator"
cask "yubico-yubikey-manager"
# Development/Work # Development/Work
cask "adobe-creative-cloud" cask "adobe-creative-cloud"
cask "adoptopenjdk/openjdk/adoptopenjdk" cask "android-platform-tools", args: { appdir: "~/Applications" }
cask "chromedriver" cask "chromedriver"
cask "eclipse-java" cask "eclipse-java"
cask "github" cask "github"
cask "google-cloud-sdk" cask "google-cloud-sdk", args: { appdir: "~/Applications" }
cask "imageoptim" cask "imageoptim"
cask "iterm2" cask "iterm2"
cask "jetbrains-toolbox" cask "jetbrains-toolbox"
cask "microsoft-office" cask "microsoft-office"
cask "powershell" cask "ngrok/ngrok/ngrok"
cask "sequel-pro" cask "sequel-pro"
cask "sketch" cask "sketch"
cask "tower" cask "tableplus"
cask "thunderbird"
cask "transmit" cask "transmit"
cask "visual-studio-code" cask "visual-studio-code"
@ -226,15 +236,13 @@ cask "visual-studio-code"
cask "docker" cask "docker"
cask "parallels" cask "parallels"
# cask "virtualbox" # cask "virtualbox"
# cask "virtualbox-extension-pack" cask "virtualbox-beta" # supports M1!
cask "homebrew/cask-versions/virtualbox-beta" # supports M1!
# cask "vagrant"
# cask "vmware-fusion"
# Media # Media
cask "beamer" cask "beamer"
cask "handbrake" cask "handbrake"
cask "iina" cask "iina"
cask "obs"
cask "plex-media-player" cask "plex-media-player"
cask "pocket-casts" cask "pocket-casts"
cask "spotify" cask "spotify"
@ -255,16 +263,12 @@ cask "metasploit"
cask "wifi-explorer" cask "wifi-explorer"
cask "wireshark" cask "wireshark"
# Browsers (for reference only -- install these via offline DMGs no matter what) # Browsers
# * Firefox cask "firefox"
# - Stable cask "firefox-developer-edition"
# - Dev: https://www.mozilla.org/en-US/firefox/developer/ cask "google-chrome"
# - Nightly: https://www.mozilla.org/en-US/firefox/channel/desktop/ cask "safari-technology-preview"
# * Chrome cask "tor-browser"
# - Stable
# - Canary: https://www.google.com/chrome/canary/
# * Safari
# - Preview: https://developer.apple.com/safari/technology-preview/
############################### ###############################
# Drivers # # Drivers #
@ -272,6 +276,8 @@ cask "wireshark"
cask "homebrew/cask-drivers/hp-easy-start" cask "homebrew/cask-drivers/hp-easy-start"
cask "homebrew/cask-drivers/logitech-camera-settings" cask "homebrew/cask-drivers/logitech-camera-settings"
cask "homebrew/cask-drivers/logi-options-plus"
cask "homebrew/cask-drivers/logitech-unifying"
cask "homebrew/cask-drivers/razer-synapse" cask "homebrew/cask-drivers/razer-synapse"
cask "homebrew/cask-drivers/sonos" cask "homebrew/cask-drivers/sonos"
@ -281,20 +287,20 @@ cask "homebrew/cask-drivers/sonos"
# Monospace # Monospace
cask "homebrew/cask-fonts/font-cascadia-code" cask "homebrew/cask-fonts/font-cascadia-code"
cask "homebrew/cask-fonts/font-source-code-pro"
cask "homebrew/cask-fonts/font-hack" cask "homebrew/cask-fonts/font-hack"
cask "homebrew/cask-fonts/font-ibm-plex-mono" cask "homebrew/cask-fonts/font-ibm-plex-mono"
cask "homebrew/cask-fonts/font-roboto-mono" cask "homebrew/cask-fonts/font-roboto-mono"
cask "homebrew/cask-fonts/font-sf-mono" # iTerm/VS Code font, comes in .pkg cask "homebrew/cask-fonts/font-sf-mono"
cask "homebrew/cask-fonts/font-sf-mono-for-powerline" cask "homebrew/cask-fonts/font-sf-mono-for-powerline"
cask "homebrew/cask-fonts/font-source-code-pro"
# Sans/Serif # Sans/Serif
cask "homebrew/cask-fonts/font-comic-neue" cask "homebrew/cask-fonts/font-comic-neue"
cask "homebrew/cask-fonts/font-inter" cask "homebrew/cask-fonts/font-inter"
cask "homebrew/cask-fonts/font-roboto"
cask "homebrew/cask-fonts/font-open-sans" cask "homebrew/cask-fonts/font-open-sans"
cask "homebrew/cask-fonts/font-sf-compact" # comes in .pkg cask "homebrew/cask-fonts/font-roboto"
cask "homebrew/cask-fonts/font-sf-pro" # comes in .pkg cask "homebrew/cask-fonts/font-sf-compact"
cask "homebrew/cask-fonts/font-sf-pro"
############################### ###############################
# macOS Apps via App Store # # macOS Apps via App Store #
@ -312,16 +318,19 @@ mas "Logic Pro", id: 634148309
mas "Motion", id: 434290957 mas "Motion", id: 434290957
mas "Numbers", id: 409203825 mas "Numbers", id: 409203825
mas "Pages", id: 409201541 mas "Pages", id: 409201541
mas "Playgrounds", id: 1496833156 mas "TestFlight", id: 899247664
mas "Transporter", id: 1450874784 mas "Transporter", id: 1450874784
mas "Xcode", id: 497799835 mas "Xcode", id: 497799835
# Third Party # Third Party
mas "1Blocker", id: 1365531024
mas "1Password for Safari", id: 1569813296
mas "Amphetamine", id: 937984704 mas "Amphetamine", id: 937984704
mas "Disk Speed Test", id: 425264550 mas "Drafts", id: 1435957248
mas "Magnet", id: 441258766
mas "Microsoft Remote Desktop", id: 1295203466 mas "Microsoft Remote Desktop", id: 1295203466
mas "Shazam", id: 897118787 mas "Shazam", id: 897118787
mas "Silicon Info", id: 1542271266 mas "Silicon Info", id: 1542271266
mas "Twitter", id: 409789998 mas "Speedtest", id: 1153157709
mas "VMware Remote Console", id: 1230249825 mas "VMware Remote Console", id: 1230249825
mas "WireGuard", id: 1451685025 mas "WireGuard", id: 1451685025

View File

@ -17,7 +17,7 @@ All of the juicy stuff you're probably looking for is at:
## Usage ## Usage
Designed for macOS, kinda works on Linux (requires [ZSH to be installed](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH#ubuntu-debian--derivatives-windows-10-wsl--native-linux-kernel-with-windows-10-build-1903) first): Designed for macOS, also works on Linux (specifially Debian and Ubuntu):
```bash ```bash
git clone https://github.com/jakejarvis/dotfiles.git ~/.dotfiles git clone https://github.com/jakejarvis/dotfiles.git ~/.dotfiles

View File

@ -1,54 +0,0 @@
#!/usr/bin/env bash
set -e
# link automatically cloned dotfiles repo to regular ~/.dotfiles path
# https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-personalization-for-codespaces#troubleshooting-dotfiles
ln -sf /workspaces/.codespaces/.persistedshare/dotfiles ~/.dotfiles
# clean up
sudo rm -rf /var/lib/apt/lists/*
# extra ubuntu packages
if [[ "$(sudo find /var/lib/apt/lists/* | wc -l)" = "0" ]]; then
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
man \
curl \
wget \
lsb-release \
ca-certificates \
file \
shared-mime-info
fi
# prepare zinit manually
ZINIT_HOME="$HOME/.local/share/zinit/zinit.git"
if [[ ! -d "$ZINIT_HOME" ]]; then
mkdir -p "$(dirname "$ZINIT_HOME")"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# install volta
if ! command -v volta &>/dev/null; then
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
curl -fsSL https://get.volta.sh | bash -s -- --skip-setup
fi
volta install node@lts npm@latest yarn@latest
# install rbenv & ruby-build
if ! command -v rbenv &>/dev/null; then
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
fi
# install pyenv
if ! command -v pyenv &>/dev/null; then
curl -fsSL https://github.com/pyenv/pyenv-installer/raw/HEAD/bin/pyenv-installer | bash
fi
# set shell to zsh
sudo chsh -s /bin/zsh "$(whoami)"
# clean up
sudo rm -rf /var/lib/apt/lists/*

View File

@ -1,5 +1,6 @@
[core] [core]
editor = code --wait editor = code --wait
pager = delta
excludesfile = ~/.gitignore_global excludesfile = ~/.gitignore_global
# Make `git rebase` safer on macOS # Make `git rebase` safer on macOS
@ -25,6 +26,8 @@
tool = default-difftool tool = default-difftool
[difftool "default-difftool"] [difftool "default-difftool"]
cmd = code --wait --diff $LOCAL $REMOTE cmd = code --wait --diff $LOCAL $REMOTE
[interactive]
diffFilter = delta --color-only --features=interactive
[alias] [alias]
undo = reset --soft HEAD~1 undo = reset --soft HEAD~1
pom = push origin main pom = push origin main
@ -53,3 +56,11 @@
keepBackup = true keepBackup = true
[color] [color]
ui = auto ui = auto
[delta]
features = decorations
[delta "interactive"]
keep-plus-minus-markers = false
[delta "decorations"]
hunk-header-style = omit
line-numbers = true
syntax-theme = base16

View File

@ -1,19 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -e
echo "🙏 Deep breaths, everything will (probably) be fine!" echo "🙏 Deep breaths, everything will (probably) be fine!"
echo "" echo ""
# location of the *full repo* (defaults to ~/.dotfiles) # location of the *full repo* (defaults to ~/.dotfiles)
DOTFILES_PATH="${DOTFILES_PATH:="$HOME/.dotfiles"}" DOTFILES_PATH="${DOTFILES_PATH:="$HOME/.dotfiles"}"
# location of this script (should be right next to all the other files, but we handle that next if it's not)
INSTALLER_PATH="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
# override location when running on GitHub Codespaces since it's cloned automatically: # if this is a codespace, link automatically cloned dotfiles repo to the expected DOTFILES_PATH
# https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-personalization-for-codespaces#troubleshooting-dotfiles # https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-personalization-for-codespaces#troubleshooting-dotfiles
if [[ "$CODESPACES" = "true" ]]; then if [[ "$CODESPACES" = "true" ]] && [[ -d /workspaces/.codespaces/.persistedshare/dotfiles ]]; then
DOTFILES_PATH="/workspaces/.codespaces/.persistedshare/dotfiles" ln -sf /workspaces/.codespaces/.persistedshare/dotfiles "$DOTFILES_PATH"
elif [[ ! -f "README.md" ]]; then fi
# clone this repo if this script is all by its lonesome
# clone this repo if this script is all by itself and/or we're not in the expected location
if [[ "$INSTALLER_PATH" != "$DOTFILES_PATH" ]] && [[ ! -d "$DOTFILES_PATH" ]]; then
git clone https://github.com/jakejarvis/dotfiles.git "$DOTFILES_PATH" git clone https://github.com/jakejarvis/dotfiles.git "$DOTFILES_PATH"
echo "Successfully cloned the full repo to '$DOTFILES_PATH'" echo "Successfully cloned the full repo to '$DOTFILES_PATH'"
@ -29,24 +33,44 @@ ln -sf "$DOTFILES_PATH/zsh/.zshrc" ~/.zshrc
ln -sf "$DOTFILES_PATH/zsh/.zprofile" ~/.zprofile ln -sf "$DOTFILES_PATH/zsh/.zprofile" ~/.zprofile
ln -sf "$DOTFILES_PATH/git/.gitconfig" ~/.gitconfig ln -sf "$DOTFILES_PATH/git/.gitconfig" ~/.gitconfig
ln -sf "$DOTFILES_PATH/git/.gitignore_global" ~/.gitignore_global ln -sf "$DOTFILES_PATH/git/.gitignore_global" ~/.gitignore_global
ln -sf "$DOTFILES_PATH/nano/.nanorc" ~/.nanorc
ln -sf "$DOTFILES_PATH/starship/config.toml" ~/.config/starship.toml ln -sf "$DOTFILES_PATH/starship/config.toml" ~/.config/starship.toml
if [[ "$(uname)" = "Darwin" ]]; then # this file will be sourced by .zshrc for more sensitive variables/settings
# suppress terminal login banners touch ~/.zshrc.local
touch ~/.hushlogin
# prepare zinit manually
ZINIT_HOME="$HOME/.local/share/zinit/zinit.git"
if [[ ! -d "$ZINIT_HOME" ]]; then
mkdir -p "$(dirname "$ZINIT_HOME")"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# the remainder of the setup tasks are OS-specific
if [[ "$OSTYPE" = "darwin"* ]]; then
# final symlinks # final symlinks
if [[ ! -d ~/.ssh ]]; then if [[ ! -d ~/.ssh ]]; then
mkdir -p ~/.ssh && chmod 700 ~/.ssh mkdir -p ~/.ssh && chmod 700 ~/.ssh
fi fi
ln -sf "$DOTFILES_PATH/ssh/.ssh/config" ~/.ssh/config ln -sf "$DOTFILES_PATH/ssh/.ssh/config" ~/.ssh/config
ln -sf "$DOTFILES_PATH/nano/brew.nanorc" ~/.nanorc
ln -sf "$DOTFILES_PATH/Brewfile" ~/Brewfile
# suppress terminal login banners
touch ~/.hushlogin
# shellcheck disable=SC1090,SC1091 # shellcheck disable=SC1090,SC1091
source "$DOTFILES_PATH/macos/macos.sh" source "$DOTFILES_PATH/macos/macos.sh"
elif [[ "$CODESPACES" = "true" ]]; then elif [[ "$OSTYPE" = "linux-gnu"* ]]; then
# final symlinks
ln -sf "$DOTFILES_PATH/nano/default.nanorc" ~/.nanorc
# shellcheck disable=SC1090,SC1091 # shellcheck disable=SC1090,SC1091
source "$DOTFILES_PATH/codespaces/codespaces.sh" source "$DOTFILES_PATH/linux/linux.sh"
else
echo "I don't recognize this OS... skipping extra steps."
fi fi
echo "🎉 Done!" # wow
echo ""
echo "🎉 It actually worked!"
echo "Log out and log back in (or just restart) to finish installing all ZSH features."

65
linux/linux.sh Executable file
View File

@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -e
if [[ -e /etc/debian_version ]]; then
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
zsh \
zsh-common \
zsh-doc \
man \
curl \
wget \
gnupg \
apt-transport-https \
ca-certificates \
lsb-release \
tzdata \
shared-mime-info \
build-essential \
file \
procps \
git
sudo apt-get clean -y
fi
# set machine's timezone to local time
sudo timedatectl set-timezone America/New_York
# install linuxbrew:
# https://docs.brew.sh/Homebrew-on-Linux#install
if ! command -v brew &>/dev/null; then
# TODO: hack to permit installing as root, find a better way
# https://github.com/Homebrew/install/blob/master/install.sh#L306
sudo touch /.dockerenv
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
sudo rm /.dockerenv
fi
# install tailscale
if ! command -v tailscale &>/dev/null; then
curl -fsSL https://tailscale.com/install.sh | bash
fi
# install volta
if ! command -v volta &>/dev/null; then
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
curl -fsSL https://get.volta.sh | bash -s -- --skip-setup
fi
volta install node@lts npm@latest yarn@latest
# install rbenv & ruby-build
if ! command -v rbenv &>/dev/null; then
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
fi
# install pyenv
if ! command -v pyenv &>/dev/null; then
curl -fsSL https://github.com/pyenv/pyenv-installer/raw/HEAD/bin/pyenv-installer | bash
fi
# set login shell to zsh
sudo chsh -s "$(which zsh)" "$(whoami)"

View File

@ -6,7 +6,7 @@
# https://github.com/paulirish/dotfiles/blob/master/.osx # https://github.com/paulirish/dotfiles/blob/master/.osx
# https://github.com/kevinSuttle/macOS-Defaults/blob/master/.macos # https://github.com/kevinSuttle/macOS-Defaults/blob/master/.macos
set -euo pipefail set -e
# Change new hostname here if necessary # Change new hostname here if necessary
COMPUTER_NAME="JJ-MBA" COMPUTER_NAME="JJ-MBA"

View File

@ -1,12 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -e
# This shouldn't be run if not on macOS, but make double sure
if [[ ! "$(uname)" = "Darwin" ]]; then
echo "Skipping macOS steps."
return
fi
# Ask for the administrator password upfront # Ask for the administrator password upfront
sudo -v sudo -v
@ -24,8 +18,8 @@ sudo xcodebuild -license accept
# This whole thing kinda hinges on having Homebrew... # This whole thing kinda hinges on having Homebrew...
# Check for it and install from GitHub if it's not there # Check for it and install from GitHub if it's not there
if [[ ! "$(which brew)" ]]; then if ! command -v brew &>/dev/null; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
fi fi
# Disable analytics # Disable analytics
@ -45,11 +39,6 @@ chsh -s "$(brew --prefix)/bin/zsh"
chmod 755 "$(brew --prefix)/share/zsh" chmod 755 "$(brew --prefix)/share/zsh"
chmod 755 "$(brew --prefix)/share/zsh/site-functions" chmod 755 "$(brew --prefix)/share/zsh/site-functions"
# install zinit
ZINIT_HOME="$HOME/.local/share/zinit/zinit.git"
mkdir -p "$(dirname "$ZINIT_HOME")"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
# 1Password SSH integration # 1Password SSH integration
# https://developer.1password.com/docs/ssh/get-started#step-4-configure-your-ssh-or-git-client # https://developer.1password.com/docs/ssh/get-started#step-4-configure-your-ssh-or-git-client
mkdir -p ~/.1password mkdir -p ~/.1password

32
nano/brew.nanorc Normal file
View File

@ -0,0 +1,32 @@
# Enable built-in syntax highlighting
# IMPORTANT: this path is specific to homebrew's nano, hence this duplicate rc file only for macOS, which AFAIK is the
# best way to do this...
include "/opt/homebrew/Cellar/nano/*/share/nano/*.nanorc"
# Non-default settings
set historylog # Save the last 100 history searches for later use.
# set positionlog # Saves the cursor position between editing sessions.
set zap # Allows you to highlight text (CTRL+SHIFT+ARROW) and delete it with backspace.
set afterends # Ctrl+Right moves to end of word instead of beginning.
set wordchars "_" # Recognize _ as part of a word.
set autoindent # A new line will have the same number of tabs/leading spaces as the previous one.
# set tabsize 2
# set tabstospaces
# Fix option+left/right word skipping
# https://unix.stackexchange.com/a/392309
unbind M-B all
unbind M-F all
bind M-B prevword main
bind M-F nextword main
# Muscle memory adaptations
bind ^s writeout main # Ctrl+S for save.
bind ^f whereis main # Ctrl+F for search.
# bind ^h replace main # Ctrl+H for find/replace.
bind ^z undo main # Ctrl+Z for undo.
# bind ^y redo main # Ctrl+Y for redo.
# bind ^x cut main # Ctrl+X for cut.
# bind ^c copy main # Ctrl+C for copy.
# bind ^v paste all # Ctrl+V for paste.
bind ^/ comment main # Ctrl+/ for (un)commenting current line.

View File

@ -1,5 +1,5 @@
# Enable built-in syntax highlighting # Enable built-in syntax highlighting
# include "/opt/homebrew/Cellar/nano/*/share/nano/*.nanorc" include "/usr/share/nano/*.nanorc"
# Non-default settings # Non-default settings
set historylog # Save the last 100 history searches for later use. set historylog # Save the last 100 history searches for later use.

View File

@ -1,5 +1,5 @@
# https://starship.rs/config/ # https://starship.rs/config/
"$schema" = 'https://starship.rs/config-schema.json' "$schema" = "https://starship.rs/config-schema.json"
# A minimal left prompt: # A minimal left prompt:
# format = """$character""" # format = """$character"""
@ -46,11 +46,11 @@ symbol = " "
[git_commit] [git_commit]
tag_symbol = " " tag_symbol = " "
tag_disabled = false tag_disabled = false
format = '[ $hash$tag]($style) ' format = "[ $hash$tag]($style) "
[git_status] [git_status]
style = "bold bright-yellow" style = "bold bright-yellow"
format = '([ $all_status$ahead_behind]($style) )' format = "([ $all_status$ahead_behind]($style) )"
ignore_submodules = true ignore_submodules = true
renamed = "" renamed = ""
deleted = "" deleted = ""
@ -59,6 +59,12 @@ stashed = ""
[golang] [golang]
symbol = " " symbol = " "
[hostname]
ssh_only = true
ssh_symbol = " "
style = "bold green"
format = "[$ssh_symbol$hostname]($style) "
[localip] [localip]
disabled = true disabled = true
@ -101,5 +107,10 @@ symbol = " "
[rust] [rust]
symbol = " " symbol = " "
[username]
format = "[ $user]($style) "
style_root = "bold bright-red"
style_user = "bold bright-red"
[vagrant] [vagrant]
disabled = true disabled = true

View File

@ -0,0 +1 @@
# Intentionally left blank.

View File

@ -1,14 +1,21 @@
#!/usr/bin/env zsh
# path to this directory: # path to this directory:
export ZSH_CUSTOM=~/.dotfiles/zsh export ZSH_CUSTOM=~/.dotfiles/zsh
# load .zsh files from the above dir in this order: # load .zsh files from the above dir in this order:
for _dotzsh in "$ZSH_CUSTOM"/custom/{common,env,path,aliases,functions,plugins,macos}.zsh; do for _dotzsh in "$ZSH_CUSTOM"/custom/{common,env,path,aliases,functions,plugins}.zsh; do
if [[ -f "$_dotzsh" ]]; then if [[ -f "$_dotzsh" ]]; then
source "$_dotzsh" source "$_dotzsh"
fi fi
done done
unset _dotzsh unset _dotzsh
# macos.zsh has aliases, functions, etc specific to macOS:
if [[ "$OSTYPE" = "darwin"* ]] && [[ -f "$ZSH_CUSTOM"/custom/macos.zsh ]]; then
source "$ZSH_CUSTOM"/custom/macos.zsh
fi
if [[ -f ~/.zshrc.local ]]; then if [[ -f ~/.zshrc.local ]]; then
source ~/.zshrc.local source ~/.zshrc.local
fi fi

View File

@ -1,3 +1,5 @@
#!/usr/bin/env zsh
# allow sudo-able aliases # allow sudo-able aliases
alias sudo="sudo " alias sudo="sudo "
@ -22,6 +24,7 @@ alias gpom="git push origin main"
alias glom="git pull origin main" alias glom="git pull origin main"
alias gpo="git push origin" # + branch name alias gpo="git push origin" # + branch name
alias glo="git pull origin" # + branch name alias glo="git pull origin" # + branch name
alias glfm="git fetch && git reset origin/main --hard"
alias gb="git checkout" # + existing branch name alias gb="git checkout" # + existing branch name
alias gbn="git checkout -b" # + new branch name alias gbn="git checkout -b" # + new branch name
alias grm="git rebase -i origin/main" alias grm="git rebase -i origin/main"
@ -65,26 +68,10 @@ alias npr="npm run"
alias fresh_npm="rm -rf node_modules package-lock.json && npm install" alias fresh_npm="rm -rf node_modules package-lock.json && npm install"
alias fresh_yarn="rm -rf node_modules yarn.lock && yarn install" alias fresh_yarn="rm -rf node_modules yarn.lock && yarn install"
# Hugo # uncomment to use VS Code insiders build
# install from source # alias code="code-insiders"
make_hugo() { # open current working directory in VS Code
# parentheses lets us cd to Hugo path without changing our current location alias vs="code ."
(
cd "$GOPATH/src/github.com/gohugoio/hugo" \
&& bash -c "$GOPATH/bin/hugo env" \
&& git checkout master \
&& mage uninstall \
&& git pull origin master \
&& git reset --hard HEAD \
&& mage -v hugo \
&& HUGO_BUILD_TAGS=extended mage -v install \
&& bash -c "$GOPATH/bin/hugo env"
)
}
# install from brew
alias hugo_brew="brew upgrade hugo --fetch-HEAD --build-from-source"
# run `hugo config` first to make sure we're in a Hugo directory:
alias hugo_clean="hugo config 1>/dev/null && rm -rf public/ resources/ build/"
# an original creation, see https://github.com/jakejarvis/simpip # an original creation, see https://github.com/jakejarvis/simpip
alias ipv4="curl -4 simpip.com --max-time 1 --proto-default https --silent" alias ipv4="curl -4 simpip.com --max-time 1 --proto-default https --silent"
@ -93,19 +80,39 @@ alias ip="ipv4; ipv6"
alias ip-local="ipconfig getifaddr en0" alias ip-local="ipconfig getifaddr en0"
alias ips="ip; ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" alias ips="ip; ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# keys
alias pubkey="pbcopy < ~/.ssh/id_ed25519.pub && echo '=> Public key copied to clipboard.'"
alias pubkey_rsa="pbcopy < ~/.ssh/id_rsa.pub && echo '=> Public key copied to clipboard.'"
# tailscale: https://tailscale.com/kb/1080/cli/?tab=macos
alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
alias tscl="tailscale"
# youtube-dl # youtube-dl
alias youtube-dl="yt-dlp" # fork: https://github.com/yt-dlp/yt-dlp alias youtube-dl="yt-dlp" # better youtube-dl fork: https://github.com/yt-dlp/yt-dlp
alias ytdl="youtube-dl -f bestvideo+bestaudio" alias ytdl="youtube-dl -f bestvideo+bestaudio"
alias ytmp3="youtube-dl -f bestaudio -x --audio-format mp3 --audio-quality 320K" alias ytmp3="youtube-dl -f bestaudio -x --audio-format mp3 --audio-quality 320K"
# Hugo: build & install from source as `hugo-dev`
make_hugo() {
if [[ ! -d "$GOPATH"/src/github.com/gohugoio/hugo ]]; then
mkdir -p "$GOPATH"/src/github.com/gohugoio/hugo
git clone https://github.com/gohugoio/hugo.git "$GOPATH"/src/github.com/gohugoio/hugo
fi
if ! command -v mage &>/dev/null; then
go install github.com/magefile/mage@latest
fi
# parentheses lets us cd to Hugo path without changing our current location
(
cd "$GOPATH"/src/github.com/gohugoio/hugo \
&& "$GOPATH"/bin/hugo-dev env 2>/dev/null || true \
&& git checkout master \
&& mage uninstall \
&& git pull origin master \
&& git reset --hard HEAD \
&& mage -v hugo \
&& HUGO_BUILD_TAGS=extended mage -v install \
&& mv -fv "$GOPATH"/bin/hugo "$GOPATH"/bin/hugo-dev \
&& "$GOPATH"/bin/hugo-dev env
)
}
# run `hugo config` first to make sure we're in a Hugo directory:
alias hugo_clean="hugo config 1>/dev/null && rm -rf public/ resources/ build/"
# misc. # misc.
alias screenfetch="neofetch" alias screenfetch="neofetch"
alias weather="curl 'https://wttr.in/?format=v2'" alias weather="curl 'https://wttr.in/?format=v2'"

View File

@ -1,10 +1,18 @@
#!/usr/bin/env zsh
autoload -U colors && colors autoload -U colors && colors
autoload -Uz url-quote-magic autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic zle -N self-insert url-quote-magic
autoload -Uz select-word-style autoload -Uz select-word-style
select-word-style shell select-word-style bash
# enable bash-like 'help' command for zsh:
# https://stackoverflow.com/questions/4405382/how-can-i-read-documentation-about-built-in-zsh-commands
unalias run-help 2>/dev/null
autoload run-help
alias help=run-help
# --- # ---
@ -42,7 +50,7 @@ export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
export HISTFILE=~/.zsh_history export HISTFILE="${HISTFILE:-$HOME/.zsh_history}"
export HISTSIZE=10000 export HISTSIZE=10000
export SAVEHIST=10000 export SAVEHIST=10000

View File

@ -1,3 +1,5 @@
#!/usr/bin/env zsh
export HOMEBREW_NO_ANALYTICS=1 export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSECURE_REDIRECT=1 export HOMEBREW_NO_INSECURE_REDIRECT=1
# export HOMEBREW_CASK_OPTS=--require-sha # export HOMEBREW_CASK_OPTS=--require-sha

View File

@ -1,3 +1,5 @@
#!/usr/bin/env zsh
# Make a new directory and `cd` right into it (this seems like a no-brainer) # Make a new directory and `cd` right into it (this seems like a no-brainer)
mkcd() { mkcd() {
mkdir -p -- "$1" && mkdir -p -- "$1" &&

View File

@ -1,27 +1,17 @@
# all of this is only for macOS #!/usr/bin/env zsh
if [[ ! "$(uname)" = "Darwin" ]]; then
return
fi
# export BROWSER="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
export BROWSER="/Applications/Firefox.app/Contents/MacOS/firefox" export BROWSER="/Applications/Firefox.app/Contents/MacOS/firefox"
# export BROWSER="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# Rosetta hacks for M1 # Rosetta hacks for M1
alias intel="arch -x86_64 /bin/zsh" alias intel="arch -x86_64 /bin/zsh"
alias arm="arch -arm64 zsh" alias arm="arch -arm64 zsh"
# check & install updates for:
# - brew
# - node/npm
# - ruby/gems
# - pip
# - app store
# - macos
# - zinit
system_update() { system_update() {
NC="\033[0m" local NC="\033[0m"
YELLOW="\033[0;33m" local YELLOW="\033[0;33m"
# homebrew
echo -e "${YELLOW}Updating Homebrew formulae and casks...${NC}" echo -e "${YELLOW}Updating Homebrew formulae and casks...${NC}"
brew update brew update
brew upgrade brew upgrade
@ -30,13 +20,15 @@ system_update() {
brew upgrade $(brew outdated --greedy --verbose | awk '$2 !~ /(latest)/ {print $1}') brew upgrade $(brew outdated --greedy --verbose | awk '$2 !~ /(latest)/ {print $1}')
brew cleanup brew cleanup
# node, npm, yarn
echo -e "${YELLOW}Updating global NPM/Yarn packages...${NC}" echo -e "${YELLOW}Updating global NPM/Yarn packages...${NC}"
volta fetch node@latest volta fetch node@latest # pull latest non-LTS version but don't use it
volta install node@lts volta install node@lts
volta install yarn@1 volta install yarn@1
volta run --node lts --no-yarn -- npm update --global volta run --node lts --no-yarn -- npm update --global
volta run --node lts --yarn 1 -- yarn global upgrade volta run --node lts --yarn 1 -- yarn global upgrade
# ruby, gems
echo -e "${YELLOW}Updating Ruby and gems...${NC}" echo -e "${YELLOW}Updating Ruby and gems...${NC}"
CONFIGURE_OPTS="$RUBY_CONFIGURE_OPTS" \ CONFIGURE_OPTS="$RUBY_CONFIGURE_OPTS" \
rbenv install --skip-existing "$(rbenv install -l | grep -v - | tail -1)" && \ rbenv install --skip-existing "$(rbenv install -l | grep -v - | tail -1)" && \
@ -46,16 +38,20 @@ system_update() {
gem cleanup gem cleanup
rbenv rehash rbenv rehash
# pips
# https://stackoverflow.com/a/3452888 # https://stackoverflow.com/a/3452888
echo -e "${YELLOW}Updating pip packages...${NC}" echo -e "${YELLOW}Updating pip packages...${NC}"
pip3 list --outdated --format=json | jq -r '.[] | .name+"="+.latest_version' | cut -d = -f 1 | xargs -n1 pip3 install -U pip3 list --outdated --format=json | jq -r '.[] | .name+"="+.latest_version' | cut -d = -f 1 | xargs -n1 pip3 install -U
# App Store
echo -e "${YELLOW}Checking for App Store updates...${NC}" echo -e "${YELLOW}Checking for App Store updates...${NC}"
mas outdated mas outdated
# macOS system
echo -e "${YELLOW}Checking for macOS system updates...${NC}" echo -e "${YELLOW}Checking for macOS system updates...${NC}"
softwareupdate --list softwareupdate --list
# zinit & plugins
echo -e "${YELLOW}Updating zinit...${NC}" echo -e "${YELLOW}Updating zinit...${NC}"
zinit self-update zinit self-update
zinit update --all zinit update --all
@ -63,9 +59,8 @@ system_update() {
alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias forcetrash="sudo rm -rf ~/.Trash /Volumes/*/.Trashes" alias force_empty="sudo rm -rf ~/.Trash /Volumes/*/.Trashes"
alias unq="sudo xattr -rd com.apple.quarantine" alias unq="sudo xattr -rd com.apple.quarantine"
alias verify_sign="codesign --verify --deep --verbose"
alias gpu="system_profiler SPDisplaysDataType" alias gpu="system_profiler SPDisplaysDataType"
alias cpu="sysctl -n machdep.cpu.brand_string" alias cpu="sysctl -n machdep.cpu.brand_string"
@ -84,13 +79,14 @@ alias dns-set-cloudflare="dns-set 1.1.1.1 1.0.0.1"
alias dns-set-google="dns-set 8.8.8.8 8.8.4.4" alias dns-set-google="dns-set 8.8.8.8 8.8.4.4"
alias flush="sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache" alias flush="sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache"
# uncomment to use VS Code insiders build
# alias code="code-insiders"
alias vs="code ."
# Xcode simulators # Xcode simulators
alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" alias ios_sim="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app" alias watchos_sim="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app"
alias firefox="/Applications/Firefox.app/Contents/MacOS/firefox-bin" # convenient access to public key
alias ff="firefox" alias pubkey="pbcopy < ~/.ssh/id_ed25519.pub && echo '=> Public key copied to clipboard.'"
alias pubkey_rsa="pbcopy < ~/.ssh/id_rsa.pub && echo '=> Public key copied to clipboard.'"
# workaround for lack of tailscale CLI on mac:
# https://tailscale.com/kb/1080/cli/?tab=macos#using-the-cli
alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"

View File

@ -1,49 +1,76 @@
# a lot of this file only applies to macOS #!/usr/bin/env zsh
if [[ "$(uname)" = "Darwin" ]]; then
# set PATH, MANPATH, etc., for Homebrew
eval "$(/opt/homebrew/bin/brew shellenv)"
# set PATH, MANPATH, etc., for Homebrew
if [[ -x /opt/homebrew/bin/brew ]]; then
# macOS on Apple Silicon
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -x /usr/local/bin/brew ]]; then
# macOS on x86
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -d /home/linuxbrew/.linuxbrew ]]; then
# Linux, system install
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
elif [[ -d "$HOME/.linuxbrew" ]]; then
# Linux, user install
eval "$("$HOME/.linuxbrew/bin/brew" shellenv)"
fi
# a lot of this file only applies to macOS
if [[ "$OSTYPE" = "darwin"* ]]; then
# remap macOS core utils to GNU equivalents (from coreutils, findutils, gnu-*, etc.): # remap macOS core utils to GNU equivalents (from coreutils, findutils, gnu-*, etc.):
# https://gist.github.com/skyzyx/3438280b18e4f7c490db8a2a2ca0b9da?permalink_comment_id=3049694#gistcomment-3049694 # https://gist.github.com/skyzyx/3438280b18e4f7c490db8a2a2ca0b9da?permalink_comment_id=3049694#gistcomment-3049694
for gbin in "$(brew --prefix)"/opt/*/libexec/gnubin; do if command -v brew &>/dev/null; then
export PATH="$gbin:$PATH" for gbin in "$(brew --prefix)"/opt/*/libexec/gnubin; do
done export PATH="$gbin:$PATH"
# Ensure `man` refers to the new binaries: done
for gman in "$(brew --prefix)"/opt/*/libexec/gnuman; do # Ensure `man` refers to the new binaries:
export MANPATH="$gman:$MANPATH" for gman in "$(brew --prefix)"/opt/*/libexec/gnuman; do
done export MANPATH="$gman:$MANPATH"
unset gbin gman done
unset gbin gman
# OpenJDK # shellcheck disable=SC2155
export PATH="$HOMEBREW_PREFIX/opt/openjdk/bin:$PATH" export HELPDIR="$(brew --prefix)/share/zsh/help"
# metasploit # OpenJDK
export PATH="/opt/metasploit-framework/bin:$PATH" # shellcheck disable=SC2155
export PATH="$(brew --prefix)/opt/openjdk/bin:$PATH"
# macOS-only fixes for rbenv/ruby below # macOS-only fixes for rbenv/ruby below
# shellcheck disable=SC2155 # shellcheck disable=SC2155
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml)" export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml) --with-jemalloc-dir=$(brew --prefix jemalloc)"
# tell compilers where to find all of this stuff
# shellcheck disable=SC2155
export LDFLAGS="$LDFLAGS -L$(brew --prefix openssl@1.1)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix jemalloc)/lib"
# shellcheck disable=SC2155
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix openjdk)/include -I$(brew --prefix openssl@1.1)/include -I$(brew --prefix readline)/include -I$(brew --prefix jemalloc)/include"
fi
fi fi
# go # go
export GOPATH="$HOME/golang" if [[ -d "$HOME/golang" ]]; then
export PATH="$GOPATH/bin:$PATH" export GOPATH="$HOME/golang"
export PATH="$GOPATH/bin:$PATH"
# rbenv
if command -v rbenv 1>/dev/null 2>&1; then
eval "$(rbenv init -)"
fi fi
# rust/cargo # rust/cargo
export PATH="$HOME/.cargo/bin:$PATH" if [[ -d "$HOME/.cargo" ]]; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
# rbenv
if command -v rbenv &>/dev/null; then
eval "$(rbenv init --no-rehash - zsh)"
fi
# pyenv # pyenv
export PYENV_ROOT="$HOME/.pyenv" if command -v pyenv &>/dev/null; then
export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --no-rehash - zsh)"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi fi
# volta # volta
export VOLTA_HOME="$HOME/.volta" if [[ -d "$HOME/.volta" ]]; then
export PATH="$VOLTA_HOME/bin:$PATH" export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
fi

View File

@ -1,3 +1,5 @@
#!/usr/bin/env zsh
# check for zinit and clone if not installed # check for zinit and clone if not installed
ZINIT_HOME="$HOME/.local/share/zinit/zinit.git" ZINIT_HOME="$HOME/.local/share/zinit/zinit.git"
if [[ ! -d "$ZINIT_HOME" ]]; then if [[ ! -d "$ZINIT_HOME" ]]; then
@ -57,9 +59,26 @@ zinit ice from"gh-r" as"command" \
mv -vf bat-*/bat.1 ${ZINIT[MAN_DIR]}/man1 mv -vf bat-*/bat.1 ${ZINIT[MAN_DIR]}/man1
" \ " \
atpull"%atclone" \ atpull"%atclone" \
atload"alias cat='bat --paging=never --color=auto --style=\"numbers,changes\" --theme=\"Dracula\"'" atload"
export BAT_THEME='base16'
export BAT_PAGER='less -R -F -+X --mouse'
export MANPAGER='sh -c \"col -bx | bat --color=always --style=plain --language=man\"'
alias cat='bat --paging=never --color=auto --style=numbers,changes'
alias cats='bat --paging=always --color=always --style=numbers,changes'
alias catcat='\cat --paging=never --color=auto --style=plain'
"
zinit light sharkdp/bat zinit light sharkdp/bat
# grab delta binary
zinit ice from"gh-r" as"command" \
mv"delta-*/delta -> delta" \
dl"https://github.com/dandavison/delta/raw/HEAD/etc/completion/completion.zsh -> _delta" \
atload"
# https://dandavison.github.io/delta/mouse-scrolling.html
export DELTA_PAGER='less -R -F -+X --mouse'
"
zinit light dandavison/delta
# grab fd binary # grab fd binary
# TODO: preview commands are an absolute sh*tshow, maybe use .lessfilter? # TODO: preview commands are an absolute sh*tshow, maybe use .lessfilter?
# https://github.com/Aloxaf/fzf-tab/wiki/Preview#show-file-contents # https://github.com/Aloxaf/fzf-tab/wiki/Preview#show-file-contents
@ -73,7 +92,7 @@ zinit ice from"gh-r" as"command" \
atpull"%atclone" \ atpull"%atclone" \
atload' atload'
FZF_FD_OPTS="--color always --hidden --follow --exclude .git --exclude node_modules" FZF_FD_OPTS="--color always --hidden --follow --exclude .git --exclude node_modules"
FZF_PREVIEW_FILE_COMMAND="bat --color=always --paging=never --style=plain --theme=Dracula" FZF_PREVIEW_FILE_COMMAND="bat --color=always --paging=never --style=plain"
FZF_PREVIEW_DIR_COMMAND="exa -1a --color=always --icons --group-directories-first" FZF_PREVIEW_DIR_COMMAND="exa -1a --color=always --icons --group-directories-first"
FZF_DEFAULT_OPTS="--no-mouse --bind \"tab:accept,ctrl-y:preview-page-up,ctrl-v:preview-page-down,ctrl-e:execute-silent(\${VISUAL:-code} {+} >/dev/null 2>&1)\"" FZF_DEFAULT_OPTS="--no-mouse --bind \"tab:accept,ctrl-y:preview-page-up,ctrl-v:preview-page-down,ctrl-e:execute-silent(\${VISUAL:-code} {+} >/dev/null 2>&1)\""
FZF_DEFAULT_COMMAND="fd --type f $FZF_FD_OPTS" FZF_DEFAULT_COMMAND="fd --type f $FZF_FD_OPTS"
@ -86,14 +105,14 @@ zinit light sharkdp/fd
# grab fzf binary from release & other files from source # grab fzf binary from release & other files from source
zinit ice from"gh-r" as"command" \ zinit ice from"gh-r" as"command" \
dl"https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh -> key-bindings.zsh" \ dl"https://github.com/junegunn/fzf/raw/HEAD/shell/key-bindings.zsh -> key-bindings.zsh" \
dl"https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.zsh -> _fzf" \ dl"https://github.com/junegunn/fzf/raw/HEAD/shell/completion.zsh -> _fzf" \
dl"https://raw.githubusercontent.com/junegunn/fzf/master/man/man1/fzf.1 -> ${ZINIT[MAN_DIR]}/man1/fzf.1" \ dl"https://github.com/junegunn/fzf/raw/HEAD/man/man1/fzf.1 -> ${ZINIT[MAN_DIR]}/man1/fzf.1" \
dl"https://raw.githubusercontent.com/junegunn/fzf/master/man/man1/fzf-tmux.1 -> ${ZINIT[MAN_DIR]}/man1/fzf-tmux.1" \ dl"https://github.com/junegunn/fzf/raw/HEAD/man/man1/fzf-tmux.1 -> ${ZINIT[MAN_DIR]}/man1/fzf-tmux.1" \
src"key-bindings.zsh" src"key-bindings.zsh"
zinit light junegunn/fzf zinit light junegunn/fzf
# all the colors # grab vivid binary (for all the colors)
# https://github.com/sharkdp/vivid/tree/master/themes # https://github.com/sharkdp/vivid/tree/master/themes
# shellcheck disable=SC2016 # shellcheck disable=SC2016
zinit ice from"gh-r" as"command" \ zinit ice from"gh-r" as"command" \
@ -101,14 +120,6 @@ zinit ice from"gh-r" as"command" \
atload'export LS_COLORS="$(vivid generate snazzy)"' atload'export LS_COLORS="$(vivid generate snazzy)"'
zinit load sharkdp/vivid zinit load sharkdp/vivid
# direnv
zinit ice from"gh-r" as"command" \
mv"direnv* -> direnv" \
atclone"./direnv hook zsh > zhook.zsh" \
atpull"%atclone" \
src"zhook.zsh"
zinit light direnv/direnv
# history substring searching # history substring searching
# only bind these keys once they're ready # only bind these keys once they're ready
bindkey -r "^[[A" bindkey -r "^[[A"
@ -122,9 +133,8 @@ zinit ice wait lucid \
zinit light zsh-users/zsh-history-substring-search zinit light zsh-users/zsh-history-substring-search
# tab completions via fzf # tab completions via fzf
# TODO: fix git-* completions, apparently there's some conflict with brew's git zinit ice wait"1" lucid \
# https://github.com/Aloxaf/fzf-tab/wiki/Preview#git has"fzf" \
zinit ice wait lucid \
atload" atload"
zstyle ':completion:*' verbose yes zstyle ':completion:*' verbose yes
zstyle ':completion:*' list-colors \${(s.:.)LS_COLORS} zstyle ':completion:*' list-colors \${(s.:.)LS_COLORS}
@ -133,19 +143,20 @@ zinit ice wait lucid \
zstyle ':completion::complete:*:*:globbed-files' ignored-patterns '.DS_Store' 'Icon?' '.Trash' zstyle ':completion::complete:*:*:globbed-files' ignored-patterns '.DS_Store' 'Icon?' '.Trash'
zstyle ':completion::complete:rm:*:globbed-files' ignored-patterns zstyle ':completion::complete:rm:*:globbed-files' ignored-patterns
zstyle ':fzf-tab:*' fzf-command fzf zstyle ':fzf-tab:*' fzf-command fzf
zstyle ':fzf-tab:*' fzf-flags '--ansi'
zstyle ':fzf-tab:*' fzf-bindings \ zstyle ':fzf-tab:*' fzf-bindings \
'tab:accept' \ 'tab:accept' \
'ctrl-y:preview-page-up' \ 'ctrl-y:preview-page-up' \
'ctrl-v:preview-page-down' \ 'ctrl-v:preview-page-down' \
'ctrl-e:execute-silent(${VISUAL:-code} \${realpath:-\$word} >/dev/null 2>&1)' \ 'ctrl-e:execute-silent(\${VISUAL:-code} \$realpath >/dev/null 2>&1)' \
'ctrl-w:execute(${EDITOR:-nano} \${realpath:-\$word} >/dev/tty </dev/tty)+refresh-preview' 'ctrl-w:execute(\${EDITOR:-nano} \$realpath >/dev/tty </dev/tty)+refresh-preview'
zstyle ':fzf-tab:*' fzf-min-height 15 zstyle ':fzf-tab:*' fzf-min-height 15
zstyle ':fzf-tab:complete:git-(add|diff|restore):*' fzf-preview \ zstyle ':fzf-tab:complete:git-(add|diff|restore):*' fzf-preview \
'git --no-pager diff --color=always --no-ext-diff \${realpath:-\$word} | delta' 'git diff --no-ext-diff \$word | delta --paging=never --no-gitconfig --line-numbers --file-style=omit --hunk-header-style=omit --theme=base16'
zstyle ':fzf-tab:complete:git-log:*' fzf-preview \ zstyle ':fzf-tab:complete:git-log:*' fzf-preview \
'git --no-pager log --color=always --format=oneline --abbrev-commit --follow \${realpath:-\$word}' 'git --no-pager log --color=always --format=oneline --abbrev-commit --follow \$word'
zstyle ':fzf-tab:complete:man:*' fzf-preview \ zstyle ':fzf-tab:complete:man:*' fzf-preview \
'man \$word' 'man -P \"col -bx\" \$word | $FZF_PREVIEW_FILE_COMMAND --language=man'
zstyle ':fzf-tab:complete:brew-(install|uninstall|search|info):*-argument-rest' fzf-preview \ zstyle ':fzf-tab:complete:brew-(install|uninstall|search|info):*-argument-rest' fzf-preview \
'brew info \$word' 'brew info \$word'
zstyle ':fzf-tab:complete:(-command-|-parameter-|-brace-parameter-|export|unset|expand):*' fzf-preview \ zstyle ':fzf-tab:complete:(-command-|-parameter-|-brace-parameter-|export|unset|expand):*' fzf-preview \
@ -159,21 +170,68 @@ zinit ice wait lucid \
" "
zinit light Aloxaf/fzf-tab zinit light Aloxaf/fzf-tab
# TODO: fix git-* completions, apparently there's some conflict with brew's git
# https://github.com/Aloxaf/fzf-tab/wiki/Preview#git
# shellcheck disable=SC2016
zinit ice wait lucid as"completions" \
id-as"git-completions" \
has"git" \
dl"https://github.com/git/git/raw/HEAD/contrib/completion/git-completion.zsh -> _git" \
dl"https://github.com/git/git/raw/HEAD/contrib/completion/git-completion.bash -> git-completion.bash" \
atpull"zinit creinstall -q ." \
atload'
zstyle ":completion:*:*:git:*" script "$PWD/git-completion.bash"
' \
nocompile
zinit light zdharma-continuum/null
# use zinit to track completions from non-zinit programs
zinit ice wait lucid blockf as"completions" \
id-as"local-completions" \
dl"https://github.com/docker/cli/raw/HEAD/contrib/completion/zsh/_docker -> _docker" \
dl"https://github.com/docker/compose/raw/master/contrib/completion/zsh/_docker-compose -> _docker-compose" \
dl"https://github.com/zsh-users/zsh-completions/raw/HEAD/src/_node -> _node" \
dl"https://github.com/zsh-users/zsh-completions/raw/HEAD/src/_yarn -> _yarn" \
dl"https://github.com/zsh-users/zsh-completions/raw/HEAD/src/_bundle -> _bundle" \
dl"https://github.com/zsh-users/zsh-completions/raw/HEAD/src/_rails -> _rails" \
dl"https://github.com/zsh-users/zsh-completions/raw/HEAD/src/_golang -> _golang" \
dl"https://github.com/zsh-users/zsh-completions/raw/HEAD/src/_shellcheck -> _shellcheck" \
dl"https://github.com/zsh-users/zsh-completions/raw/HEAD/src/_httpie -> _httpie" \
dl"https://github.com/rbenv/rbenv/raw/HEAD/completions/rbenv.zsh -> _rbenv" \
dl"https://github.com/pyenv/pyenv/raw/HEAD/completions/pyenv.zsh -> _pyenv" \
atclone"
command -v volta &>/dev/null && volta completions zsh > _volta || true
command -v npm &>/dev/null && npm completion > _npm || true
command -v gh &>/dev/null && gh completion -s zsh > _gh || true
command -v op &>/dev/null && op completion zsh > _op || true
command -v hugo &>/dev/null && hugo completion zsh > _hugo || true
" \
atpull"zinit creinstall -q ." \
nocompile
zinit light zdharma-continuum/null
# additional completions
# zinit ice wait lucid blockf as"completion" \
# atpull"zinit creinstall -q ."
# zinit light zsh-users/zsh-completions
# autosuggestions, trigger precmd hook upon load # autosuggestions, trigger precmd hook upon load
zinit ice wait lucid \ zinit ice wait lucid \
atload"_zsh_autosuggest_start" atload"_zsh_autosuggest_start"
zinit light zsh-users/zsh-autosuggestions zinit light zsh-users/zsh-autosuggestions
# additional completions
zinit ice wait lucid blockf as"completion" \
atpull"zinit creinstall -q ."
zinit light zsh-users/zsh-completions
# syntax highlighting # syntax highlighting
zinit ice wait lucid \ zinit ice wait lucid \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay"
zinit light zsh-users/zsh-syntax-highlighting zinit light zsh-users/zsh-syntax-highlighting
# 1Password plugins: https://developer.1password.com/docs/cli/shell-plugins/
zinit ice wait lucid \
id-as"op-plugins" \
has"op" \
if"[[ -f ~/.config/op/plugins.sh ]]"
zinit snippet ~/.config/op/plugins.sh
# oh-my-zsh leftovers # oh-my-zsh leftovers
# https://github.com/ohmyzsh/ohmyzsh/tree/master/lib # https://github.com/ohmyzsh/ohmyzsh/tree/master/lib
zinit snippet OMZ::lib/clipboard.zsh zinit snippet OMZ::lib/clipboard.zsh
@ -187,16 +245,10 @@ zinit ice lucid \
sbin"utilities/*" sbin"utilities/*"
zinit light gnachman/iTerm2-shell-integration zinit light gnachman/iTerm2-shell-integration
# 1Password plugins: https://developer.1password.com/docs/cli/shell-plugins/
zinit ice \
if"command -v op &>/dev/null" \
atclone"op completion zsh > _op || true"
zinit snippet ~/.config/op/plugins.sh
# starship prompt # starship prompt
zinit ice from"gh-r" as"command" \ zinit ice from"gh-r" as"command" \
atclone" atclone"
./starship init zsh > init.zsh ./starship init zsh --print-full-init > init.zsh
./starship completions zsh > _starship ./starship completions zsh > _starship
" \ " \
atpull"%atclone" \ atpull"%atclone" \