Command line not cleared on Ctrl-R

Hello, I have just started using Atuin (after reading Ellie’s blogpost about going fulltime on Atuin development I guess) and I like the idea. :+1:

Now, I used to use Ctrl-R which works nicely in Atuin except one quirk: if I have started to write something to the command line and then press Ctrl-R, Atuin keeps the line as a new search and me typing adds to the line. Without Atuin, pressing Ctrl-R + typing something would erase the already-entered text.

Illustration (one big screenshot as I was not able to attach more than one file :cry: ):

Of course, I can delete the whole line and start search afresh but if there was a config param to influence this behaviour, it’ll save me some clicks.

Atuin: v17.2.1
Shell: Bash with bash-preexec

Thanks!

Welcome to the community!

I see! Honestly I always just figured people would want to keep what they’ve typed as the start of the query

We could totally make this configurable, but first I just want to understand the use case a little better if that’s ok? What are you normally doing when you’ve typed something, and then invoke ctrl-r?

Are you searching for something relevant to what you’ve typed, or just wanting to start again?

Hello @ellie, thanks for the welcome and the reply.

What are you normally doing when you’ve typed something, and then invoke ctrl-r?
Are you searching for something relevant to what you’ve typed, or just wanting to start again?

Yeah, this is more like a habit of me pre-Atuin:

  • I know I want to repeat a command
  • I press Up-Arrow and see that’s not the one I want
  • I press Ctrl-R and search for the other command – this search ignores the current command line content (at least in bash and zsh)
  • when I find it I press Enter

Now, with the current Atuin (I have --disable-up-arrow in atuin init) when I press Up-Arrow and see that’s not the command I want, I have to remember pressing Ctrl-C to “erase” the line before Ctrl-R to start searching with an empty search; or else I will end up with the command line content in atuin history search and I need to long-press Backspace to start from empty …

It may look silly and I understand your reasoning. These are just years of muscle memory so not easy to unlearn. :slight_smile:

We could totally make this configurable

Would be awesome.

I hope I made it clearer.

Thanks.

2 Likes

Totally makes sense, thank you! I’ll move this to Ideas

1 Like

For the moment I worked around this by slightly patching the shell functions generated by atuin:

eval "$(atuin init zsh --disable-up-arrow | sed 's/ATUIN_QUERY=$BUFFER//')"

Thanks for the tip but it did not work for me. :cry:

I replaced the atuin init in my ~/.bashrc (~/.bash-preexec.sh exists):

source "$HOME/.atuin/bin/env"
eval "$(starship init bash)"
[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh
# eval "$(atuin init bash --disable-up-arrow)"
eval "$(atuin init zsh --disable-up-arrow | sed 's/ATUIN_QUERY=$BUFFER//')"

and I got something like:

autoload: command not found
add-zsh-hook: command not found
add-zsh-hook: command not found
...
Command 'zle' not found, did you mean:
  command 'mle' from snap mle-editor (1.5.0)
  command 'mle' from deb mle (1.4.3-2)
  command 'ale' from deb ale (0.9.0.3-5)
  command 'le' from deb le (1.16.8-0.1)
  command 'zile' from deb zile (2.6.2-2)
  command 'zl' from deb zenlisp (2013.11.22-3)
  command 'gle' from deb gle-graphics (4.2.5-9)
See 'snap info <snapname>' for additional versions.
bindkey: command not found
bindkey: command not found
bindkey: command not found

That zle comes from:

atuin init zsh --disable-up-arrow|grep zle
    zle -I
    zle reset-prompt
            zle accept-line
        zle up-line
zle -N atuin-search _atuin_search
zle -N atuin-search-vicmd _atuin_search_vicmd
zle -N atuin-search-viins _atuin_search_viins
zle -N atuin-up-search _atuin_up_search
zle -N atuin-up-search-vicmd _atuin_up_search_vicmd
zle -N atuin-up-search-viins _atuin_up_search_viins
zle -N _atuin_search_widget _atuin_search
zle -N _atuin_up_search_widget _atuin_up_search

It could be something in my setup, dunno, leaving for now.

My atuin is version 18.3.0.