mac-dotfiles/.zshrc

130 lines
12 KiB
Bash
Raw Normal View History

source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
source /nix/var/nix/profiles/default/etc/profile.d/nix.sh
2023-03-21 14:17:23 -04:00
2024-01-17 11:29:59 -05:00
export BAT_THEME="Monokai Extended Origin"
2023-03-21 14:17:23 -04:00
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
LESS="-R"; export LESS
PAGER=less; export PAGER
DELTA_PAGER=less; export DELTA_PAGER
# disable ^S and ^Q control flow
stty -ixon
case ":${PATH}:" in
*:"$HOME/.cargo/bin":*)
;;
*)
# Prepending path in case a system-installed rustc needs to be overridden
export PATH="$HOME/.cargo/bin:$PATH"
;;
esac
2023-03-21 14:17:23 -04:00
EDITOR=vi
if command -v hx > /dev/null ; then
EDITOR=hx
elif command -v vim > /dev/null ; then
EDITOR=vim
fi
export EDITOR
# Use ~~ as the trigger sequence instead of the default **
export FZF_COMPLETION_TRIGGER='~~'
# Options to fzf command
export FZF_COMPLETION_OPTS='--border --info=inline'
export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix'
# Use fd (https://github.com/sharkdp/fd) instead of the default find
# command for listing path candidates.
# - The first argument to the function ($1) is the base path to start traversal
# - See the source code (completion.{bash,zsh}) for the details.
_fzf_compgen_path() {
fd --hidden --follow --exclude ".git" . "$1"
}
# Use fd to generate the list for directory completion
_fzf_compgen_dir() {
fd --type d --hidden --follow --exclude ".git" . "$1"
}
# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function
# - The first argument to the function is the name of the command.
# - You should make sure to pass the rest of the arguments to fzf.
_fzf_comprun() {
local command=$1
shift
case "$command" in
cd) fzf "$@" --preview 'tree -C {} | head -200' ;;
export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;;
ssh) fzf "$@" --preview 'dig {}' ;;
*) fzf "$@" ;;
esac
}
2023-03-21 14:17:23 -04:00
export LS_COLORS="su=0:ca=0:*~=0;38;2;102;102;102:mh=0:do=0;38;2;0;0;0;48;2;255;106;193:pi=0;38;2;0;0;0;48;2;64;120;242:tw=0:sg=0:ln=0;38;2;255;106;193:ex=1;38;2;228;86;73:ow=0:mi=0;38;2;0;0;0;48;2;228;86;73:cd=0;38;2;255;106;193;48;2;51;51;51:rs=0:fi=0:bd=0;38;2;1;132;188;48;2;51;51;51:st=0:or=0;38;2;0;0;0;48;2;228;86;73:no=0:di=0;38;2;64;120;242:so=0;38;2;0;0;0;48;2;255;106;193:*.d=0;38;2;80;161;79:*.r=0;38;2;80;161;79:*.p=0;38;2;80;161;79:*.a=1;38;2;228;86;73:*.z=4;38;2;1;132;188:*.c=0;38;2;80;161;79:*.h=0;38;2;80;161;79:*.m=0;38;2;80;161;79:*.t=0;38;2;80;161;79:*.o=0;38;2;102;102;102:*.ex=0;38;2;80;161;79:*.nb=0;38;2;80;161;79:*.td=0;38;2;80;161;79:*.wv=0;38;2;255;106;193:*.ui=0;38;2;193;132;1:*.el=0;38;2;80;161;79:*.md=0;38;2;193;132;1:*.cr=0;38;2;80;161;79:*.mn=0;38;2;80;161;79:*.pm=0;38;2;80;161;79:*.ts=0;38;2;80;161;79:*css=0;38;2;80;161;79:*.di=0;38;2;80;161;79:*.go=0;38;2;80;161;79:*.fs=0;38;2;80;161;79:*.vb=0;38;2;80;161;79:*.rb=0;38;2;80;161;79:*.js=0;38;2;80;161;79:*.ps=0;38;2;228;86;73:*.lo=0;38;2;102;102;102:*.gz=4;38;2;1;132;188:*.py=0;38;2;80;161;79:*.hh=0;38;2;80;161;79:*.7z=4;38;2;1;132;188:*.cp=0;38;2;80;161;79:*.ml=0;38;2;80;161;79:*.kt=0;38;2;80;161;79:*.bz=4;38;2;1;132;188:*.la=0;38;2;102;102;102:*.sh=0;38;2;80;161;79:*.gv=0;38;2;80;161;79:*.ll=0;38;2;80;161;79:*.as=0;38;2;80;161;79:*.ko=1;38;2;228;86;73:*.bc=0;38;2;102;102;102:*.rm=0;38;2;255;106;193:*.jl=0;38;2;80;161;79:*.xz=4;38;2;1;132;188:*.so=1;38;2;228;86;73:*.hs=0;38;2;80;161;79:*.rs=0;38;2;80;161;79:*.cc=0;38;2;80;161;79:*.pp=0;38;2;80;161;79:*.cs=0;38;2;80;161;79:*.pl=0;38;2;80;161;79:*.hi=0;38;2;102;102;102:*.bmp=0;38;2;255;106;193:*TODO=1:*.tgz=4;38;2;1;132;188:*.zip=4;38;2;1;132;188:*.zsh=0;38;2;80;161;79:*.mp4=0;38;2;255;106;193:*.xcf=0;38;2;255;106;193:*.pbm=0;38;2;255;106;193:*.deb=4;38;2;1;132;188:*.inl=0;38;2;80;161;79:*.htc=0;38;2;80;161;79:*.inc=0;38;2;80;161;79:*.htm=0;38;2;193;132;1:*.tbz=4;38;2;1;132;188:*.epp=0;38;2;80;161;79:*.tml=0;38;2;193;132;1:*.cxx=0;38;2;80;161;79:*.ltx=0;38;2;80;161;79:*.ini=0;38;2;193;132;1:*.fls=0;38;2;102;102;102:*.tmp=0;38;2;102;102;102:*.bat=1;38;2;228;86;73:*.sbt=0;38;2;80;161;79:*.txt=0;38;2;193;132;1:*.iso=4;38;2;1;132;188:*.wmv=0;38;2;255;106;193:*.svg=0;38;2;255;106;193:*.swp=0;38;2;102;102;102:*.bag=4;38;2;1;132;188:*.ico=0;38;2;255;106;193:*.bak=0;38;2;102;102;102:*.sxi=0;38;2;228;86;73:*.pps=0;38;2;228;86;73:*.kts=0;38;2;80;161;79:*.mov=0;38;2;255;106;193:*.dmg=4;38;2;1;132;188:*.flv=0;38;2;255;106;193:*.blg=0;38;2;102;102;102:*.fon=0;38;2;255;106;193:*.rar=4;38;2;1;132;188:*.toc=0;38;2;102;102;102:*.rtf=0;38;2;228;86;73:*.log=0;38;2;102;102;102:*.yml=0;38;2;193;132;1:*.bin=4;38;2;1;132;188:*.ppt=0;38;2;228;86;73:*.hpp=0;38;2;80;161;79:*.idx=0;38;2;102;102;102:*.mir=0;38;2;80;161;79:*.pod=0;38;2;80;161;79:*.csx=0;38;2;80;161;79:*.hxx=0;38;2;80;161;79:*.pgm=0;38;2;255;106;193:*.tsx=0;38;2;80;161;79:*.odt=0;38;2;228;86;73:*.ipp=0;38;2;80;161;79:*.bz2=4;38;2;1;132;188:*.xml=0;38;2;193;132;1:*.ics=0;38;2;228;86;73:*.nix=0;38;2;193;132;1:*.pkg=4;38;2;1;132;188:*.dll=1;38;2;228;86;73:*.avi=0;38;2;255;106;193:*.fsi=0;38;2;80;161;79:*.jpg=0;38;2;255;106;193:*.m4a=0;38;2;255;106;193:*.otf=0;38;2;255;106;193:*.fsx=0;38;2;80;161;79:*.awk=0;38;2;80;161;79:*.eps=0;38;2;255;106;193:*.tar=4;38;2;1;132;188:*.swf=0;38;2;255;106;193:*.def=0;38;2;80;161;79:*.rpm=4;38;2;1;132;188:*.zst=4;38;2;1;132;188:*.bsh=0;38;2;80;161;79:*.sxw=0;38;2;228;86;73:*.vim=0;38;2;80;161;79:*.tcl=0;38;2;80;161;79:*.cgi=0;38;2;80;161;79:*.tex=0;38;2;80;161;79:*.pas=0;38;2;80;161;79:*.wma=0;38;2;255;106;193:*.csv=0;38;2;193;132;1:*.mpg=0;38;2;255;106;193:*.sql=0;38;2;80;161;79:*.dpr=0;38;2;80;161;79:*.mp3=0;38;2;255;106;193:*.png=0;38;2;255;106;193:*.ind=0;38;2;102;102;102:*.jar=4;38;2;1;132;188:*.apk=4;38;2;1;132;188:*.mkv=0;38;2;255;106;193:*.pyo=0;38;2;102;102;102:*.php=0;38;2;80;161;79:*.kex=0;38;2;228;86;73:*.ilg=0;38;2;102;102;102:*.bib=0;38;2;193;132;1:*.xlr=0;38;2;228;86;73:*.xls=0;38;2;228;86;73:*.h++=0;38;2;80;161;79:*.asa=0;38;2;80;161;79:*.pyc=0;38;2;102;102;102:*.mli=0;38;2;80;161;79:*.vob=0;38;2;255;106;193:*.pid=
2024-01-17 11:29:59 -05:00
if command -v eza > /dev/null ; then
alias ls="eza --icons -F -g"
2023-03-21 14:17:23 -04:00
else
if [ "$(uname -m)" = "Linux" ] ; then
alias ls="ls --color=auto"
else
alias ls="ls -G"
fi
2023-03-21 14:17:23 -04:00
fi
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
2023-09-11 09:18:24 -04:00
alias publicip='dig +short txt ch whoami.cloudflare @1.0.0.1'
2023-03-21 14:17:23 -04:00
# llama keybindings
# | Key binding | Description |
# |------------------|--------------------|
# | `Arrows`, `hjkl` | Move cursor |
# | `Enter` | Enter directory |
# | `Backspace` | Exit directory |
# | `Space` | Toggle preview |
# | `Esc` | Exit with cd |
# | `Ctrl+C` | Exit without cd |
# | `/` | Fuzzy search |
# | `dd` | Delete file or dir |
function ll {
cd "$(llama "$@")"
}
alias http_server="python3 -m http.server"
[ -d "$HOME/Library/Python/3.9/bin" ] && export PATH="$PATH:$HOME/Library/Python/3.9/bin"
[ -d "$HOME/.local/bin" ] && export PATH="$PATH:$HOME/.local/bin"
FPATH="$HOME/.nix-profile/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit && compinit
2024-01-17 11:29:59 -05:00
if command -v atuin > /dev/null ; then
eval "$(atuin init zsh --disable-up-arrow)"
fi
if command -v direnv > /dev/null ; then
eval "$(direnv hook zsh)"
fi
if command -v starship > /dev/null ; then
eval "$(starship init zsh)"
fi
if command -v zoxide > /dev/null ; then
alias z="$(which zoxide)"
eval "$(zoxide init zsh)"
fi
2024-02-05 12:44:47 -05:00
if [[ "$(uname -r)" =~ "microsoft" ]] ; then
if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-*
eval $(ssh-agent -s) > /dev/null
else
export SSH_AGENT_PID=$(pgrep ssh-agent)
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name "agent.*")
fi
fi
2024-01-17 11:29:59 -05:00
[ -f "$HOME/.zshrc.local" ] && source "$HOME/.zshrc.local"