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
Allow overriding filter and search modes from CLI #635
Allow overriding filter and search modes from CLI #635
Conversation
src/shell/atuin.bash
Outdated
bind -x '"\e[A": __atuin_history' | ||
bind -x '"\eOA": __atuin_history' | ||
bind -x '"\e[A": __atuin_history --filter-mode session' | ||
bind -x '"\eOA": __atuin_history --filter-mode session' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, an alternative may be to have an additional configuration setting for filter mode when interactive mode is invoked via up key bindings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure which would be the best way to tell atuin that it invoked from the up key binding between:
- adding a
--shell-up-key-binding
CLI argument:Suggested changebind -x '"\eOA": __atuin_history --filter-mode session' bind -x '"\eOA": __atuin_history --shell-up-key-binding' - defining a
ATUIN_SHELL_UP_KEY_BINDING
environment variable:
bind -x '"\eOA": __atuin_history --filter-mode session' | |
bind -x '"\eOA": ATUIN_SHELL_UP_KEY_BINDING=1 __atuin_history' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a slight preference for hardcoding --filter-mode session
in the init scripts, since up
is for looking for a previous command and ctrl-r
is for searching the history.
Using a --shell-up-key-binding
argument is a good alternative if you want the configs to be in the config file instead of requiring users to customize the shell script. I don't think we should use an environment variable for this, you can always just make the CLI argument hidden from the help functions if that's the concern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather configure this in our config file, and globally for all shells (not just bash). I'd also be pretty happy for --shell-up-key-binding
to be how it's invoked!
I have a slight preference for hardcoding --filter-mode session in the init scripts, since up is for looking for a previous command and ctrl-r is for searching the history.
I think generally I'd agree with you there @patricksjackson, but I'm also a little cautious to change defaults at this point without a strong opinion for why. Currently I mostly feel lukewarm on the topic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for writing this! I've had this on my backlog ever since I started using Atuin.
src/shell/atuin.bash
Outdated
bind -x '"\e[A": __atuin_history' | ||
bind -x '"\eOA": __atuin_history' | ||
bind -x '"\e[A": __atuin_history --filter-mode session' | ||
bind -x '"\eOA": __atuin_history --filter-mode session' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a slight preference for hardcoding --filter-mode session
in the init scripts, since up
is for looking for a previous command and ctrl-r
is for searching the history.
Using a --shell-up-key-binding
argument is a good alternative if you want the configs to be in the config file instead of requiring users to customize the shell script. I don't think we should use an environment variable for this, you can always just make the CLI argument hidden from the help functions if that's the concern.
c29d493
to
30511bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this 🙌 Generally happy with it, just one small suggested then it's good to go imo
src/shell/atuin.bash
Outdated
bind -x '"\e[A": __atuin_history' | ||
bind -x '"\eOA": __atuin_history' | ||
bind -x '"\e[A": __atuin_history --filter-mode session' | ||
bind -x '"\eOA": __atuin_history --filter-mode session' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather configure this in our config file, and globally for all shells (not just bash). I'd also be pretty happy for --shell-up-key-binding
to be how it's invoked!
I have a slight preference for hardcoding --filter-mode session in the init scripts, since up is for looking for a previous command and ctrl-r is for searching the history.
I think generally I'd agree with you there @patricksjackson, but I'm also a little cautious to change defaults at this point without a strong opinion for why. Currently I mostly feel lukewarm on the topic
Hi, I've implemented the discussed changes:
I've also kept the default to be It would be great if fish and/or zsh user could validate the changes, as I only use bash. |
1461768
to
303cc99
Compare
…ell_up_key_binding configuration option to allow customizing the filter mode used when atuin is invoked from a shell up-key binding
303cc99
to
3cea079
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing! Then I'm happy to get this merged
This PR allows overriding filter and search modes from CLI arguments:
The bash up key bindings are updated to always use
session
filter mode when invoking atuin, and that choice may not be acceptable by other.TODO: