1. firefly
  2. dotfiles

Source

dotfiles / zshrc

# ~/.zshrc
source "$HOME/.shellrc"

# Import modules/stuff
autoload -U  compinit   && compinit
autoload -U  promptinit && promptinit
autoload -U  colors     && colors

# Enable command-line editing in external editor, bash style.
autoload edit-command-line
zle -N edit-command-line
bindkey '^X^E' edit-command-line


### Variables

### Setup prompt
#echo -e '\e]0;zsh\007'

esc="$(echo -e '\e')"
up="${esc}[A"
down="${esc}[B"
title_set="${esc}]0"
title_stop="$(echo -e '\007')"

#PROMPT="%{$fg[$prompt_color]%}%n@%m%{$reset_color%} %~ %# "
#RPROMPT="[%{$fg[yellow]%}%?%{$reset_color%}]"

### Setup prompt
# Only set terminal emulator title in $RPROMPT if we're likely to be running
# from a graphical terminal.
if [ $TERM = 'linux' ]; then
  Title=
else
  Title="$title_set;%n@%m %~$title_stop"
fi

PROMPT="%{$fg[$prompt_color]%}%n@%m%{$reset_color%} %~
%# "
RPROMPT="%{$up%}[%{$fg[yellow]%}%?%{$reset_color%}]%{$down%}%{$Title%}"
PS2="» "

### Alternative prompt (two-line prompt)
#PROMPT="%{$fg[grey]%}╭╴%{$fg[$prompt_color]%}%n@%m%{$reset_color%} %~
#%{$fg[grey]%}╰▶ %{$reset_color%}"
#up_1="$(echo -e '\e[A')"
##∘
#PS2="%{${up_1}$fg[grey]%}│%{$reset_color%}│
#%{$fg[grey]%}╰▶ %{$reset_color%}"

# History
export HISTSIZE=2000
export HISTFILE="$HOME/.history"
export SAVEHIST="$HISTSIZE"
setopt hist_ignore_all_dups


#### Aliases ########################################################
# (zsh specific--also see .shellrc)
alias -g G='| grep -P'
alias -g L='| less'


#### Fix key bindings ###############################################
#bindkey -e # emacs-like bindings
bindkey -v # vim-like bindings

# Borrow a bunch of neat stuff from the default emacs-like bindings, that the
# vi-like bindings lack.
bindkey    "^A"    beginning-of-line
#bindkey    "^D"    delete-char-or-list
bindkey    '^E'    end-of-line
#bindkey    "^G"    send-break
bindkey    "^H"    backward-delete-char
bindkey    "^N"    down-line-or-history
#bindkey    "^O"    accept-line-and-down-history
bindkey    "^P"    up-line-or-history
#bindkey    "^R"    history-incremental-search-backward
bindkey    "^R"    history-incremental-pattern-search-backward
#bindkey    "^S"    history-incremental-search-forward
bindkey    "^V"    quoted-insert
bindkey    '^?'    backward-delete-char

# vi-"normal mode" bindings
bindkey -a "^A"    beginning-of-line
bindkey -a '^E'    end-of-line
bindkey -a '^K'    kill-whole-line

# Also fix a bunch of other keys
bindkey '^[[7~' beginning-of-line
bindkey '^[[8~' end-of-line
bindkey "^[Od"  backward-word
bindkey "^[Oc"  forward-word

bindkey "^K"    kill-whole-line
bindkey "^U"    undo
bindkey "^['"   quote-line