I recently updated my VSCode to the latest version and found that the zsh history is not working anymore. That’s how it looks when running the history
command with only a few commands showing up.
When running echo $HISTFILE
, it shows some random path that I don’t recognize. It should be ~/.zsh_history
instead.
Others have reported the same issue on the VSCode GitHub repo for VS Code 1.74.0.
https://github.com/microsoft/vscode/issues/168396
The solution is to add the following line to your ~/.zshrc
file to set the HISTFILE
variable explicitly.
HISTFILE="$HOME/.zsh_history"
After that, run source ~/.zshrc
to reload the configuration file. Now the HISTFILE
variable should be set correctly thus the zsh history is working again.