ohmyzsh: No, I dont want share history.
SOLUTION
The solution to this is appending the command unsetopt share_history to your zshrc file (make sure to put it at the bottom of the file; that is, after OMZ has been loaded).
2376022 removed I reverted the change. You can still fix this by putting share_history from OMZ. Just omz update.unsetopt share_history in your zshrc file, after OMZ is loaded.
you have
setopt share_history
on libs/history.szh.
The thing is that once enable there no seems to be a way to disable it. On my .zshrc I tried appending at the end of file:
setopt share_history Off setopt share_history 0
It doesnt work, the only way is disabling it on the history.zsh file but… that means i wont get updates for it =)
So what is the correct way? are you sure users expect this to be enabled by default?? It’s very anoying for me
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 225
- Comments: 48 (12 by maintainers)
Commits related to this issue
- lib: remove share_history Related: #2537, #9324 — committed to ohmyzsh/ohmyzsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to shlomif/oh-my-zsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to abhinandkr/ohmyzsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to msmafra/ohmyzsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to sevenever/ohmyzsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to dpond/ohmyzsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to avpalmeira/ohmyzsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to grantstephens/oh-my-zsh by mcornella 4 years ago
- don't share history accross ZSH sessions Disable sharing of history between multiple shell (ZSH) sessions (probably set somewhere by oh-my-zsh). See https://github.com/ohmyzsh/ohmyzsh/issues/2537 . — committed to mr-month/dotfiles by mr-month 3 years ago
- lib: remove share_history Related: #2537, #9324 — committed to tinogomes/ohmyzsh by mcornella 4 years ago
- lib: remove share_history Related: #2537, #9324 — committed to tekniklr/oh-my-zsh by mcornella 4 years ago
Well, you could check the zsh documentation for a start… http://zsh.sourceforge.net/Doc/Release/Options.html
setopt no_share_historyorunsetopt share_historythis solved the issue for me:
Agreed. This is driving me nuts. I have many terminals into many servers and the commands from each (usually ssh commands) are all getting mushed together. I now regularly go back to
bashbecause this irritates me so. Please make the default match other shells!https://github.com/ohmyzsh/ohmyzsh/commit/23760228908d14a4644718869d5ebfb7b0dde6a7 removed
share_historyfrom OMZ. Justomz update.Rant: Can we warn people before doing breaking changes like this one? I have used the zsh shared history feature for years (it’s one of the things I like most about zsh) and to have it turn off suddenly and without any warning is quite disruptive.
Why is this a default? Nothing else does this and there’s not even a use-case for this…
Agreed with others that this option should default to
false. It is not consistent with the convention of other shells.Perhaps it should be disabled by default (it’s not the default for bash on MacOS).
No luck, tried both at the very end of my
~/zshrc:Hello everybody! Is it possible to leave this option commented? I mean, if somebody (like me) wants to disable the history sharing, it’s only a matter of uncomment the lines.
It’s the third time this hits me, and the third time I have to search internet because I forgot the option 😛
I can do a PR if you agree.
It should be
.zshrcwhere you put this. Then restart all open shell sessions.Exactly: Oh My Zsh sets the
share_historyoption, so you have to unset that after OMZ has been loaded. I’ve updated the original post to contain the clear solution.This did not work for me. I have tried both of these in my .zshrc:
unsetopt share_historysetopt no_share_historyI also created a .zsh_profile with the same lines above which still had no affect.I had to do as OP suggested and delete the line in .oh-my-zsh/lib/history.zsh (which I guess will be undone in the next update)
Could this be an environmental difference? I’m running iTerm2 on OSX 10.10.5
Was surprised to see shared history after changing from zsh to ohmyzsh. Since I tend to have multiple open terminals, each running a different process, sharing history doesn’t fit too well with my workflow.
confirmed,zsh 5.7.1 version,share history command removed
if you need shared history command,you can add command to .zshrc file or add command to ~/.oh-my-zsh/lib/history.zsh file
execute command
use unsetopt SHARE_HISTORY
in your .zshrc file
Sorry, I misread your comment. Did you append that at the end of the file?
share_history has not been removed, macOS still have the setop flag, 😦
@mcornella @robbyrussell, I see this issue as well. I tried appending the unsetopt share_history at the bottom of .zshrc and still same issue
It might in the future, why not just add it to the
.zshrcfile (after OMZ is sourced)? It’s much more portable and cleaner.or in .zshrc file add command
I notice from the docs that it says:
INC_APPEND_HISTORY_TIME
This option is a variant of INC_APPEND_HISTORY in which, where possible, the history entry is written out to the file after the command is finished, so that the time taken by the command is recorded correctly in the history file in EXTENDED_HISTORY format. This means that the history entry will not be available immediately from other instances of the shell that are using the same history file.
This option is only useful if INC_APPEND_HISTORY and SHARE_HISTORY are turned off. The three options should be considered mutually exclusive.
…
SHARE_HISTORY <K>
This option both imports new commands from the history file, and also causes your typed commands to be appended to the history file (the latter is like specifying INC_APPEND_HISTORY, which should be turned off if this option is in effect). The history lines are also output with timestamps ala EXTENDED_HISTORY (which makes it easier to find the spot where we left off reading the file after it gets re-written).
Is it intentional that INC_APPEND_HISTORY and SHARE_HISTORY are both set in oh-my-zsh?
@JohnnyWalkerDesign, I’ve a created an issue on StackOverflow which better illustrates, what i’n truing to achieve: https://stackoverflow.com/questions/48873643/how-to-stop-zsh-from-merging-history-for-all-closing-tabs
@mcornella Oh thank you for the tip. It was the ordering. This was driving me nuts. 🌻