私は2つの端末を開いていますが、それぞれが独自の履歴を保持しているため、矢印を押すとその端末に入力された前のコマンドが常に表示されます。同じ端末の最後のコマンド
zshでは履歴が共有されているため、矢印アップではどちらの端末にも最後に入力されたコマンドが表示されます。私はむしろctrl-Rが私に完全な共有履歴を与えてくれるのが好きですが、アクティブな端末からの最後のコマンドを矢印で表示する方法はありますか?
私は2つの端末を開いていますが、それぞれが独自の履歴を保持しているため、矢印を押すとその端末に入力された前のコマンドが常に表示されます。同じ端末の最後のコマンド
zshでは履歴が共有されているため、矢印アップではどちらの端末にも最後に入力されたコマンドが表示されます。私はむしろctrl-Rが私に完全な共有履歴を与えてくれるのが好きですが、アクティブな端末からの最後のコマンドを矢印で表示する方法はありますか?
setopt
氏は述べていますか?
おそらく、オプションSHARE_HISTORY
が設定されている可能性があります。
setopt no_share_history
またはunsetopt share_history
で設定を解除できます。
その他のオプションについてはman zshoptions
をご覧ください。
私はあなたに直接手伝ってはいけませんが、私の端末では、コマンド履歴は1つの端末のためのものなので、期待する動作です。以下は私の.zshrc
ファイルを印刷します。それと遊んでください。私は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][%[email protected]%m:$fg[blue]%~]
$COLOR_RESET%%"
PS2=$PS1
# PS1=[%[email protected]%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 --}
#[%[email protected]%m:%2~]"
PS1="${${KEYMAP/vicmd/$COLOR_RESET}/(main|viins)/$fg_bold[black]}[%[email protected]%m:$fg[blue]%~]
$COLOR_RESET%%"
PS2=$PS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
export SVN_EDITOR=vi
この件に関する評決はありましたか?私はこのトリックのためにサイトを訪れることを覚えているようです。 IMOこれはデフォルトの動作でなければなりません。 – lang2
両方を持っていると良いオプション:https://superuser.com/questions/446594/separate-up-arrow-lookback-for-local-and-global-zsh-history – Melebius