| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 | ##################################################### Customized configuration for ZSH based on prezto ####################################################### TMPDIR#export TMPDIR="${HOME}/tmp"if [[ ! -d "${TMPDIR}" ]]; then    mkdir -p "${TMPDIR}"fi## Using zpresto#export ZDOTDIR="$(dirname "$(readlink -f "${0}")")"if [[ -f "${ZDOTDIR}/prezto/init.zsh" ]]; then    source "${ZDOTDIR}/prezto/init.zsh"    zstyle ':completion::complete:*' cache-path "${TMPDIR}/.zcompcache"    # Remove first '\n' in PS1    export PS1="$(echo "${PS1}" | sed ':a;N;$!ba;s/\n//')"fi## Load some colors#autoload colors zsh/terminfoif [[ "${terminfo[colors]}" -ge 8 ]]; then    colorsfifor color in RED GREEN YELLOW BLUE MAGENTA CYAN ORANGE WHITE; do    eval COLOR_$color='$terminfo[bold]$fg[${(L)color}]'    eval COLOR_LIGHT_$color='$fg[${(L)color}]'doneCOLOR_RESET="$terminfo[sgr0]"## Pager#VIMPAGER="$(readlink -f "${ZDOTDIR}/../tools/vimpager/vimpager")"if (( $+commands[vim] )) && [[ -f "${VIMPAGER}" ]]; then    export PAGER="${VIMPAGER}"    alias less="${PAGER}"    alias more="${PAGER}"    export VIMPAGER_RC="$(readlink -f "${ZDOTDIR}/../tools/vim/vimpagerrc")"    if [[ ! -f "${VIMPAGER_RC}" ]]; then        unset VIMPAGER_RC    fielif (( $+commands[less] )); then    export PAGER=less    alias more="${PAGER}"elif (( $+commands[more] )); then    export PAGER=morefiexport GIT_PAGER="${PAGER}"unset VIMPAGER## Vim#VIMRC="$(readlink -f "${ZDOTDIR}/../tools/vim/vimrc")"if [[ -f "${VIMRC}" ]]; then    export VIMINIT="source ${VIMRC}"fiunset VIMRC## Git#GIT_IDENTITY_OPTS=if [[ -n "${LC_SSH_FULLNAME}" ]]; then    GIT_IDENTITY_OPTS="-c 'user.name=${LC_SSH_FULLNAME}' ${GIT_IDENTITY_OPTS}"fiif [[ -n "${LC_SSH_EMAIL}" ]]; then    GIT_IDENTITY_OPTS="-c 'user.email=${LC_SSH_EMAIL}' ${GIT_IDENTITY_OPTS}"fiGIT_FAKE_HOME="$(readlink -f "${ZDOTDIR}/../tools/git")"if [[ -f "${GIT_FAKE_HOME}/.gitconfig" ]]; then    GIT_OPTS="LC_MESSAGES=en_US.UTF-8 HOME=${GIT_FAKE_HOME}"    alias git="${GIT_OPTS} git ${GIT_IDENTITY_OPTS}"    alias g="${GIT_OPTS} git ${GIT_IDENTITY_OPTS}"    unset GIT_OPTSfiunset GIT_FAKE_HOME GIT_IDENTITY_OPTS## Tmux#TMUX_OPTS="-2"TMUX_CONF="$(readlink -f "${ZDOTDIR}/../tools/tmux/tmux.conf")"if [[ -f "${TMUX_CONF}" ]]; then    TMUX_OPTS="${TMUX_OPTS} -f ${TMUX_CONF}"fialias tmux="TMPDIR= tmux ${TMUX_OPTS}"unset TMUX_OPTS TMUX_CONF## Common aliases / functions#alias ls='ls -h --color=auto'alias l='ls -lh --color=auto'alias rm='rm -i'alias mv='mv -i'alias cp='cp -i'export GREP_OPTIONS="--color=auto"alias mgrep="grep -rnisH"alias grep="grep"alias rsu="sudo -E zsh"alias reloadsh="exec zsh"alias md="mkdir -p"mcd() { mkdir -p "$@" && cd "$@" }alias aug='sudo apt-get update && sudo apt-get upgrade'if (( $+commands[ccze] )) ; then    alog='tail -n 300 -F /var/log/auth.log | ccze'    mlog='tail -n 300 -F /var/log/mail.log | ccze'    slog='tail -n 300 -F /var/log/syslog | ccze'else    alog='tail -n 300 -F /var/log/auth.log'    mlog='tail -n 300 -F /var/log/mail.log'    slog='tail -n 300 -F /var/log/syslog'fiscp_nosec='scp -o '\''StrictHostKeyChecking=no'\'' -o '\''UserKnownHostsFile=/dev/null'\'ssh_nosec='ssh -o '\''StrictHostKeyChecking=no'\'' -o '\''UserKnownHostsFile=/dev/null'\'## History options#setopt extendedhistory      # add a timestamp and the duration of each commandsetopt sharehistory         # _all_ zsh sessions share the same history filessetopt histignorealldups    # ignores duplicationsexport HISTSIZE=1000000export SAVEHIST=1000000export HISTFILE="${TMPDIR}/.zhistory"## Zsh options#export LISTPROMPT           # in order to scroll if completion list is too bigsetopt auto_cd              # a command like % /usr/local is equivalent to cd /usr/localsetopt nohup                # don't send HUP signal when closing term sessionsetopt extended_glob        # in order to use #, ~ and ^ for filename generationsetopt always_to_end        # move to cursor to the end after completionsetopt notify               # report the status of backgrounds jobs immediatelysetopt correct              # try to correct the spelling if possiblesetopt rmstarwait           # wait 10 seconds before querying for a rm which contains a *setopt noflowcontrol        # disable xon/xoffsetopt histnostore          # don't store history command in historysetopt nobanghist           # don't care of '!' in commandssetopt emacs                # zle in emacs modesetopt pushdignoredups      # ignore dups in pushd stacksetopt auto_continue        # send SIGCONT to jobs disownedsetopt auto_list            # list choice on ambiguous commandsetopt auto_pushd           # cd = pushdsetopt pushd_ignore_dups    # ignore dups in pushdsetopt pushd_silent         # don't print stack after push/popsetopt bang_hist            # yeah ! expansion (use bash !$ for example)setopt chase_links          # cd to a symlink is in fact cd to the true dirsetopt ksh_option_print     # modify setopt outputsetopt long_list_jobs       # list jobs in long formatsetopt no_rm_star_wait      # dont't idle 10 seconds## Zle config## autoescape specials chars with urlsautoload -U url-quote-magiczle -N self-insert url-quote-magic# insert sudo at beggining of current commandinsert-sudo-prefix () {    local prefix    prefix='sudo'    if [ "${BUFFER:0:${#prefix}}" != "$prefix" ]; then        BUFFER="$prefix $BUFFER"        CURSOR=$(($CURSOR + $#prefix + 1))    fi}zle -N insert-sudo-prefixbindkey "^b" insert-sudo-prefix# make home and end keys work with tmuxbindkey "^[[H" beginning-of-linebindkey "^[[F" end-of-line## MOTD#if [[ -z "${TMUX}" ]] && [[ -z "${SUDO_UID}" ]]; then    if [[ -z "${LC_SSH_EMAIL}" || -z "${LC_SSH_FULLNAME}" ]]; then        printf "\n${COLOR_RED}You environment seems to not be properly configured: LC_SSH_EMAIL and LC_SSH_FULLNAME have to be set and forwarded through the ssh connection.${COLOR_RESET}\n"        exit 1    else        printf "\n${COLOR_LIGHT_GREEN}You are logged in as ${COLOR_YELLOW}${LC_SSH_FULLNAME}${COLOR_RESET} <${COLOR_YELLOW}${LC_SSH_EMAIL}${COLOR_RESET}>\n"    fi    if [[ ! -e "${SSH_AUTH_SOCK}" ]]; then        printf "${COLOR_LIGHT_YELLOW}Be warned that your ssh agent is not foarwarded${COLOR_RESET}\n"    fifi
 |