2
0
Files
dot/.zshrc
ai 760dea8147 security: fix path traversal in plugin_rm, add coding tools
- prevent path traversal in ais plugin rm (reject .. and /)
- validate plugin_add requires user/repo format
- extract list_plugins() helper to deduplicate code
- add git aliases (s, d, l, lg, pa for dual push, etc)
- add cargo/rg aliases and mkcd helper to zshrc
- fix zr alias (source instead of unreachable exec)
2026-04-03 13:02:34 +00:00

68 lines
1.8 KiB
Bash

export CARGO_HOME="$HOME/.cargo"
export RUSTUP_HOME="$HOME/.rustup"
export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
if command -v tmux &>/dev/null && [ -z "$TMUX" ] && [ -z "$SSH_CONNECTION" ]; then
tmux new
fi
alias c="claude"
alias t="tmux"
alias v="vim"
alias ts="vim ~/.tmux.conf"
alias vs="vim ~/.vimrc"
alias zs="vim ~/.zshrc"
alias zr="source ~/.zshrc"
alias ll="ls -alh"
alias df="df -H"
alias g="git"
alias gs="git s"
alias gd="git d"
alias gl="git l"
alias gp="git pa"
alias cb="cargo build --release"
alias cr="cargo run"
alias ct="cargo test"
# mkcd: create and enter directory
mkcd() { mkdir -p "$1" && cd "$1" }
# rg shortcut with common defaults
r() { rg --smart-case --hidden --glob '!.git' "$@" }
zmodload zsh/complist
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
autoload -Uz compinit
compinit
bindkey -M menuselect '^n' down-line-or-history
bindkey -M menuselect '^p' up-line-or-history
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
case $OSTYPE in
linux*)
alias ls="ls -a --color=auto"
alias ll="ls -alh --color=auto"
alias u="sudo pacman -Syu --noconfirm"
fpath=(/usr/share/zsh/site-functions $fpath)
;;
esac
for p in /usr/share/zsh/plugins; do
[ -f "$p/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && source "$p/zsh-autosuggestions/zsh-autosuggestions.zsh"
[ -f "$p/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && source "$p/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
[ -f "$p/zsh-history-substring-search/zsh-history-substring-search.zsh" ] && source "$p/zsh-history-substring-search/zsh-history-substring-search.zsh"
done
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
chpwd() { ls }
for f in ~/.zsh/plugin/*.zsh; do source "$f"; done