Open dvorka opened 9 years ago
@dvorka any chance this can be top priority? I've been waiting for this to be done. I think I can help with this, but not sure it would meet your standard.
@livibetter thank you for letting me know - I would not expected that anybody would like it! I already have it partially implemented in a local branch (but I put it aside in January as it was a nice to have feature for me). I appreciate your will to help :+1: however, I should be able to finish it pretty soon. Thank you once again!
@dvorka great to hear that you have already done something locally, git pull
awaits!
@livibetter I just pushed an initial version of the blacklist. To activate loading of command blacklist from ~/.hh_blacklist
please add blacklist keyword to your hh configuration like export HH_CONFIG=hicolor,blacklist
. File ~/.hh_blacklist
contains one blacklist item on each line (there should be empty line at the end of the file). You can run ./hh --show-blacklist
to show what is actually used + you may check man for what's new: cd $HH_DISTRO_HOME/man && man ./hh.1)
Please give it a try and let me know what you think.
Thanks & enjoy!
@dvorka I've tried 0a326250c60707cc6a78ea043ab025fd63608a92, it does work, but, honestly, it's not enough of blacklisting power.
I wonder if it's possible to switch to regular expression other than plain string. The reasons:
For example, the default ones show the limitation already:
I can see each blacklisted command has two entries, for instance, 'cd'
and 'cd '
. If we had regex, it only takes half of the amount of entries.
If we had regex, the following might also be resolved easier, if full line match is required, we could do like ^cd ?$
if this is the version of regex in hstr.
It's comparing the entire line i.e. blacklist must ==
the line.
In my case, one example is the directory switching script, which would be like cmd <bookmark name>
, and since hh
only can remove when it's completely match from the beginning to the end of line, there is no way I can blacklist that script.
I have more than one command which fall into this scenario. And prefixing a space is also out of question to be a workaround.
Few extra notes:
-h
, man hh
, and other documentations don't say the blacklist only applies on view:ranking
. I spent some time before I realized view:history
gives complete/non-blacklisted history.-b
or --show-blacklist
list the blacklist items in an unexpected order, which isn't the order in the ~/.hh_blacklist
nor alphabetically. The latter which I prefer, but it just shows in a way I don't like, although I can just | sort
.@livibetter thank you for the comprehensive feedback - I like it! Please stay tuned.
Instead of keeping the blacklist on the source code, make it load from an external configuration file so that it is configurable by user.