# # Executes commands at the start of an interactive session. # # Authors: # Sorin Ionescu # # Source Prezto. if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" fi if command -v direnv &> /dev/null; then eval "$(direnv hook zsh)" fi export NIX_PATH=${NIX_PATH:+$NIX_PATH:}$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels zstyle :prompt:pure:prompt:success color green export EDITOR=nvim export VISUAL=nvim export RPROMPT= unsetopt correct # Don't autocorrect unsetopt flowcontrol # So ^S and ^Q can be used setopt no_nomatch # Pass bad matches on setopt no_share_history setopt prompt_subst interactive_comments # Starship: https://github.com/sorin-ionescu/prezto/issues/1887#issuecomment-1040761561 bindkey "\ep" history-beginning-search-backward bindkey "\en" history-beginning-search-forward alias be='bundle exec' alias tat='tmux new-session -As `basename $PWD | ruby -e "puts ARGF.read.strip.downcase.gsub(/[^\w]+/, ?-)"`' alias plz=sudo alias ls=exa alias emacs="emacs --no-window" alias tmux="direnv exec / tmux" alias ,df="git --git-dir=$HOME/.dotfiles.git --work-tree=$HOME" function eject { command hdiutil eject `df | grep Volumes | grep -i "$@" | ruby -ne 'puts $_[/^[^ ]*/]'`; } eval "$(brew shellenv)" if [ -e $HOMEBREW_PREFIX/opt/fzf/shell/completion.zsh ]; then source $HOMEBREW_PREFIX/opt/fzf/shell/key-bindings.zsh source $HOMEBREW_PREFIX/opt/fzf/shell/completion.zsh fi [ -x "$(command -v kubectl)" ] && source <(kubectl completion zsh) if [ -x "$(command -v terraform)" ]; then autoload -U +X bashcompinit && bashcompinit complete -o nospace -C /opt/homebrew/bin/terraform terraform fi if [ -e $HOMEBREW_PREFIX/share/z.lua/z.lua ]; then eval "$(lua $HOMEBREW_PREFIX/share/z.lua/z.lua --init zsh enhanced fzf)" fi if [ $commands[fzf] ]; then [[ $- == *i* ]] && source "/opt/homebrew/opt/fzf/shell/completion.zsh" 2> /dev/null source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh" export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix --hidden --follow --exclude .git" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_ALT_C_COMMAND="fd --type d" # alias fzf='fzf-tmux -p' # https://github.com/junegunn/fzf/issues/164#issuecomment-581837757 bindkey "รง" fzf-cd-widget source ~/.dotfiles/src/fzf-git.sh/fzf-git.sh # ^gb is eaten by tmux eval "bindkey '^gg' fzf-git-branches-widget" # https://github.com/skywind3000/z.lua/wiki/Effective-with-fzf#define-a-new-z--i zlua_fzf() { local dir dir="$(z -l "$1" | fzf --nth 2.. -1 -0 --inline-info --no-sort +m --reverse --tac | sed -r 's/^[^[:space:]]+[[:space:]]+//')" && cd "${dir}" || return 1 } alias j=zlua_fzf # override prezto's fasd integration fi if [ $commands[exa] ]; then export EXA_COLORS="di=34" fi # https://docs.brew.sh/Shell-Completion if type brew &>/dev/null then FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" autoload -Uz compinit compinit fi # allow for pasting commands from the interwebs with a preceding $ prompt function \$() { "$@" } [[ -s "$HOME/.zshrc.local" ]] && . "$HOME/.zshrc.local"