Make Oh My Zsh history play nicely with WebStorm / IntelliJ
Disappearing history entries were bugging me for a long time. I would try to look for a command that I KNEW i recently typed, but it was gone.
Today I felt that enough is enough. I noticed I had a different command history in iterm, different in WebStorm, and on top of that none of them had the command I was looking for.
After a quick investigation it looks like WebStorm is mostly to blame, since its "shell integration" functionality overwrites some settings set up by ohmyzsh, in particular, file to which write history.
Additionally, I believe both WebStorm and OhMyZsh by default write to history on a successful terminal exit. Which tends to be problematic if your sessions don't quit cleanly, or frequently :)
export HISTFILE=~/.zsh_history export HISTFILESIZE=1000000000 export HISTSIZE=1000000000 setopt APPEND_HISTORY setopt INC_APPEND_HISTORY
at the end of your ~/.zshrc file.
The first line is most important and you can possibly skip the other ones. It forces WebStorm to use the same history file.
As for the ones about Hist Size - I've increased the limits, since I'm not sure what's the point of removing old entries - they are also possibly a useful source of information. With how fast and large our SSD harddrives are, I don't expect this become problematic for years :) And if the history seems to get slower, I can always trim it.
APPEND_HISTORY and INC_APPEND_HISTORY are possibly already happening, and are responsible for adding commands to the history file as they happen, but I don't trust WebStorm anymore not to mess with the settings in the future, so I decided to add them here just to be safe.
One last thing, let's merge the histories together (hacky way, and the history will not be in order, but it worked for me):
# back up your current history: cp ~/.zsh_history ~/.zsh_history.bak # Run this from a terminal tab inside IDE and make sure it references a file from WebStorm/IntelliJ folder echo $HISTFILE # If it does, run: cat `echo $HISTFILE` >> ~/.zsh_history # to merge the histories together. If something went wrong, you can restore the old history: # mv ~/.zsh_history.bak ~/.zsh_history
Feel free to let me know if what I'm doing here is crazy - it definitely fixed my issue.
Let us help you on your journey to Quality Faster
We at Xolv.io specialize in helping our clients get more for less. We can get you to the holy grail of continuous deployment where every commit can go to production — and yes, even for large enterprises.
Here are the things we offer:
Services (we help you)
- Custom Software Development
Whether you're looking to create a proof-of-concept or build an entire new capability, we can help you get there at speed and with high quality.
- Apollo GraphQL Consulting
We can help in all areas related to Apollo GraphQL and surrounding technologies including Apollo Federation, One-graph unification, Domain Driven Design, µService deployment, automated testing, security, performance, and more.
- Continuous Delivery Coaching
We have made it our business to help organizations modernize their technologies stacks and processes to gain speed, stability, and quality improvements, especially in enterprises where legacy systems seem impossible to deal with.
Products (you help yourself)
XSpecs is a full-team collaborative toolset that simplifies the writing of specifications and integrates them into your team's existing workflow. This helps you improves velocity, decreases bugs, and increases quality.
- Quality Faster
A complete full-team, full-cycle and full-stack guide to help you and your team increase the speed at which you deliver software while simultaneously increasing quality.
Have something else in mind? Get in touch.
Testing with DynamoDB Toolbox
Creating Tables with DynamoDB Toolbox
Instantly update your Lambda functions (development)