## Options section
setopt extendedglob                                             # Extended globbing. Allows using regular expressions with *
setopt nocaseglob                                               # Case insensitive globbing
setopt rcexpandparam                                            # Array expension with parameters
setopt nocheckjobs                                              # Don't warn about running processes when exiting
setopt numericglobsort                                          # Sort filenames numerically when it makes sense
setopt nobeep                                                   # No beep
setopt incappendhistory                                         # Immediately append history instead of overwriting
setopt histignorealldups                                        # If a new command is a duplicate, remove the older one
setopt autocd                                                   # If only directory path is entered, cd there
setopt interactivecomments                                      # Allow comments even in interactive shells

zstyle ':completion:*' menu yes select                          # Selecionar tab com direcional
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"         # Colored completion (different colors for dirs/files/etc)
zstyle ':completion:*' rehash true                              # automatically find new executables in path 
HISTFILE=~/.zhistory
HISTSIZE=1000
SAVEHIST=500
export EDITOR=/usr/bin/nano
export VISUAL=/usr/bin/nano
WORDCHARS=${WORDCHARS//[\/&.;]}                                 # Don't consider certain characters part of the word

alias cp="cp -i"
## Keybindings section
bindkey -e
bindkey '^[[H'  beginning-of-line                               # Home key (xterm)
bindkey '^[[OH' beginning-of-line                               # Home key (smkx mode)
bindkey '^[[1~' beginning-of-line                               # Home key (screen & tmux)
bindkey '^[[7~' beginning-of-line                               # Home key (urxvt)
bindkey '^[[F'  end-of-line                                     # End key (xterm)
bindkey '^[[OF' end-of-line                                     # End key (smkx mode)
bindkey '^[[4~' end-of-line                                     # End key (screen & tmux)
bindkey '^[[8~' end-of-line                                     # End key (urxvt)
bindkey '^[[2~' overwrite-mode                                  # Insert key
bindkey '^[[3~' delete-char                                     # Delete key
bindkey '^[[C'  forward-char                                    # Right key
bindkey '^[[D'  backward-char                                   # Left key
bindkey '^[[5~' history-beginning-search-backward               # Page up key
bindkey '^[[6~' history-beginning-search-forward                # Page down key
bindkey '^[[A'  up-line-or-history                              # Up key
bindkey '^[[B'  down-line-or-history                            # Down key
# Navigate words with ctrl+arrow keys
bindkey '^[Oc' forward-word                                     #
bindkey '^[Od' backward-word                                    #
bindkey '^[[1;5D' backward-word                                 #
bindkey '^[[1;5C' forward-word                                  #
bindkey '^H' backward-kill-word                                 # delete previous word with ctrl+backspace
bindkey '^[[Z' undo                                             # Shift+tab undo last action

## Theming section  
autoload -Uz compinit colors zcalc
compinit
colors

# enable substitution for prompt
setopt prompt_subst
# bash style prompt 
PROMPT='[%n@%m %1~]%# '
# Right prompt with exit status of previous command if not successful
RPROMPT='%(?..%F{red}[%?]%f)'
# Color man pages
export LESS_TERMCAP_mb=$'\E[01;32m'
export LESS_TERMCAP_md=$'\E[01;32m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;47;34m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;36m'
export LESS=-r
