atuin icon indicating copy to clipboard operation
atuin copied to clipboard

Excluding commands from being added to history

Open manfredlotz opened this issue 2 years ago • 5 comments

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?

manfredlotz avatar Aug 31 '22 17:08 manfredlotz

prefix command with a space

panekj avatar Aug 31 '22 17:08 panekj

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.

manfredlotz avatar Aug 31 '22 17:08 manfredlotz

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"]

conradludgate avatar Sep 01 '22 06:09 conradludgate

Thanks for considering to implement this.

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

manfredlotz avatar Sep 01 '22 16:09 manfredlotz

Just an idea for now

conradludgate avatar Sep 01 '22 16:09 conradludgate