[[ -f "${ZDOTDIR:-$HOME}/.zprofile" ]] && source "${ZDOTDIR:-$HOME}/.zprofile" [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return # for tramp [[ "$(tty)" == "/dev/tty1" ]] && startx && return HISTFILE=~/.histfile HISTSIZE=5000 SAVEHIST=$HISTSIZE KEYBOARD_HACK=" " HISTORY_IGNORE=" *|*INSIDE_EMACS*" TIMEFMT="%J user %U system %S cpu %P total %*E" setopt nobeep setopt emacs setopt autocd setopt auto_pushd setopt auto_name_dirs setopt rm_star_silent setopt auto_resume setopt auto_continue setopt notify setopt append_history setopt share_history setopt prompt_subst stty stop undef autoload -U compinit zstyle ':completion:*' menu select zstyle ':completion:*' list-colors '' zstyle ':completion:*' group-name '' zmodload zsh/complist compinit -d ~/.cache/zcompdump replace() { local REPLY autoload -Uz read-from-minibuffer read-from-minibuffer "Replace: " local text=$REPLY read-from-minibuffer "Replace $text with: " local repl=$REPLY RBUFFER="${BUFFER//$text/$repl}" } zle -N replace fzfcd() { cd "$(find -L . -mindepth 1 -path '*/.*' -prune -o -type d -print 2>/dev/null | cut -c3- | fzf)" zle reset-prompt } zle -N fzfcd fzff() { local file=$(find -L . -mindepth 1 -path '*/.*' -prune -o -type f -print 2>/dev/null | cut -c3- | fzf) BUFFER="$LBUFFER$file$RBUFFER" CURSOR=$(($CURSOR + ${#file})) zle reset-prompt } zle -N fzff autoload -U select-word-style select-word-style bash bindkey -e bindkey -M emacs "\C-\b" backward-kill-word bindkey -M emacs "^[[1;5D" backward-word bindkey -M emacs "^[Od" backward-word bindkey -M emacs "^[^[[D" backward-word bindkey -M emacs "^[[1;5C" forward-word bindkey -M emacs "^[Oc" forward-word bindkey -M emacs "^[^[[C" forward-word bindkey -M emacs "^[%" replace bindkey -M emacs "^Xd" fzfcd bindkey -M emacs "^X^F" fzff export EDITOR=e export PAGER=less _prompt_git_status() { local branch="$(command git name-rev --name-only HEAD 2>/dev/null)" local root="$(command git rev-parse --show-toplevel 2>/dev/null)" # hack to ignore next condition if we're on master [ "$branch" != "master" ] && root="" if [ "$branch" -a "$root" != "$HOME" ]; then _git_status=" %2F(on %4F$branch)%f" else _git_status="" fi } precmd () { _prompt_git_status } PROMPT="%B%f%4F%~%f\$_git_status %4F%(!,#,$)%b%f " RPROMPT="%B%5F($USERNAME %1F@ %2F$(hostname))%b%f" alias rm='rm -I' alias mkdir='mkdir -p' alias ls='ls --color=auto' alias grep='grep --color=auto' -() { cd - } # aliasing - doesn't work alias '...'='cd ../..' alias restart='exec zsh' alias -g 'G'='| grep' alias -g 'L'='| $PAGER' [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && \ source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh [ -f /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh ] && \ source /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh [ -f ~/.zshrc.local ] && source ~/.zshrc.local