Last command in same terminal

When, in Bash, I have two terminals open, each maintain its own history, so hitting arrow-up always presents the previous command entered in that terminal.

In zsh the history is shared, so arrow-up presents the last command entered in either terminal. I rather like that ctrl-R gives me the full, shared history, but is there a way to make arrow-up give me the last command from the active terminal?


What says setopt ?

Maybe you have the option SHARE_HISTORY set.

You can unset it with setopt no_share_history or unsetopt share_history.

For more options look in man zshoptions.


I can't help you directly, but in my terminals, the command history is one for one terminal, so it's behavior you will expect. Below I print out my .zshrc file. Please play with it. I run my terminals with Yakuake.

# The following lines were added by compinstall

bindkey -v

bindkey -M viins '^r' history-incremental-search-backward
bindkey -M vicmd '^r' history-incremental-search-backward


#http://grml.org/zsh/zsh-lovers.html
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache



zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' original true
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:cd:*' ignore-parents parent pwd
zstyle :compinstall filename '/home/borys/.zshrc'
zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes

autoload colors; colors
setopt autocd
setopt extendedglob


autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# End of lines configured by zsh-newuser-install

# opens txt files in vi
alias -s txt=vi

#shortcuts for going up in directories hierarchy
alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'

alias d="dirs -v"
setopt PUSHD_IGNORE_DUPS
setopt AUTO_PUSHD
DIRSTACKSIZE=14



alias findfn="find -type f -name "
alias duall="du -s ./* | sort -n| cut -f 2-|xargs -i du -sh {}"

#prompt theme 
COLOR_RESET="%{$reset_color%}"
PS1="$fg_bold[black][%n@%m:$fg[blue]%~]
$COLOR_RESET%%"
PS2=$PS1
  # PS1=[%n@%m:%2~]

# color stderr
exec 2>>(while read line; do
  print '\e[91m'${(q)line}'\e[0m' > /dev/tty; print -n $'\0'; done &)

#show vi mode in prompt
function zle-line-init zle-keymap-select {
#fg_light_red=$'%{\e[5;25m%}'

#    RPS1="$fg_light_red ${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
#    RPS2=$RPS1
#    PS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}
#[%n@%m:%2~]"
PS1="${${KEYMAP/vicmd/$COLOR_RESET}/(main|viins)/$fg_bold[black]}[%n@%m:$fg[blue]%~]
$COLOR_RESET%%"
    PS2=$PS1
    zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select

export SVN_EDITOR=vi