Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluding commands from being added to history #515

Closed
manfredlotz opened this issue Aug 31, 2022 · 5 comments · Fixed by #716
Closed

Excluding commands from being added to history #515

manfredlotz opened this issue Aug 31, 2022 · 5 comments · Fixed by #716
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@manfredlotz
Copy link

What is the best way to exclude commands to be added to history?

Using fish I modified _atuin_preexec like follows

function _atuin_preexec --on-event fish_preexec
    if string match -qr '^(cd|mpv|mplayer)' -- $argv
        return
    end
    set -gx ATUIN_HISTORY_ID (atuin history start "$argv[1]")
end

This seems to work.

Question: Is this a good way to do this, or could it be done in a better way?

@panekj
Copy link
Contributor

panekj commented Aug 31, 2022

prefix command with a space

@manfredlotz
Copy link
Author

Prefixing a command with a space is only good when I want to exclude a command in certain situations. Not, when I want to exclude a command each time I invoke it.

@conradludgate conradludgate added enhancement New feature or request good first issue Good for newcomers labels Sep 1, 2022
@conradludgate
Copy link
Collaborator

I think this is a decent idea. For now it could be based just on the program run, but in future we could support full regex syntax for the arguments too.

filter = ["cd", "mpv", "mplayer"]

@manfredlotz
Copy link
Author

Thanks for considering to implement this.

Is filter just an idea for the future or could it be used even now?

@conradludgate
Copy link
Collaborator

Just an idea for now

jbaiter added a commit to jbaiter/atuin that referenced this issue Feb 13, 2023
Adds a new `history_filter` setting through which users can specify a
list of regular expressions that match commands that should not be
recorded in the history.
jbaiter added a commit to jbaiter/atuin that referenced this issue Feb 13, 2023
Adds a new `history_filter` setting through which users can specify a
list of regular expressions that match commands that should not be
recorded in the history.
jbaiter added a commit to jbaiter/atuin that referenced this issue Feb 13, 2023
Adds a new `history_filter` setting through which users can specify a
list of regular expressions that match commands that should not be
recorded in the history.
conradludgate pushed a commit that referenced this issue Feb 14, 2023
Adds a new `history_filter` setting through which users can specify a
list of regular expressions that match commands that should not be
recorded in the history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants