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
Missing feature: excluding certain commands from being added to history #5924
Comments
This is a duplicate of #2788, which we have decided against. One workaround is to abbreviate the command you always want to hide to begin with a space, which prevents it from being saved:
|
That workaround is not bullet proof. I guess you will tell me not to type |
What version are you running? Abbreviations could not be tab-completed before 3.0.0. |
3.0.2 |
Yesterday, I discussed things with Fabian, and he gave me a suggestion which I finalized like this:
This seems to work no matter if I tab-complete |
I have to trim when tab-completion, and I have to have the trim inside the history command because if there is nothing to trim there is a status 1 Fabian was first confused why there was an additional blank but he found #4908 which explains why. So this is the reason I must trim |
For the records. It seem that this works fine.
|
This is a re-run. I'd like to reconsider. The workaround has a lot of problems (not the least of which that it now requires trimming whitespace, but we want to do some normalization on history), so I'd like to provide some thing to make this easier. I don't think $HISTIGNORE is a great interface, but a function that we execute to ask whether an element should be added would be alright. E.g. function fish_should_add_history
for cmd in mplayer cd ls
string match -qr "^$cmd" -- $argv; and return 1
end
return 0
end Or alternatively we could make the "workaround" easier and nicer to use. Like not requiring |
I agree that HISTIGNORE is not really attractive and of course it is not along the philosophical lines of fish. I think my now functioning workaround is really just a workaround. So, your suggestion of offering a function whose return code decides if something gets added to the history of not, is best. |
I like the function idea as well. The default version of the function could implement the leading-spaces-dropped-from-history behavior. |
My export HISTIGNORE="vault write*" Here, the point is that no sensitive information will be recorded in command history |
Unfortunately, there is no good possiblity to exclude certain commands from being added to history.
bash
hasHISTIGNORE
.Could such a feature be added to fish? Of course, in a fish-like way instead of using a variable like in bash.
Thanks for considering.
The text was updated successfully, but these errors were encountered: