Last command in the same terminal

When I have two terminals open in Bash, each of them saves its own history, so pressing the arrow always represents the previous command entered into this terminal.

In zsh, the story is shared, so the up arrow displays the last command entered at any terminal. I like that ctrl-R gives me a complete, general history, but is there a way to make an arrow to give me the last command from the active terminal?

+45
zsh
Feb 29 2018-12-12T00:
source share
2 answers

What does setopt ?

Perhaps you have the SHARE_HISTORY option.

You can disable it using setopt no_share_history or unsetopt share_history .

See man zshoptions more options.

+68
Mar 01 2018-12-12T00:
source share

I cannot help you directly, but in my terminals the command history is one for one terminal, so you will expect this behavior. Below I print my .zshrc file. Please play with him. I run my terminals using 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 
+1
Feb 29 '12 at 19:57
source share



All Articles