alias la="ls -laph"

# Initialize colors.
autoload -U colors && colors
autoload -U promptinit
autoload -U compinit && compinit
autoload -U complist

# Change folder without "cd"
setopt autocd

# Set vim mode
set -o vi
bindkey -v

# Reduce timeout after <ESC>
export KEYTIMEOUT=1

# Allow editing of current line in $EDITOR using command mode V
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line

# ctrl-r starts searching history backward
bindkey '^r' history-incremental-search-backward

################################################################################
#
#                                   History
#
################################################################################
export HISTSIZE=2000
export HISTFILE="$HOME/.zsh_history"
export SAVEHIST=$HISTSIZE
# Ignore dupicates in history, no protocol, just reverse search for faster reuse
setopt hist_ignore_all_dups
# Don't save commands prefixed with an empty space
setopt hist_ignore_space
# Share history in multiple instances
# setopt sharehistory
# Persist timestamp and duration beside the command
setopt extended_history

################################################################################
#
#                                   Autocompletion
#
################################################################################
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle ':completion:*' menu select
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

# also complete defined alias
setopt completealiases
# Correct mistyped commands
setopt correctall
# Try to make the completion list smaller (occupying less lines) by printing the matches in columns with different widths.
setopt list_packed
# When listing files that are possible completions, show the type of each file with a trailing identifying mark.
setopt list_types

setopt PROMPT_SUBST

PROMPT=$'\n%{$fg[red]%}%D{%I:%M:%S%p} %n %{$fg[cyan]%}%~${reset_color%}\n %{$reset_color%}\n$ '

