mattmc3 / antidote

https://getantidote.github.io - the cure to slow zsh plugin management
MIT License
855 stars 21 forks source link

Can't get history-substring-search to look at the .zsh_history file? #150

Closed Pikabyte closed 1 year ago

Pikabyte commented 1 year ago

Sorry if this is a really bad place to put it, but I'm really not sure what's wrong since it worked fine with Oh My ZSH, but for some reason doesn't after I switched from it to Antidote. And maybe this is actually on the plugins end, not sure. (I was sick of the slow shell startup.)

However, for some reason I can't get it to actually use the .zsh_history file, and I'm not sure why. It seems like it works for the current session's history, but it doesn't actually take from my main history.

I'm really sorry if this is a stupid question and/or if this isn't the place to ask.

mattmc3 commented 1 year ago

If you like how OMZ handled your Zsh history, you could just include that with antidote.

ohmyzsh/ohmyzsh path:lib/history.zsh

If you're trying to get away from OMZ completely, you could also choose to use the history plugin from Zsh-Utils or Zephyr:

# you could use zephyr
mattmc3/zephyr path:plugins/history

# or zsh-utils
belak/zsh-utils path:history
Pikabyte commented 1 year ago

i guess i'm just confused how to get it to actually use the history file though? there doesn't seem to be a config option for it in the plugin itself, and i'm not sure what those plugins would do to solve the issue.

EDIT: Thanks for the clue! I looked into what omz was doing, and realized all I had to do was

export HISTFILE="$HOME/.zsh_history"
export HISTSIZE=50000
export SAVEHIST=10000

Man, it took hours trying to figure out what I was doing wrong with nothing working. I had no idea OMZ actually messed with how history works, and admittedly somehow assumed it was just the default.

mattmc3 commented 1 year ago

What these plugins do for you is set history variables (HISTFILE, HISTSIZE, and SAVEHIST) as well as Zsh history options that make the history behave like you want. Options like setopt INC_APPEND_HISTORY, which writes to your history file immediately. You don't have to use a plugin - you could also set up all this yourself, but it's easier to start with something already designed to work well. You can read more about Zsh history here.