Configure o ZSH

De Wiki Hackstore
# Alias commands
alias ls="ls --color=auto -h"
alias vi="vim"

# Load Modules
autoload -U colors; colors

# Configure ZSH History
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt BANG_HIST
HISTFILE=${HOME}/.zsh_history
HISTSIZE=1000000
SAVEHIST=100000

# Color
autoload -Uz promptinit
promptinit
prompt gentoo
export COLORTERM=yes
export CLICOLOR=1

# key bindings
autoload zkbd
[[ ! -f ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE ]] && zkbd
source ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE

[[ -n ${key[Backspace]} ]] && bindkey "${key[Backspace]}" backward-delete-char
[[ -n ${key[Insert]} ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n ${key[PageUp]} ]] && bindkey "${key[PageUp]}" up-line-or-history
[[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
[[ -n ${key[PageDown]} ]] && bindkey "${key[PageDown]}" down-line-or-history
[[ -n ${key[Up]} ]] && bindkey "${key[Up]}" up-line-or-search
[[ -n ${key[Left]} ]] && bindkey "${key[Left]}" backward-char
[[ -n ${key[Down]} ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n ${key[Right]} ]] && bindkey "${key[Right]}" forward-char


export PS1="(funtoo) $PS1 "


Caso queira definir manualmente via comando zkbd o mapa de teclado, e deseje replicar para todos os usuários do sistema, basta definir via usuário root e configurar a replicação da conf. para os demais usuários:

mkdir /etc/zkbd ; cp.zkbd/xterm-pc-linux-gnu /etc/zkbd

Comente a seguinte linha no arquivo /etc/zsh/zprofile:

#[[ ! -f ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE ]] && zkbd

E adicione a linha abaixo:

[[ ! -f ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE ]] && mkdir ${ZDOTDIR:-$HOME}/.zkbd/ ; cp /etc/zsh/zkbd/xterm-pc-linux-gnu ${ZDOTDIR:-$HOME}/.zkbd/