Zsh-autosuggestions: bindkey for autosuggest-accept doesn't work in tmux

Created on 21 Sep 2019  Â·  6Comments  Â·  Source: zsh-users/zsh-autosuggestions

Hi,

I have Ctrl-Space as bindkey for autosuggest-accept.

If I start tmux, Ctrl-Space stops working.

If I source ~/.zshrc, then the shortcut works.

I'm looking for a way to get the shortcut to work inside a tmux session without manual commands.

Anyone here using both autosuggestions and tmux?

Thanks

support

Most helpful comment

I've figured this out. The problem for me was that I was putting my bindkey '^\' autosuggest-excute statement right after plugins+=(zsh-autosuggestions) (to keep everything together), which is before the source $ZSH/oh-my-zsh.sh line. It seems that sourceing oh-my-zsh.sh somehow overwrites all previous bindkey statements (though I still don't know why re-sourceing temporarily fixes the problem). The solution is to move your bindkey statement below the source $ZSH/oh-my-zsh.sh line.

All 6 comments

Hi, does it work if you bind ctrl-space to a different widget?

bindkey '^@' self-insert

Then press ctrl-space. Does it insert ^@ into the buffer?

Apologies, I missed the notification for the answer.

I'm getting the same result with the above bindkey.

^@ is inserted, then I start tmux and it's no longer working, until I reload zsh config.

Ok thanks for following up. It sounds like this is just an issue with tmux and doesn’t have much to do with this plugin. I would try googling something like “tmux ctrl space” for further help.

I have the same problem and it does not matter what keybindings I assign to autosuggest-accept.
Currently, I source the zsh config every time I start a new tmux session. However, I think this not really a good workaround as it slows down startup time.

I've figured this out. The problem for me was that I was putting my bindkey '^\' autosuggest-excute statement right after plugins+=(zsh-autosuggestions) (to keep everything together), which is before the source $ZSH/oh-my-zsh.sh line. It seems that sourceing oh-my-zsh.sh somehow overwrites all previous bindkey statements (though I still don't know why re-sourceing temporarily fixes the problem). The solution is to move your bindkey statement below the source $ZSH/oh-my-zsh.sh line.

Thank you so much @samm81, this was indeed the solution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OmeGak picture OmeGak  Â·  3Comments

fgr0 picture fgr0  Â·  3Comments

srajasimman picture srajasimman  Â·  5Comments

clay-f picture clay-f  Â·  7Comments

NikKovIos picture NikKovIos  Â·  4Comments