Closed dasebasto closed 2 years ago
While I love Python and it slice syntax, I don’t think it’s suitable for a shell command. I might implement it like this:
hist d -3 -1 # delete last 3 lines
hist d -10 -2 # delete last 10 lines, except the most recent one
hist d 1500 1510 # delete lines with index 1500 to 1510
Or perhaps with the indexes reversed.
I probably won’t implement your suggestion with minutes. That seems prone to errors.
It's there! hist
now accepts any number of selection arguments. So, to specify a range, just use normal zsh
brace notation:
hist d -{1..3} # delete last 3 lines
hist d -{10..2} # delete last 10 lines, except the most recent one
hist d {1500..1510} # delete lines with index 1500 to 1510
As you can see, the order of the arguments does not matter.
PS: If you enjoy using my software, please consider sponsoring me. 🙂
Very nice plugin, thanks!
I'd like to delete ranges of command lines from the history.
The use case is that it usually takes a lot of trial and error before building the perfect complex one-liner (e.g. a text processing command with regex). I want to keep the good command in history and delete the incorrect tentatives.
Python slice notation syntax could be convenient:
e.g:
Maybe brackets can be omitted for an even more concise syntax.
Another suggestion, with probably less potential for popularity, but which would be practical in many cases: