Page 1 sur 1

[zsh] problème de sauvegarde d'historique (résolu)

Publié : dim. 29 avr. 2012, 16:27
par tradjincal
Bonjour,

je viens de passer depuis peu sur zsh, et je viens de me rendre compte qu'aucune commande n'était écrite dans le fichier correspondant (chez moi c'est ~/.zhistory). Il me semble avoir mis les bonnes variables dans le fichier .zshrc (en particulier HISTFILE, SAVEHIST et HISTSIZE).

Une idée?

Merci d'avance.

Voici mon .zshrc:

Code : Tout sélectionner

#######################################
# Completion
#######################################

## Enabling completion
autoload -U compinit
compinit

zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*' menu select=2

## Autocompletion for aliases
setopt complete_aliases

## Enabling correction
#setopt correctall

## Ignore case and symbols
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* 
r:|=*' 'l:|=* r:|=*'

#######################################
# Customizing
#######################################

## Enabling advanced prompts
autoload -U promptinit
promptinit

## Custom prompt
PROMPT="[%B%n%b-%T @ %3~ ]%(#,#,$) "

## Setting TERM env variable (for color output)
#TERM="xterm-256color"

# ls color
alias ls='ls --color=auto'
alias grep='grep --color=auto'

# Load .dir_color (color for each extention file)
# from https://github.com/seebi/dircolors-solarized
eval `dircolors .dir_colors`

#######################################
# History settings
#######################################

## History configuration
HISTFILE="~/.zhistory"
SAVEHIST=1000
HISTSIZE=1000

## Settings ignoring of duplicates
setopt histignorealldups

## History appends to existing file incrementally
setopt incappendhistory 

# Import new commands from HISTFILE
setopt sharehistory

# When searching, not dispay duplicate line
setopt HIST_FIND_NO_DUPS

# Remove superfluous blanks
setopt HIST_REDUCE_BLANKS

# Share history
setopt SHARE_HISTORY

#######################################

## Error if glob fails to match
setopt nomatch 

## Asynchronous job control messages
setopt notify

## Setting autocd option
setopt autocd

## Unset error beeping
unsetopt beep

#######################################
# Special keys
#######################################
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[4~" end-of-line # End
bindkey "\e[5~" beginning-of-history # PageUp
bindkey "\e[6~" end-of-history # PageDown
bindkey "\e[2~" quoted-insert # Ins
bindkey "\e[3~" delete-char # Del
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "\e[Z" reverse-menu-complete # Shift+Tab
# for rxvt
bindkey "\e[7~" beginning-of-line # Home
bindkey "\e[8~" end-of-line # End
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
# for guake
bindkey "\eOF" end-of-line
bindkey "\eOH" beginning-of-line
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5C" forward-word
bindkey "\e[3~" delete-char # Del

bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward

#######################################
# Alias
#######################################

alias untar='tar xzvf'
alias so='source'
alias ll='ls -lha'

Re: [zsh] problème de sauvegarde d'historique

Publié : dim. 29 avr. 2012, 17:58
par Nic0
Salut,

Pas certain que se soit la solution, mais dans mon .zshrc j'ai:

Code : Tout sélectionner

export HISTFILE=~/.zsh_history
export HISTSIZE=5000
export SAVEHIST=5000
La différence est (peut être) dans le export.
Sinon, tu peux vérifier tes variables en écrivant dans le shell: echo $HISTFILE

Re: [zsh] problème de sauvegarde d'historique

Publié : dim. 29 avr. 2012, 18:30
par tradjincal
Salut,
ça marche.

Je n'ai pas encore d'explication .

EDIT: d'après ce que je viens de lire le export permet de définir une variable d'environement plutot qu'un simple assignement.

En tout cas merci de m'avoir mis sur la piste.

Re: [zsh] problème de sauvegarde d'historique

Publié : dim. 29 avr. 2012, 21:26
par Nic0
De rien.

:resolu: :copain: