Search code examples
terminalzshoh-my-zsh

Why does my widget in oh-my-zsh does not exist although I can see it if displaying widget based on keybinding?


I try to add a widget to zsh. I am using oh-my-zsh. If I check the keybinding to which I assigned my widget It shows me the correct widget. But if I list all widgets I cannot see the widget to which I assigned the keybinding. My expected result is that I can see the widget but instead I cannot see the widget. If I try to call the widget with my assigned keybinding I get an error.

Displaying widget based on keybinding

bindkey "^d" >> "^D" create_completion

listing widgets

zle -al. >> displays list of widgets (does not contain create_completion)

Calling widget with keybinding

^d >> No such widget `create_completion'


Solution

  • My problem was that I had defined in my .zshrc file already earlier my plugins variable wich overwrote the plugins variable where I defined my widget from which the error occurred. All the plugins need to be written in one plugin variable.

    In .zshrc file:

    Wrong

    plugins=(git)
    plugins=(zsh_copilot)
    

    Correct

    plugins=(git zsh_copilot)