Terminal does not execute the selected command but instead shows `atuin search -i again`

I’m new to atuin and am having an issue.

When i press CTRL+R I can search commands.
In the following example i searched for man atuin

I then press enter.

I would have expected the command man atuin to be called. However, as you can see from the screenshow below, it displays the atuin search -i, with what I assume is the stdout with man atuin. The command main atuin is not called.

image

I use atuin v18.0.1 on zsh with starship.rs on a mac.

If you run atuin search -i and select a command, it will just print it to stdout.

To get atuin to execute the command, it needs to be called by the script that we bind to the keybinding CTRL+R in the init script.

Can you confirm whether you’re running atuin search -i yourself or whether you are using the keybinding that Atuin sets up in your init file with atuin init zsh? See Installation | Atuin Docs

Hello @arcuru,

Thank you for answering my question.

I call atuin search -i by my .zshrc config.

The following is my .zshrc config with everything removed except the parts for atuin.

function atuin-search-widget() {
    BUFFER="atuin search -i"
    zle accept-line
}

zle -N atuin-search-widget

eval "$(atuin init zsh)"

bindkey '^R' atuin-search-widget

I do not think you should have these lines in your config. As advised by the documentation above, you should keep only the eval ... and optionally the bindkey which can be accompanied by additional mode settings, as described in the documentation for key bindings. It should create the function for you, without the need to manually define it.

2 Likes

I applied your suggestion and worked for the whole day without any issues. Thank you @Adda

That is great to hear. If you have more issues, do not hesitate to ask. Wish you all the best :heart: