Skip to content

history delete function seems inadequate for common use cases #5791

Closed

Description

@crabdancing

Using fish version 3.0.2-661-g6e525cc5d on Arch Linux with uxterm.

The main thing I find myself using history delete for is clearing a password from the shell history. Thus it would be reasonable to expect it to be easy to delete, say, the last 10 lines from history, or the history from the current session (but spare all other history).

But the interface expects me to delete by search term instead, which wastes time when I could have just typed history clear-session or something like history delete -10 (to delete the last 10 lines, ideally without it bringing up a confirmation thing).

What does everyone think?

Activity

  1. floam commented on Apr 3, 2019

    @floam
    Member

    If we made $history not read-only, this could be done with set -e history[1..10].

  2. mqudsi commented on Apr 3, 2019

    @mqudsi
    Contributor

    But this isn't a complaint about the inability to modify the history variable, rather the unfriendliness of the history builtin.

  3. crabdancing commented on Apr 3, 2019

    @crabdancing
    Author

    But this isn't a complaint about the inability to modify the history variable, rather the unfriendliness of the history builtin.

    Yeah, exactly. I was a little bit incredulous reading the docs because I strongly expected it to have a function for clearing only the current session or for clearing the last X number of lines... I half expected someone to tell me that there was such a function that wasn't documented, which is why I didn't phrase this as a feature request.

  4. added this to the fish-future milestone on Apr 3, 2019
  5. floam commented on Apr 3, 2019

    @floam
    Member

    It seems like a reasonable feature request to me.

  6. RealFerdinandDeSaussure commented on Apr 4, 2019

    @RealFerdinandDeSaussure

    How about this elegant and not at all hacky workaround in the meantime:

    for i in $history[1..10]
        history delete --exact --case-sensitive -- "$i"
    end
    
  7. crabdancing commented on Apr 11, 2019

    @crabdancing
    Author

    @InspectorMustache That works great for now! I'll wrap it in a temporary function until this is fixed. ^.^ Thanks for the suggestion.

  8. mqudsi commented on Apr 11, 2019

    @mqudsi
    Contributor

    I think a nice approach (that would also address some of the concerns in #5482) would be to make a bare history delete trigger a read prompt for keywords to sanitize from the history, which would a) be easier to use, and b) take care of the privacy hole whereby history delete foo deletes foo from history but re-introduces it with a new history delete foo entry in history

    I also like the idea of a separate history clear-session in addition to the existing history clear, this one wouldn't even need to ask for confirmation as it's No Big Deal™.

  9. faho commented on Apr 26, 2019

    @faho
    Member

    bare history delete trigger a read prompt for keywords to sanitize from the history, which would a) be easier to use, and b) take care of the privacy hole whereby history delete foo deletes foo from history but re-introduces it with a new history delete foo entry in history

    One problem: We keep a separate read history.

    @mqudsi: That'll probably need to have some change for your mysql -uuser -p(read) idea.

  10. ridiculousfish commented on Apr 28, 2019

    @ridiculousfish
    Member

    +1 to history clear-session

  11. added a commit that references this issue on Jun 6, 2019
  12. faho commented on Jun 6, 2019

    @faho
    Member

    Yeah, I don't think #5904 is quite enough. I'd still like a history subcommand to forget the last couple of entries, up to the session (though I'm not sure if we currently have that definition?)

  13. reopened this on Jun 6, 2019
  14. added a commit that references this issue on Dec 12, 2021
  15. faho commented on Jan 27, 2023

    @faho
    Member

    history clear-session was merged in #8337, #9454 asks for dropping history via the pager.

  16. removed this from the fish-future milestone on Jan 27, 2023
  17. locked as resolved and limited conversation to collaborators on May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions