chore: updated zsh for linux
4b73d36e
2 file(s) · +253 −112
| 1 | - | # history setup |
|
| 2 | - | HISTFILE=$HOME/.zhistory |
|
| 3 | - | SAVEHIST=1000 |
|
| 4 | - | HISTSIZE=999 |
|
| 5 | - | setopt share_history |
|
| 6 | - | setopt hist_expire_dups_first |
|
| 7 | - | setopt hist_ignore_dups |
|
| 8 | - | setopt hist_verify |
|
| 9 | - | ||
| 10 | - | # completion using arrow keys (based on history) |
|
| 11 | - | bindkey '^[[A' history-search-backward |
|
| 12 | - | bindkey '^[[B' history-search-forward |
|
| 13 | - | ||
| 14 | - | # completion using vim keys |
|
| 15 | - | bindkey '^k' history-search-backward |
|
| 16 | - | bindkey '^j' history-search-forward |
|
| 17 | - | ||
| 18 | - | bindkey -v |
|
| 19 | - | ||
| 20 | - | source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh |
|
| 21 | - | source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh |
|
| 22 | - | ||
| 23 | - | ns() { |
|
| 24 | - | rm -f ~/.nvim-startup.txt |
|
| 25 | - | nvim --headless --startuptime ~/.nvim-startup.txt +qa |
|
| 26 | - | grep "NVIM STARTED" ~/.nvim-startup.txt |
|
| 27 | - | } |
|
| 28 | - | ||
| 29 | - | nh() { |
|
| 30 | - | rm -f ~/.nvim-startup.txt |
|
| 31 | - | nvim --headless --startuptime ~/.nvim-startup.txt +qa |
|
| 32 | - | bat ~/.nvim-startup.txt |
|
| 33 | - | } |
|
| 34 | - | ||
| 35 | - | alias ls="eza --icons=always" |
|
| 36 | - | alias ll="ls -l" |
|
| 37 | - | alias la="ls -a" |
|
| 38 | - | alias lg="lazygit" |
|
| 39 | - | alias nf="neofetch" |
|
| 40 | - | alias fl="fastfetch -c ~/.config/fastfetch/presets/examples/8.jsonc" |
|
| 41 | - | alias ff="fastfetch -c ~/.config/fastfetch/presets/examples/20.jsonc" |
|
| 42 | - | # alias cd="z" |
|
| 43 | - | alias ai="aichat" |
|
| 44 | - | alias inv='nvim $(fzf -m --preview="bat --color=always {}")' |
|
| 45 | - | ||
| 46 | - | alias gs="git status" |
|
| 47 | - | alias ga="git add ." |
|
| 48 | - | alias gc="git commit" |
|
| 49 | - | alias gd="git diff | delta" |
|
| 50 | - | alias gl="git log --all --graph --pretty=format:'%C(magenta)%h %C(white) %an %ar%C(auto) %D%n%s%n'" |
|
| 51 | - | alias gig="cp ~/.config/git/ignore $(pwd)/.gitignore" |
|
| 52 | - | ||
| 53 | - | gac() { git add . && git commit --message "$*" } |
|
| 54 | - | ||
| 55 | - | ||
| 56 | - | # Exports |
|
| 57 | - | export BAT_THEME="ansi" |
|
| 58 | - | export GOROOT="/usr/local/go" |
|
| 59 | - | export GOPATH="$HOME/.local/share/go" |
|
| 60 | - | export GOMODCACHE="$HOME/.local/share/go-mod-cache" |
|
| 61 | - | ||
| 62 | - | # PATH Configuration - Readable format with comments |
|
| 63 | - | # Homebrew |
|
| 64 | - | export PATH="$PATH:/opt/homebrew/bin" |
|
| 65 | - | export PATH="$PATH:$HOME/.local/share" |
|
| 66 | - | ||
| 67 | - | # Go language |
|
| 68 | - | export PATH="$PATH:/usr/local/go/bin" |
|
| 69 | - | export PATH="$PATH:$HOME/.local/share/go/bin" |
|
| 70 | - | ||
| 71 | - | # Rust |
|
| 72 | - | export PATH="$PATH:$HOME/.cargo/bin" |
|
| 73 | - | ||
| 74 | - | # Standard user binaries |
|
| 75 | - | export PATH="$PATH:$HOME/.local/bin" |
|
| 76 | - | export PATH="$PATH:/usr/local/bin" |
|
| 77 | - | ||
| 78 | - | # JavaScript/Node.js tools |
|
| 79 | - | export PATH="$PATH:$HOME/.bun/bin" |
|
| 80 | - | ||
| 81 | - | # Docker |
|
| 82 | - | export PATH="$PATH:/Applications/Docker.app/Contents/Resources/bin" |
|
| 83 | - | ||
| 84 | - | # Terminal/Shell tools |
|
| 85 | - | export PATH="$PATH:$HOME/.tmux/plugins/t-smart-tmux-session-manager/bin" |
|
| 86 | - | ||
| 87 | - | # Blockchain/Web3 tools |
|
| 88 | - | export PATH="$PATH:$HOME/.foundry/bin" |
|
| 89 | - | export PATH="$PATH:$HOME/.local/share/pinata" |
|
| 90 | - | export PATH="$PATH:$HOME/.helios/bin" |
|
| 91 | - | ||
| 92 | - | export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude ".git"' |
|
| 93 | - | export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' |
|
| 94 | - | --color=fg:#c1c1c1,fg+:#ffffff,bg:#121113,bg+:#222222 |
|
| 95 | - | --color=hl:#5f8787,hl+:#fbcb97,info:#e78a53,marker:#fbcb97 |
|
| 96 | - | --color=prompt:#e78a53,spinner:#5f8787,pointer:#fbcb97,header:#aaaaaa |
|
| 97 | - | --color=border:#333333,label:#888888,query:#ffffff |
|
| 98 | - | --border="rounded" --border-label="" --preview-window="border-rounded" --prompt="> " |
|
| 99 | - | --marker=">" --pointer="◆" --separator="─" --scrollbar="│"' |
|
| 100 | - | ||
| 101 | - | eval "$(zoxide init zsh)" |
|
| 102 | - | eval "$(starship init zsh)" |
|
| 103 | - | ||
| 104 | - | # bun completions |
|
| 105 | - | [ -s "/Users/steve-simkins/.bun/_bun" ] && source "/Users/steve-simkins/.bun/_bun" |
|
| 106 | - | ||
| 107 | - | # fzf |
|
| 108 | - | source <(fzf --zsh) |
|
| 109 | - | ||
| 110 | - | # bun |
|
| 111 | - | export BUN_INSTALL="$HOME/.bun" |
|
| 112 | - | export PATH="$BUN_INSTALL/bin:$PATH" |
| 1 | + | # ~/.zshrc — mirrors the nushell config |
|
| 2 | + | # |
|
| 3 | + | # Linked via: fling link -s zsh -l ~ |
|
| 4 | + | ||
| 5 | + | # Interactive-only guard |
|
| 6 | + | case $- in |
|
| 7 | + | *i*) ;; |
|
| 8 | + | *) return ;; |
|
| 9 | + | esac |
|
| 10 | + | ||
| 11 | + | # ============================================================================= |
|
| 12 | + | # History |
|
| 13 | + | # ============================================================================= |
|
| 14 | + | HISTFILE="$HOME/.zsh_history" |
|
| 15 | + | HISTSIZE=10000 |
|
| 16 | + | SAVEHIST=10000 |
|
| 17 | + | setopt EXTENDED_HISTORY |
|
| 18 | + | setopt HIST_IGNORE_ALL_DUPS # ~ HISTCONTROL=ignoredups |
|
| 19 | + | setopt HIST_IGNORE_SPACE # ~ HISTCONTROL=ignorespace |
|
| 20 | + | setopt HIST_REDUCE_BLANKS |
|
| 21 | + | setopt APPEND_HISTORY # ~ shopt -s histappend |
|
| 22 | + | setopt INC_APPEND_HISTORY |
|
| 23 | + | setopt share_history |
|
| 24 | + | setopt hist_verify |
|
| 25 | + | ||
| 26 | + | ||
| 27 | + | # vi mode (matches nushell edit_mode: vi) |
|
| 28 | + | set -o vi |
|
| 29 | + | ||
| 30 | + | # Edit command in $EDITOR |
|
| 31 | + | autoload -Uz edit-command-line |
|
| 32 | + | zle -N edit-command-line |
|
| 33 | + | bindkey '^O' edit-command-line |
|
| 34 | + | ||
| 35 | + | # ============================================================================= |
|
| 36 | + | # Environment |
|
| 37 | + | # ============================================================================= |
|
| 38 | + | export EDITOR="nvim" |
|
| 39 | + | export CLICOLOR=1 |
|
| 40 | + | ||
| 41 | + | # Go |
|
| 42 | + | export GOROOT="/usr/local/go" |
|
| 43 | + | export GOPATH="$HOME/.local/share/go" |
|
| 44 | + | export GOMODCACHE="$HOME/.local/share/go-mod-cache" |
|
| 45 | + | export GOPRIVATE="*gitlab*" |
|
| 46 | + | ||
| 47 | + | # bat |
|
| 48 | + | export BAT_THEME="ansi" |
|
| 49 | + | export BAT_THEME_DARK="ansi" |
|
| 50 | + | ||
| 51 | + | # gpg |
|
| 52 | + | export GPG_TTY="$(tty)" |
|
| 53 | + | ||
| 54 | + | # misc |
|
| 55 | + | export BULLETS_FEEDS="feeds.stevedylan.dev/feed.xml" |
|
| 56 | + | ||
| 57 | + | # pnpm |
|
| 58 | + | export PNPM_HOME="$HOME/Library/pnpm" |
|
| 59 | + | ||
| 60 | + | # fzf |
|
| 61 | + | export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude ".git"' |
|
| 62 | + | export FZF_DEFAULT_OPTS=' |
|
| 63 | + | --color=fg:8:bold,fg+:15,bg:-1,bg+:-1 |
|
| 64 | + | --color=hl:10:bold,hl+:10:bold |
|
| 65 | + | --color=info:8,spinner:9,header:4 |
|
| 66 | + | --color=prompt:2,pointer:9,marker:1 |
|
| 67 | + | --color=border:7,label:15:bold,query:15 |
|
| 68 | + | --border="rounded" |
|
| 69 | + | --border-label="" |
|
| 70 | + | --preview-window="border-rounded" |
|
| 71 | + | --prompt="> " |
|
| 72 | + | --marker=" " |
|
| 73 | + | --pointer="◆" |
|
| 74 | + | --separator="" |
|
| 75 | + | --scrollbar="" |
|
| 76 | + | --gutter=" " |
|
| 77 | + | --info=inline-right' |
|
| 78 | + | ||
| 79 | + | # ============================================================================= |
|
| 80 | + | # PATH |
|
| 81 | + | # ============================================================================= |
|
| 82 | + | # path_add <dir>: prepend if not already present and dir exists |
|
| 83 | + | path_add() { |
|
| 84 | + | case ":$PATH:" in |
|
| 85 | + | *":$1:"*) ;; |
|
| 86 | + | *) [ -d "$1" ] && PATH="$1:$PATH" ;; |
|
| 87 | + | esac |
|
| 88 | + | } |
|
| 89 | + | ||
| 90 | + | path_add "/opt/homebrew/bin" |
|
| 91 | + | path_add "/usr/local/go/bin" |
|
| 92 | + | path_add "$HOME/.cargo/bin" |
|
| 93 | + | path_add "$HOME/.local/share/go/bin" |
|
| 94 | + | path_add "$HOME/.local/bin" |
|
| 95 | + | path_add "/usr/local/bin" |
|
| 96 | + | path_add "$HOME/.bun/bin" |
|
| 97 | + | path_add "/Applications/Docker.app/Contents/Resources/bin" |
|
| 98 | + | path_add "$HOME/.tmux/plugins/t-smart-tmux-session-manager/bin" |
|
| 99 | + | path_add "$HOME/.deno/bin" |
|
| 100 | + | path_add "$HOME/.foundry/bin" |
|
| 101 | + | path_add "$HOME/.local/share" |
|
| 102 | + | path_add "$HOME/.local/share/solana/install/active_release/bin" |
|
| 103 | + | path_add "$HOME/.aztec/bin" |
|
| 104 | + | path_add "$HOME/.nargo/bin" |
|
| 105 | + | path_add "$HOME/.helios/bin" |
|
| 106 | + | path_add "$HOME/.radicle/bin" |
|
| 107 | + | path_add "$PNPM_HOME" |
|
| 108 | + | ||
| 109 | + | export PATH |
|
| 110 | + | ||
| 111 | + | # fnm (node version manager) |
|
| 112 | + | if command -v fnm >/dev/null 2>&1; then |
|
| 113 | + | eval "$(fnm env --shell zsh)" |
|
| 114 | + | path_add "$FNM_MULTISHELL_PATH/bin" |
|
| 115 | + | export PATH |
|
| 116 | + | # auto-switch node version on cd when .node-version / .nvmrc present |
|
| 117 | + | __fnm_autouse() { |
|
| 118 | + | if [ -f .node-version ] || [ -f .nvmrc ]; then |
|
| 119 | + | fnm use --silent-if-unchanged 2>/dev/null |
|
| 120 | + | fi |
|
| 121 | + | } |
|
| 122 | + | autoload -Uz add-zsh-hook |
|
| 123 | + | add-zsh-hook precmd __fnm_autouse |
|
| 124 | + | fi |
|
| 125 | + | ||
| 126 | + | # cargo |
|
| 127 | + | [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env" |
|
| 128 | + | ||
| 129 | + | # ============================================================================= |
|
| 130 | + | # Aliases |
|
| 131 | + | # ============================================================================= |
|
| 132 | + | alias ls='eza --icons=always' |
|
| 133 | + | alias ll='eza -l --icons=always' |
|
| 134 | + | alias la='eza -a --icons=always' |
|
| 135 | + | alias lg='lazygit' |
|
| 136 | + | alias nf='neofetch' |
|
| 137 | + | alias fl='fastfetch -c ~/.config/fastfetch/presets/examples/8.jsonc' |
|
| 138 | + | alias ff='fastfetch -c ~/.config/fastfetch/presets/examples/20.jsonc' |
|
| 139 | + | alias nvimrc='nvim ~/.config/nvim' |
|
| 140 | + | alias shitter='ssh itter' |
|
| 141 | + | alias tailscale='/Applications/Tailscale.app/Contents/MacOS/Tailscale' |
|
| 142 | + | alias ai='aichat' |
|
| 143 | + | alias system='macchina' |
|
| 144 | + | alias bonsai='cbonsai -li -t 0.4' |
|
| 145 | + | alias lst='lstr --icons --color=always --size' |
|
| 146 | + | alias keys='keysmasher' |
|
| 147 | + | alias timestamp='node -e "process.stdout.write(new Date().toISOString())"' |
|
| 148 | + | alias cleardns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder' |
|
| 149 | + | ||
| 150 | + | # ------------------------------------------- |
|
| 151 | + | # Suffix Aliases - Open Files by Extension |
|
| 152 | + | # ------------------------------------------- |
|
| 153 | + | # Just type the filename to open it with the associated program |
|
| 154 | + | alias -s json=jless |
|
| 155 | + | alias -s md=bat |
|
| 156 | + | alias -s go='$EDITOR' |
|
| 157 | + | alias -s rs='$EDITOR' |
|
| 158 | + | alias -s txt=bat |
|
| 159 | + | alias -s log=bat |
|
| 160 | + | alias -s py='$EDITOR' |
|
| 161 | + | alias -s js='$EDITOR' |
|
| 162 | + | alias -s ts='$EDITOR' |
|
| 163 | + | alias -s html=open # macOS: open in default browser |
|
| 164 | + | ||
| 165 | + | # ============================================================================= |
|
| 166 | + | # Functions |
|
| 167 | + | # ============================================================================= |
|
| 168 | + | # Open a sesh session via gum filter |
|
| 169 | + | t() { |
|
| 170 | + | local selected |
|
| 171 | + | selected=$(sesh list -i | gum filter --limit 1 --placeholder "Choose a session" --height 50 --prompt="> " --indicator.foreground="2" --match.foreground="2") |
|
| 172 | + | if [ -z "$selected" ]; then |
|
| 173 | + | echo "No session selected" |
|
| 174 | + | else |
|
| 175 | + | sesh connect "$selected" |
|
| 176 | + | fi |
|
| 177 | + | } |
|
| 178 | + | ||
| 179 | + | # Fuzzy-find a file and open in nvim |
|
| 180 | + | nvimf() { |
|
| 181 | + | local file |
|
| 182 | + | file=$(fd --type f --hidden --exclude .git | fzf --preview "bat --color=always {}") |
|
| 183 | + | if [ -z "$file" ]; then |
|
| 184 | + | echo "No file selected" |
|
| 185 | + | else |
|
| 186 | + | nvim "$file" |
|
| 187 | + | fi |
|
| 188 | + | } |
|
| 189 | + | ||
| 190 | + | # Install a tree-sitter parser into the nvim luarocks tree |
|
| 191 | + | tsi() { |
|
| 192 | + | local parser="$1" |
|
| 193 | + | local tree="$HOME/.local/share/nvim/site" |
|
| 194 | + | luarocks --lua-version=5.1 "--tree=$tree" install "tree-sitter-$parser" |
|
| 195 | + | } |
|
| 196 | + | ||
| 197 | + | # nvim startup time -> grep summary line |
|
| 198 | + | ns() { |
|
| 199 | + | rm -f ~/.nvim-startup.txt |
|
| 200 | + | nvim --headless --startuptime ~/.nvim-startup.txt +qa |
|
| 201 | + | grep "NVIM STARTED" ~/.nvim-startup.txt |
|
| 202 | + | } |
|
| 203 | + | ||
| 204 | + | # nvim startup time -> full bat dump |
|
| 205 | + | nh() { |
|
| 206 | + | rm -f ~/.nvim-startup.txt |
|
| 207 | + | nvim --headless --startuptime ~/.nvim-startup.txt +qa |
|
| 208 | + | bat ~/.nvim-startup.txt |
|
| 209 | + | } |
|
| 210 | + | ||
| 211 | + | # Copy file contents to clipboard |
|
| 212 | + | cpf() { |
|
| 213 | + | cat "$1" | pbcopy |
|
| 214 | + | echo "✔︎ Copied to clipboard!" |
|
| 215 | + | } |
|
| 216 | + | ||
| 217 | + | # Set orbiter key to personal |
|
| 218 | + | orbiter-personal() { |
|
| 219 | + | gum spin --spinner dot --spinner.foreground="2" --title "Updating..." -- orbiter auth --key "$(op read 'op://Personal/orbiter-api-key/credential')" |
|
| 220 | + | local check |
|
| 221 | + | check=$(gum style --foreground="2" "✓ ") |
|
| 222 | + | gum join "$check" "Orbiter key set to personal!" |
|
| 223 | + | } |
|
| 224 | + | ||
| 225 | + | # Set orbiter key to orbiter account |
|
| 226 | + | orbiter-account() { |
|
| 227 | + | gum spin --spinner dot --spinner.foreground="2" --title "Updating..." -- orbiter auth --key "$(op read 'op://Personal/orbiter-account-api-key/credential')" |
|
| 228 | + | local check |
|
| 229 | + | check=$(gum style --foreground="2" "✓ ") |
|
| 230 | + | gum join "$check" "Orbiter key set to Orbiter account!" |
|
| 231 | + | } |
|
| 232 | + | ||
| 233 | + | # UTC timestamp for blog frontmatter |
|
| 234 | + | blogdate() { |
|
| 235 | + | date -u +"%Y-%m-%dT%H:%M:%SZ" |
|
| 236 | + | } |
|
| 237 | + | ||
| 238 | + | # ============================================================================= |
|
| 239 | + | # Completion |
|
| 240 | + | # ============================================================================= |
|
| 241 | + | autoload -Uz compinit |
|
| 242 | + | compinit |
|
| 243 | + | ||
| 244 | + | # ============================================================================= |
|
| 245 | + | # Tooling init |
|
| 246 | + | # ============================================================================= |
|
| 247 | + | command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init zsh)" |
|
| 248 | + | command -v starship >/dev/null 2>&1 && eval "$(starship init zsh)" |
|
| 249 | + | command -v fzf >/dev/null 2>&1 && eval "$(fzf --zsh)" |
|
| 250 | + | ||
| 251 | + | # zsh-autosuggestions and syntax highlighting |
|
| 252 | + | source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh |
|
| 253 | + | source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh |