Skip to content

Feature request: searching (deleting) by exact string match #3177

@keysmashes

Description

@keysmashes

I have a shell alias oops which removes the last command from history (implementation: history delete --exact --case-sensitive -- $history[1]). I'd like to add Atuin support to it (since having to press ctrl-r, ctrl-o, ctrl-d, esc as well as running oops feels a bit much), but I can't find any way to ask Atuin to forget about the last command I ran.

I was hoping to be able to atuin search --filter-mode session --limit 1 --delete to delete the last command from this session, but that's not possible: #1436. atuin search --filter-mode session --search-mode full-text $history[1] --delete is closer, but it's still not right: the full-text search mode is actually a substring search (so deleting a typo'd j would delete any command containing a j!). prefix is similarly bad, and I don't think it's possible to escape an entire command line for the fuzzy or skim modes in a way that will only match that exact string.

Is there any way to achieve this currently? (Looking at the code, I don't actually really understand why --delete and --limit wouldn't work together...) If not: could there be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions