Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block certain commands from being added to history #750

Open
TravisGM92 opened this issue Jul 14, 2023 · 3 comments
Open

Block certain commands from being added to history #750

TravisGM92 opened this issue Jul 14, 2023 · 3 comments

Comments

@TravisGM92
Copy link

Is your feature request related to a problem? Please describe.

After a long enough time the zsh history file becomes quite bloated, and many commands in the history are ones that are run over and over, i.e.: cd *, ls, etc.

Describe the solution you'd like

It would be great if we could configure autosugestions to not save certain commands.

Describe alternatives you've considered

The only alternative I currently see is going in the zsh_history file and removing the specific commands.

@graelo
Copy link

graelo commented Jul 20, 2023

Hi, I use the built-in HISTORY_IGNORE for this:

HISTORY_IGNORE="(l|l *|ls|ls *|cd|cd ..*|cd -|z *|pwd|exit)"

In the above, the following will be ignored

  • ls, ls somepath: I did not write ls* because I don't want to ignore all commands starting with the letters ls
  • same for the alias l
  • same for cd, but only for going up and back
  • etc

Does that meet your expectations?

@TravisGM92
Copy link
Author

@graelo that doesn't block it from being saved into the local history, right? It just blocks it from being displayed.

@graelo
Copy link

graelo commented Jul 20, 2023

Hi @TravisGM92,

With the above, the matched commands do not even make it to the history file.

I guess this is a bit stronger than what you initially had in mind.

PS: Thanks for this repo, this is sooo great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants