* how to clean a history entry? @ 2005-01-03 2:17 Toshiro 2005-01-04 18:40 ` Peter Stephenson 0 siblings, 1 reply; 5+ messages in thread From: Toshiro @ 2005-01-03 2:17 UTC (permalink / raw) To: zsh-users Hi! I've just moved from bash to zsh (I got tired of bash's poor command completion) and this shell is awesome! I have one problem though, I didn't find the way to remove a specific entry from the history ( in bash I can easily do this with the command 'history -d <item_nr>'). Anybody know how to do this? Toshiro. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to clean a history entry? 2005-01-03 2:17 how to clean a history entry? Toshiro @ 2005-01-04 18:40 ` Peter Stephenson 2005-01-04 19:04 ` Toshiro 2005-01-04 21:03 ` Wayne Davison 0 siblings, 2 replies; 5+ messages in thread From: Peter Stephenson @ 2005-01-04 18:40 UTC (permalink / raw) To: zsh-users (Back from holiday, too.) Toshiro wrote: > I have one problem though, I didn't find the way to remove a specific entry > from the history ( in bash I can easily do this with the command 'history -d > <item_nr>'). > > Anybody know how to do this? Hmm, I don't think this is too easy. If you know in advance that you don't want to save an entry, you can set the option histignorespace and enter a space before the command. (Note that it won't disappear until you enter a new command; the immediately preceeding command is always still available with this option.) Otherwise, you can save the history (fc -A to append to what's there, fc -W to overwrite), delete the line from the history file, and read it with fc -R. That can probably be turned into a function. It's a bit clumsy. Might not be difficult to add as a feature, since internally history is held as a linked list. I can certainly see the use in it when you're reexecuting chunks of the history. -- Peter Stephenson <pws@pwstephenson.fsnet.co.uk> Work: pws@csr.com Web: http://www.pwstephenson.fsnet.co.uk ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to clean a history entry? 2005-01-04 18:40 ` Peter Stephenson @ 2005-01-04 19:04 ` Toshiro 2005-01-04 21:03 ` Wayne Davison 1 sibling, 0 replies; 5+ messages in thread From: Toshiro @ 2005-01-04 19:04 UTC (permalink / raw) To: zsh-users Hello Peter, > > I have one problem though, I didn't find the way to remove a specific > > entry from the history ( in bash I can easily do this with the command > > 'history -d <item_nr>'). > > > > Anybody know how to do this? > > Hmm, I don't think this is too easy. > > If you know in advance that you don't want to save an entry, you can set > the option histignorespace and enter a space before the command. (Note > that it won't disappear until you enter a new command; the immediately > preceeding command is always still available with this option.) > > Otherwise, you can save the history (fc -A to append to what's there, fc > -W to overwrite), delete the line from the history file, and read it > with fc -R. That can probably be turned into a function. It's a bit > clumsy. > > Might not be difficult to add as a feature, since internally history is > held as a linked list. I can certainly see the use in it when you're > reexecuting chunks of the history. It would be very nice to add this as a feature! Do you know what is the proper procedure to request it to developers? I really use that feature in bash; sometimes I forgot to add the space in sensitive commands that I don't want to appear in the history (like typing passwords). Nevertheless, it's a small inconvenience in comparison with all the benefits I get from zsh :) Regards, Toshiro. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to clean a history entry? 2005-01-04 18:40 ` Peter Stephenson 2005-01-04 19:04 ` Toshiro @ 2005-01-04 21:03 ` Wayne Davison 2005-01-11 16:28 ` Felix Rosencrantz 1 sibling, 1 reply; 5+ messages in thread From: Wayne Davison @ 2005-01-04 21:03 UTC (permalink / raw) To: Peter Stephenson; +Cc: zsh-users On Tue, Jan 04, 2005 at 06:40:10PM +0000, Peter Stephenson wrote: > Might not be difficult to add as a feature, since internally history > is held as a linked list. I can certainly see the use in it when > you're reexecuting chunks of the history. The basic idea would be quite easy to implement, but it gets a little more complicated if the user is using an option such as SHARE_HISTORY since the history item might have already made its way into other shell instances through the shared history file. I suppose just making the current shell dump the line and then re-writing the history file to remove the line would be a good enough first implementation, though (as the user could manually deal with any propagation of the command). And, as long as I'm talking about history-related items, it would be nice to brain-storm some ideas on how to improve the recall of desirable prior commands. I tend to use HIST_IGNORE_SPACE and an absurd amount of leading-space commands to keep my history list limited to mainly just the commands that I think I will need to re-run. I also use the kill ring and Ctrl-Q to remember various commands that I need to re-run in the near term, but that I don't want to get in the way of my use of Ctrl-R to find prior well-used commands. This means that I tend to inconvenience myself by needing to take extra steps to re-run less-used commands, and that I don't use word-delete much at all. It would be nice to improve on this somehow (perhaps via options that I'm not aware of) so that the history could go back to being a list of all the (non-sensitive) commands I typed and still allow me to find my favorite commands easily. Perhaps some sort of a "bookmark" system that allows me to store off and recall my most favorite commands. Or perhaps a way to search through the history in most-used order (in addition to most-recent order) so that a recently-run rsync command doesn't get in the way of my most-used rsync commands (unless I want it to). It would be nice to have a way to specify user-selectable matching for commands that should not be stored. Perhaps even a rewriting system that could let a command be stored, but with its sensitive info XXXed out (allowing the user to re-run it by just re-inserting the missing info). And an option to expire the history list based on LRU order might be good too. Does any of that sound good? Am I missing some existing zsh features? Any other ideas for how to make command-reuse easier? ..wayne.. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to clean a history entry? 2005-01-04 21:03 ` Wayne Davison @ 2005-01-11 16:28 ` Felix Rosencrantz 0 siblings, 0 replies; 5+ messages in thread From: Felix Rosencrantz @ 2005-01-11 16:28 UTC (permalink / raw) To: Wayne Davison, zsh-users I wouldn't mind hearing additional ideas on finding previous history lines. Some of the widgets that exist now could be improved (like incremental search, and "infer"ing, ) I've started a rough draft of some ideas I've had about improving incremental search on the wiki: http://zshwiki.org/ImprovedIncrementalSearch The "infer" widgets seem ripe for improvement. Currently those widgets only use one simple strategy based on the previous history line. There are several other simple schemes that could be used for inferring lines from the history (e.g. inferring based on a deeper matching into history, or searching a previously primed area of history or a file, looking further back for other matches.) Also, the infer widgets could build a list of possible choices that be cycled through. Also maybe mechanisms to make automatic edits to previous command lines to make new commands lines that are wanted. With incremental search and inferring you have two history lines, the one that is found, and the one that is actually "accept"ed. With two lines it is possible to look at the difference and maybe infer a likely edit, or at least where the user might want to edit. -FR. On Tue, 4 Jan 2005 13:03:01 -0800, Wayne Davison <wayned@users.sourceforge.net> wrote: > On Tue, Jan 04, 2005 at 06:40:10PM +0000, Peter Stephenson wrote: > > Might not be difficult to add as a feature, since internally history > > is held as a linked list. I can certainly see the use in it when > > you're reexecuting chunks of the history. > > The basic idea would be quite easy to implement, but it gets a little > more complicated if the user is using an option such as SHARE_HISTORY > since the history item might have already made its way into other shell > instances through the shared history file. I suppose just making the > current shell dump the line and then re-writing the history file to > remove the line would be a good enough first implementation, though (as > the user could manually deal with any propagation of the command). > > And, as long as I'm talking about history-related items, it would be > nice to brain-storm some ideas on how to improve the recall of desirable > prior commands. I tend to use HIST_IGNORE_SPACE and an absurd amount of > leading-space commands to keep my history list limited to mainly just > the commands that I think I will need to re-run. I also use the kill > ring and Ctrl-Q to remember various commands that I need to re-run in > the near term, but that I don't want to get in the way of my use of > Ctrl-R to find prior well-used commands. This means that I tend to > inconvenience myself by needing to take extra steps to re-run less-used > commands, and that I don't use word-delete much at all. > > It would be nice to improve on this somehow (perhaps via options that > I'm not aware of) so that the history could go back to being a list of > all the (non-sensitive) commands I typed and still allow me to find my > favorite commands easily. Perhaps some sort of a "bookmark" system that > allows me to store off and recall my most favorite commands. Or perhaps > a way to search through the history in most-used order (in addition to > most-recent order) so that a recently-run rsync command doesn't get in > the way of my most-used rsync commands (unless I want it to). It would > be nice to have a way to specify user-selectable matching for commands > that should not be stored. Perhaps even a rewriting system that could > let a command be stored, but with its sensitive info XXXed out (allowing > the user to re-run it by just re-inserting the missing info). And an > option to expire the history list based on LRU order might be good too. > > Does any of that sound good? Am I missing some existing zsh features? > Any other ideas for how to make command-reuse easier? > > ..wayne.. > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-11 16:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-01-03 2:17 how to clean a history entry? Toshiro 2005-01-04 18:40 ` Peter Stephenson 2005-01-04 19:04 ` Toshiro 2005-01-04 21:03 ` Wayne Davison 2005-01-11 16:28 ` Felix Rosencrantz
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).