deluan / zsh-in-docker

Install Zsh, Oh-My-Zsh and plugins inside a Docker container with one line!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no such widget history-substring-search-up

jhwohlgemuth opened this issue · comments

First of all, great script! Actually, great project! I love that you have tests.

My issue is when using the up arrow to navigate history, I get no such widget history-substring-search-up
(similar for down arrow)

I was able to "fix" the issue by adding -p history-substring-search to my Dockerfile.

Seeing as how the default zshrc template includes

bindkey "\$terminfo[kcuu1]" history-substring-search-up
bindkey "\$terminfo[kcud1]" history-substring-search-down

...you might want to also auto include the history-substring-search plugin?

If I am missing something obvious, please educate me. Either way, thanks for sharing this project.

Thanks for using the script!

You are right! I fixed that manually in my Dockerfile (with the "fix" you proposed), and forgot to fix the script!

I didn't fix it right away because I'm not sure what is the best way to handle it: I want to keep the installed plugins to a minimum, but if you install plugins that require changes in the .zshrc, what would be the best way to apply does changes? Maybe passing a script to be appended to the generated .zshrc?

Do you have any ideas?

I can appreciate your desire to "...keep the installed plugins to a minimum...". Makes sense and I feel the same way.

Thinking on this for a bit, I see a few possibilities...

Ideas (in no particular order):

  1. Remove history-substring-search-specific code from .zshrc template and leave more detailed customizing to post build (by end user)
  2. Remove history-substring-search-specific code from .zshrc template and add new optional argument for passing plugin-specific lines to be added to .zshrc template.

Example for option 2:

RUN sh -c "$(wget -O- https://raw.githubusercontent.com/deluan/zsh-in-docker/master/zsh-in-docker.sh)" \
    -p history-substring-search \
    -a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \
    -a 'bindkey "\$terminfo[kcuu1]" history-substring-search-down'

a stands for "append" but could be whatever strikes your fancy

  1. Remove history-substring-search-specific code from .zshrc template and add functionality for zsh-in-docker script to provide extra customization to .zshrc template based on what plugins user passes in Dockerfile.

Example for option 3: the following would add the necessary "bindkey" lines to the .zshrc template:

RUN sh -c "$(wget -O- https://raw.githubusercontent.com/deluan/zsh-in-docker/master/zsh-in-docker.sh)" \
    -p history-substring-search
  1. Add history-substring-search plugin to .zshrc template and accept that this project is slightly more "opinonated", similar to option 1, leave more detailed customizing to post build (by end user)

My thoughts:

  1. Low effort. Arguably best answer. Personally, I did not use history-substring-search plugin before, but I will from now on 🤓
  2. More effort than option 1. Provides good compromise of effort on the part of zsh-in-docker and desires of the end user.
  3. Tremendous effort (and will most likely never be good enough). Really cool, but probably not viable.
  4. Similar effort as option 1. Arguably best answer.

Realistically, option 1 and 4 are two sides of the same coin and both could be argued as the "best". Personal philosophy will determine whether to choose 1 or 4 🤔

Yeah, your thoughts are similar to mine :)
I'll probably go with option 2, will try to tackle this issue this week.

Thanks!