2012-02-29 22 views
45

जब, बैश में, मेरे पास दो टर्मिनल खुलते हैं, प्रत्येक अपना इतिहास बनाए रखता है, इसलिए तीर-अप को मारना हमेशा उस टर्मिनल में दर्ज किया गया पिछला कमांड प्रस्तुत करता है।उसी टर्मिनल में अंतिम कमांड

zsh में इतिहास साझा किया जाता है, इसलिए तीर-अप टर्मिनल में दर्ज अंतिम आदेश प्रस्तुत करता है। मुझे लगता है कि ctrl-R मुझे पूर्ण, साझा इतिहास देता है, लेकिन क्या तीर-अप को सक्रिय टर्मिनल से अंतिम आदेश देने का कोई तरीका है?

+0

क्या इस पर कोई फैसला था? मुझे लगता है कि इस चाल के लिए एक साइट पर आ रहा है। आईएमओ यह डिफ़ॉल्ट व्यवहार होना चाहिए। – lang2

+0

दोनों के पास एक अच्छा विकल्प है: https://superuser.com/questions/446594/separate-up-arrow-lookback-for-local-and-global-zsh-history – Melebius

उत्तर

68

setopt क्या कहता है?

शायद आपके पास SHARE_HISTORY सेट विकल्प है।

आप इसे setopt no_share_history या unsetopt share_history से अनसेट कर सकते हैं।

अधिक विकल्प के लिए man zshoptions देखें।

+12

मुझे संदेह है कि बहुत से लोग यहां उतर सकते हैं (खुद की तरह) zsh इतिहास साझा करने के लिए एक रास्ता खोजते समय, और अभी भी उसी विंडो में _last_ कमांड दिखा रहा है जो पहले दिखा रहा है। – Excalibur

+1

उत्कृष्ट, जो मैं खोज रहा था, 'सेटोपेट' बहुत सहज नहीं है, मुझे कुछ सेट करने की उम्मीद थी 'setopt share_history 0' –

+0

@Excalibur आप सही हैं। क्या आपको कोई व्यवहार मिला कि इस व्यवहार को कैसे प्राप्त किया जाए? – lumbric

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 
संबंधित मुद्दे