Source

dotfiles / zshrc

Full commit
# ~/.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
#PROMPT="%{$fg[$prompt_color]%}%n@%m%{$reset_color%} %~ %# "
RPROMPT="[%{$fg[yellow]%}%?%{$reset_color%}]"
PS2="» "

### Setup prompt
PROMPT="%{$fg[$prompt_color]%}%n@%m%{$reset_color%} %~
%# "

### 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


#### 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