maxime:openbsd:docs:zsh

Fichier de configuration

.zshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=1000
setopt autocd beep nomatch
unsetopt appendhistory extendedglob notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/maxime/.zshrc'
 
autoload -Uz compinit
compinit
# End of lines added by compinstall
 
# UNIX variables.
# $PATH taken from the OpenBSD 5.3 default ~/.profile file.
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
#TERM="xterm-color"
VISUAL=/usr/local/bin/vim
EDITOR=/usr/local/bin/vim
PAGER=/usr/bin/less
 
# OpenBSD specific variables.
PKG_PATH=http://ftp.fr.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/
CVSROOT=anoncvs@anoncvs.fr.openbsd.org:/cvs
 
# Prompt.
PS1="%F{cyan}%n%f@%F{green}%m%f %B%F{white}%2d%f%b %% "
#PS2
#PS3
#PS4
 
# Locale.
LC_CTYPE=fr_FR.UTF-8
LANG=fr_FR.UTF-8
 
# Working HOME and END keys.
# Taken from <http://zshwiki.org/home/zle/bindkeys>.
# ---------------------------------
autoload zkbd
function zkbd_file() {
    [[ -f ~/.zkbd/${TERM}-${VENDOR}-${OSTYPE} ]] && printf '%s' ~/".zkbd/${TERM}-${VENDOR}-${OSTYPE}" && return 0
    [[ -f ~/.zkbd/${TERM}-${DISPLAY}          ]] && printf '%s' ~/".zkbd/${TERM}-${DISPLAY}"          && return 0
    return 1
}
 
[[ ! -d ~/.zkbd ]] && mkdir ~/.zkbd
keyfile=$(zkbd_file)
ret=$?
if [[ ${ret} -ne 0 ]]; then
    zkbd
    keyfile=$(zkbd_file)
    ret=$?
fi
if [[ ${ret} -eq 0 ]] ; then
    source "${keyfile}"
else
    printf 'Failed to setup keys using zkbd.\n'
fi
unfunction zkbd_file; unset keyfile ret
 
# setup key accordingly
[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
[[ -n "${key[End]}"     ]]  && bindkey  "${key[End]}"     end-of-line
[[ -n "${key[Insert]}"  ]]  && bindkey  "${key[Insert]}"  overwrite-mode
[[ -n "${key[Delete]}"  ]]  && bindkey  "${key[Delete]}"  delete-char
[[ -n "${key[Up]}"      ]]  && bindkey  "${key[Up]}"      up-line-or-history
[[ -n "${key[Down]}"    ]]  && bindkey  "${key[Down]}"    down-line-or-history
[[ -n "${key[Left]}"    ]]  && bindkey  "${key[Left]}"    backward-char
[[ -n "${key[Right]}"   ]]  && bindkey  "${key[Right]}"   forward-char
# ---------------------------------
 
# Colors.
 
# Completion.
 
# Key bindings.
alias ll='colorls -GlAhF'
.zlogin
/usr/bin/calendar -A 0 -f /usr/share/calendar/calendar.all

Configuration

The function will not be run in future, but you can run
it yourself as follows:
  autoload -Uz zsh-newuser-install
  zsh-newuser-install -f
maxime@save /home/maxime % touch .zshenv .zprofile .zlogout

Ordre d'exécution des fichiers de configuration (cf http://zsh.sourceforge.net/FAQ/zshfaq03.html#l19) :

  • login shell : .zshenv ⇒ .zprofile ⇒ .zshrc ⇒ .zlogin ;
  • interactive shell : .zshenv ⇒ .zshrc ;
  • zsh -f : .zshenv.

Bibliographie

  • maxime/openbsd/docs/zsh.txt
  • Dernière modification: 2021/10/08 00:17
  • (modification externe)