You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.2 KiB

#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# 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
2 years ago
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
2 years ago
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]+/, ?-)"`'
7 years ago
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
6 years ago
fi
7 years ago
[ -x "$(command -v kubectl)" ] && source <(kubectl completion zsh)
2 years ago
if [ -x "$(command -v terraform)" ]; then
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /opt/homebrew/bin/terraform terraform
fi
2 years ago
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"
1 year ago
export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border"
1 year ago
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 --strip-cwd-prefix --hidden --follow --exclude .git"
1 year ago
# alias fzf='fzf-tmux -p'
# https://github.com/junegunn/fzf/issues/164#issuecomment-581837757
bindkey "ç" fzf-cd-widget
1 year ago
source ~/.dotfiles/src/fzf-git.sh/fzf-git.sh
1 year ago
# ^gb is eaten by tmux
eval "bindkey '^gg' fzf-git-branches-widget"
2 years ago
# 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
7 years ago
fi
6 years ago
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
2 years ago
# allow for pasting commands from the interwebs with a preceding $ prompt
function \$() { "$@" }
6 years ago
[[ -s "$HOME/.zshrc.local" ]] && . "$HOME/.zshrc.local"