27

Im using oh-my-zsh and there is a feature that is really annoying me. The history is share for each console. I want to disable that and after a review i found that

.oh-my-zsh/lib/history.zsh

has this:

setopt share_history # share command history data

How should I disable this? I mean, what is the RIGHT way. It is a lib not a plugin, if I edit the file I will not get updates for it.

Arnold Roa
  • 7,335
  • 5
  • 50
  • 69

3 Answers3

45

This question is old but anyway:

As you can use setopt for setting options, you can use unsetopt to unset them.

Just add

unsetopt share_history

after having sourced $ZSH/oh-my-zsh.sh

(and yes, it's really annoying ;) )

Tomasz Jakub Rup
  • 10,502
  • 7
  • 48
  • 49
jcsd
  • 481
  • 6
  • 3
2

I mean, what is the RIGHT way. It is a lib not a plugin, if I edit the file I will not get updates for it.

The accepted answer is the easiest way, but it bears mentioning that oh-my-zsh lets you override any file or plugin you want by putting it in $ZSH_CUSTOM - even stuff in lib. If you want to do more than just unsetopt share_history you could run this:

# $ZSH_CUSTOM should already be automatically set to $ZSH/custom
# but you can customize the location in your ~.zshrc.
# ie: export ZSH_CUSTOM=~/.zsh_custom

# set up lib in omz custom area
mkdir -p $ZSH_CUSTOM/lib

# start off with omz version of the file
cp $ZSH/lib/history.zsh $ZSH_CUSTOM/lib/history.zsh

# edit that file and make it what you want
${EDITOR:-vim} $ZSH_CUSTOM/lib/history.zsh
mattmc3
  • 17,595
  • 7
  • 83
  • 103
-1

If you want to override an internal lib of oh-my-zsh completely, there is a wiki entry for it: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-internals

Basically you would put an empty file at $ZSH_CUSTOM/lib/history.zsh to disable that lib.

xeruf
  • 2,602
  • 1
  • 25
  • 48