refactor .zshrc

This commit is contained in:
Jason Swank
2026-03-22 14:52:53 -04:00
parent 8ef76de5a1
commit b9801c8daa
2 changed files with 24 additions and 21 deletions

3
zsh/.aliasrc Normal file
View File

@@ -0,0 +1,3 @@
alias ls='ls --color=auto'
alias grep='grep --color'
alias pichat='pi --provider google --model gemini-3.1-flash-lite-preview --prompt-template ~/.pi/agent/prompts/cloudops.md'

View File

@@ -1,8 +1,12 @@
alias ls='ls --color=auto'
alias grep='grep --color' # aliases are stored in ~/.aliasrc
if [ -f ~/.aliasrc ]; then
source ~/.aliasrc
fi
fpath+=~/.local/share/zsh/functions fpath+=~/.local/share/zsh/functions
typeset -U path
path+=(~/bin) path+=(~/bin)
path+=(~/.local/bin) path+=(~/.local/bin)
path+=($GOPATH/bin) path+=($GOPATH/bin)
@@ -58,7 +62,8 @@ function set_prompt() {
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
PROMPT=$aws_prompt"%B${vcs_info_msg_0_} ▶ %b" PROMPT=$aws_prompt"%B${vcs_info_msg_0_} ▶ %b"
else else
PROMPT=$aws_prompt"%B%m:%~▶ %b" # PROMPT=$aws_prompt"%B%m:%~ ▶ %b"
PROMPT=$aws_prompt"%B%m:%2~ ▶ %b"
fi fi
} }
precmd_functions+=( set_prompt ) precmd_functions+=( set_prompt )
@@ -96,11 +101,11 @@ fi
# command line completion # command line completion
autoload -U +X bashcompinit && bashcompinit autoload -U +X bashcompinit && bashcompinit
autoload -Uz compinit && compinit autoload -Uz compinit && compinit -C
# gcloud # gcloud
if [ -f '/home/cli/google-cloud-sdk/path.zsh.inc' ]; then . '/home/cli/google-cloud-sdk/path.zsh.inc'; fi if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then . "$HOME/google-cloud-sdk/path.zsh.inc"; fi
if [ -f '/home/cli/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/cli/google-cloud-sdk/completion.zsh.inc'; fi if [ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ]; then . "$HOME/google-cloud-sdk/completion.zsh.inc"; fi
# kubectl # kubectl
[[ $commands[kubectl] ]] && source <(kubectl completion zsh) [[ $commands[kubectl] ]] && source <(kubectl completion zsh)
@@ -118,20 +123,15 @@ fi
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# command line completion for ssh # command line completion for ssh
h=() #h=()
if [[ -r ~/.ssh/config ]]; then #if [[ -r ~/.ssh/config ]]; then
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*}) h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
fi #fi
if [[ -r ~/.ssh/known_hosts ]]; then #if [[ -r ~/.ssh/known_hosts ]]; then
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null # h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
fi #fi
if [[ $#h -gt 0 ]]; then #if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:(ssh|scp|slogin|sftp):*' hosts $h # zstyle ':completion:*:(ssh|scp|slogin|sftp):*' hosts $h
fi #fi
zstyle :compinstall filename '~/.zshrc' zstyle :compinstall filename '~/.zshrc'
#zstyle ':completion:*' completer _complete _ignored
#zstyle :compinstall filename '~/.zshrc'
#compinit