mirror of
https://github.com/jakejarvis/dotfiles.git
synced 2025-09-15 23:15:30 -04:00
support all debian-based machines, not just codespaces
This commit is contained in:
@@ -0,0 +1 @@
|
||||
# Intentionally left blank.
|
||||
|
@@ -1,14 +1,21 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# path to this directory:
|
||||
export ZSH_CUSTOM=~/.dotfiles/zsh
|
||||
|
||||
# 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
|
||||
source "$_dotzsh"
|
||||
fi
|
||||
done
|
||||
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
|
||||
source ~/.zshrc.local
|
||||
fi
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# allow sudo-able aliases
|
||||
alias sudo="sudo "
|
||||
|
||||
@@ -22,6 +24,7 @@ alias gpom="git push origin main"
|
||||
alias glom="git pull origin main"
|
||||
alias gpo="git push 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 gbn="git checkout -b" # + new branch name
|
||||
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_yarn="rm -rf node_modules yarn.lock && yarn install"
|
||||
|
||||
# Hugo
|
||||
# install from source
|
||||
make_hugo() {
|
||||
# parentheses lets us cd to Hugo path without changing our current location
|
||||
(
|
||||
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/"
|
||||
# uncomment to use VS Code insiders build
|
||||
# alias code="code-insiders"
|
||||
# open current working directory in VS Code
|
||||
alias vs="code ."
|
||||
|
||||
# an original creation, see https://github.com/jakejarvis/simpip
|
||||
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 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
|
||||
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 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.
|
||||
alias screenfetch="neofetch"
|
||||
alias weather="curl 'https://wttr.in/?format=v2'"
|
||||
|
@@ -1,10 +1,18 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
autoload -U colors && colors
|
||||
|
||||
autoload -Uz url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
|
||||
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_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
|
||||
export HISTFILE=~/.zsh_history
|
||||
export HISTFILE="${HISTFILE:-$HOME/.zsh_history}"
|
||||
export HISTSIZE=10000
|
||||
export SAVEHIST=10000
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
export HOMEBREW_NO_ANALYTICS=1
|
||||
export HOMEBREW_NO_INSECURE_REDIRECT=1
|
||||
# export HOMEBREW_CASK_OPTS=--require-sha
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Make a new directory and `cd` right into it (this seems like a no-brainer)
|
||||
mkcd() {
|
||||
mkdir -p -- "$1" &&
|
||||
|
@@ -1,27 +1,17 @@
|
||||
# all of this is only for macOS
|
||||
if [[ ! "$(uname)" = "Darwin" ]]; then
|
||||
return
|
||||
fi
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# export BROWSER="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
|
||||
export BROWSER="/Applications/Firefox.app/Contents/MacOS/firefox"
|
||||
# export BROWSER="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
|
||||
|
||||
# Rosetta hacks for M1
|
||||
alias intel="arch -x86_64 /bin/zsh"
|
||||
alias arm="arch -arm64 zsh"
|
||||
|
||||
# check & install updates for:
|
||||
# - brew
|
||||
# - node/npm
|
||||
# - ruby/gems
|
||||
# - pip
|
||||
# - app store
|
||||
# - macos
|
||||
# - zinit
|
||||
system_update() {
|
||||
NC="\033[0m"
|
||||
YELLOW="\033[0;33m"
|
||||
local NC="\033[0m"
|
||||
local YELLOW="\033[0;33m"
|
||||
|
||||
# homebrew
|
||||
echo -e "${YELLOW}Updating Homebrew formulae and casks...${NC}"
|
||||
brew update
|
||||
brew upgrade
|
||||
@@ -30,13 +20,15 @@ system_update() {
|
||||
brew upgrade $(brew outdated --greedy --verbose | awk '$2 !~ /(latest)/ {print $1}')
|
||||
brew cleanup
|
||||
|
||||
# node, npm, yarn
|
||||
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 yarn@1
|
||||
volta run --node lts --no-yarn -- npm update --global
|
||||
volta run --node lts --yarn 1 -- yarn global upgrade
|
||||
|
||||
# ruby, gems
|
||||
echo -e "${YELLOW}Updating Ruby and gems...${NC}"
|
||||
CONFIGURE_OPTS="$RUBY_CONFIGURE_OPTS" \
|
||||
rbenv install --skip-existing "$(rbenv install -l | grep -v - | tail -1)" && \
|
||||
@@ -46,16 +38,20 @@ system_update() {
|
||||
gem cleanup
|
||||
rbenv rehash
|
||||
|
||||
# pips
|
||||
# https://stackoverflow.com/a/3452888
|
||||
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
|
||||
|
||||
# App Store
|
||||
echo -e "${YELLOW}Checking for App Store updates...${NC}"
|
||||
mas outdated
|
||||
|
||||
# macOS system
|
||||
echo -e "${YELLOW}Checking for macOS system updates...${NC}"
|
||||
softwareupdate --list
|
||||
|
||||
# zinit & plugins
|
||||
echo -e "${YELLOW}Updating zinit...${NC}"
|
||||
zinit self-update
|
||||
zinit update --all
|
||||
@@ -63,9 +59,8 @@ system_update() {
|
||||
|
||||
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 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 verify_sign="codesign --verify --deep --verbose"
|
||||
|
||||
alias gpu="system_profiler SPDisplaysDataType"
|
||||
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 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
|
||||
alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
|
||||
alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app"
|
||||
alias ios_sim="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
|
||||
alias watchos_sim="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app"
|
||||
|
||||
alias firefox="/Applications/Firefox.app/Contents/MacOS/firefox-bin"
|
||||
alias ff="firefox"
|
||||
# convenient access to public key
|
||||
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"
|
||||
|
@@ -1,49 +1,76 @@
|
||||
# a lot of this file only applies to macOS
|
||||
if [[ "$(uname)" = "Darwin" ]]; then
|
||||
# set PATH, MANPATH, etc., for Homebrew
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# 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.):
|
||||
# https://gist.github.com/skyzyx/3438280b18e4f7c490db8a2a2ca0b9da?permalink_comment_id=3049694#gistcomment-3049694
|
||||
for gbin in "$(brew --prefix)"/opt/*/libexec/gnubin; do
|
||||
export PATH="$gbin:$PATH"
|
||||
done
|
||||
# Ensure `man` refers to the new binaries:
|
||||
for gman in "$(brew --prefix)"/opt/*/libexec/gnuman; do
|
||||
export MANPATH="$gman:$MANPATH"
|
||||
done
|
||||
unset gbin gman
|
||||
if command -v brew &>/dev/null; then
|
||||
for gbin in "$(brew --prefix)"/opt/*/libexec/gnubin; do
|
||||
export PATH="$gbin:$PATH"
|
||||
done
|
||||
# Ensure `man` refers to the new binaries:
|
||||
for gman in "$(brew --prefix)"/opt/*/libexec/gnuman; do
|
||||
export MANPATH="$gman:$MANPATH"
|
||||
done
|
||||
unset gbin gman
|
||||
|
||||
# OpenJDK
|
||||
export PATH="$HOMEBREW_PREFIX/opt/openjdk/bin:$PATH"
|
||||
# shellcheck disable=SC2155
|
||||
export HELPDIR="$(brew --prefix)/share/zsh/help"
|
||||
|
||||
# metasploit
|
||||
export PATH="/opt/metasploit-framework/bin:$PATH"
|
||||
# OpenJDK
|
||||
# shellcheck disable=SC2155
|
||||
export PATH="$(brew --prefix)/opt/openjdk/bin:$PATH"
|
||||
|
||||
# macOS-only fixes for rbenv/ruby below
|
||||
# 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)"
|
||||
# macOS-only fixes for rbenv/ruby below
|
||||
# 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) --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
|
||||
|
||||
# go
|
||||
export GOPATH="$HOME/golang"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
|
||||
# rbenv
|
||||
if command -v rbenv 1>/dev/null 2>&1; then
|
||||
eval "$(rbenv init -)"
|
||||
if [[ -d "$HOME/golang" ]]; then
|
||||
export GOPATH="$HOME/golang"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
fi
|
||||
|
||||
# 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
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
if command -v pyenv 1>/dev/null 2>&1; then
|
||||
eval "$(pyenv init -)"
|
||||
if command -v pyenv &>/dev/null; then
|
||||
eval "$(pyenv init --no-rehash - zsh)"
|
||||
fi
|
||||
|
||||
# volta
|
||||
export VOLTA_HOME="$HOME/.volta"
|
||||
export PATH="$VOLTA_HOME/bin:$PATH"
|
||||
if [[ -d "$HOME/.volta" ]]; then
|
||||
export VOLTA_HOME="$HOME/.volta"
|
||||
export PATH="$VOLTA_HOME/bin:$PATH"
|
||||
fi
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# check for zinit and clone if not installed
|
||||
ZINIT_HOME="$HOME/.local/share/zinit/zinit.git"
|
||||
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
|
||||
" \
|
||||
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
|
||||
|
||||
# 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
|
||||
# TODO: preview commands are an absolute sh*tshow, maybe use .lessfilter?
|
||||
# https://github.com/Aloxaf/fzf-tab/wiki/Preview#show-file-contents
|
||||
@@ -73,7 +92,7 @@ zinit ice from"gh-r" as"command" \
|
||||
atpull"%atclone" \
|
||||
atload'
|
||||
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_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"
|
||||
@@ -86,14 +105,14 @@ zinit light sharkdp/fd
|
||||
|
||||
# grab fzf binary from release & other files from source
|
||||
zinit ice from"gh-r" as"command" \
|
||||
dl"https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh -> key-bindings.zsh" \
|
||||
dl"https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.zsh -> _fzf" \
|
||||
dl"https://raw.githubusercontent.com/junegunn/fzf/master/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/shell/key-bindings.zsh -> key-bindings.zsh" \
|
||||
dl"https://github.com/junegunn/fzf/raw/HEAD/shell/completion.zsh -> _fzf" \
|
||||
dl"https://github.com/junegunn/fzf/raw/HEAD/man/man1/fzf.1 -> ${ZINIT[MAN_DIR]}/man1/fzf.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"
|
||||
zinit light junegunn/fzf
|
||||
|
||||
# all the colors
|
||||
# grab vivid binary (for all the colors)
|
||||
# https://github.com/sharkdp/vivid/tree/master/themes
|
||||
# shellcheck disable=SC2016
|
||||
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)"'
|
||||
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
|
||||
# only bind these keys once they're ready
|
||||
bindkey -r "^[[A"
|
||||
@@ -122,9 +133,8 @@ zinit ice wait lucid \
|
||||
zinit light zsh-users/zsh-history-substring-search
|
||||
|
||||
# tab completions via fzf
|
||||
# TODO: fix git-* completions, apparently there's some conflict with brew's git
|
||||
# https://github.com/Aloxaf/fzf-tab/wiki/Preview#git
|
||||
zinit ice wait lucid \
|
||||
zinit ice wait"1" lucid \
|
||||
has"fzf" \
|
||||
atload"
|
||||
zstyle ':completion:*' verbose yes
|
||||
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:rm:*:globbed-files' ignored-patterns
|
||||
zstyle ':fzf-tab:*' fzf-command fzf
|
||||
zstyle ':fzf-tab:*' fzf-flags '--ansi'
|
||||
zstyle ':fzf-tab:*' fzf-bindings \
|
||||
'tab:accept' \
|
||||
'ctrl-y:preview-page-up' \
|
||||
'ctrl-v:preview-page-down' \
|
||||
'ctrl-e:execute-silent(${VISUAL:-code} \${realpath:-\$word} >/dev/null 2>&1)' \
|
||||
'ctrl-w:execute(${EDITOR:-nano} \${realpath:-\$word} >/dev/tty </dev/tty)+refresh-preview'
|
||||
'ctrl-e:execute-silent(\${VISUAL:-code} \$realpath >/dev/null 2>&1)' \
|
||||
'ctrl-w:execute(\${EDITOR:-nano} \$realpath >/dev/tty </dev/tty)+refresh-preview'
|
||||
zstyle ':fzf-tab:*' fzf-min-height 15
|
||||
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 \
|
||||
'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 \
|
||||
'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 \
|
||||
'brew info \$word'
|
||||
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
|
||||
|
||||
# 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
|
||||
zinit ice wait lucid \
|
||||
atload"_zsh_autosuggest_start"
|
||||
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
|
||||
zinit ice wait lucid \
|
||||
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay"
|
||||
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
|
||||
# https://github.com/ohmyzsh/ohmyzsh/tree/master/lib
|
||||
zinit snippet OMZ::lib/clipboard.zsh
|
||||
@@ -187,16 +245,10 @@ zinit ice lucid \
|
||||
sbin"utilities/*"
|
||||
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
|
||||
zinit ice from"gh-r" as"command" \
|
||||
atclone"
|
||||
./starship init zsh > init.zsh
|
||||
./starship init zsh --print-full-init > init.zsh
|
||||
./starship completions zsh > _starship
|
||||
" \
|
||||
atpull"%atclone" \
|
||||
|
Reference in New Issue
Block a user