Add ZSH suggestions and aliases

This commit is contained in:
tancou 2020-09-19 14:13:04 +02:00
parent f5d630c025
commit c06958d066
4 changed files with 42 additions and 1 deletions

View File

@ -2284,6 +2284,26 @@ For configuration information, visit the [bash-git-prompt repository](https://gi
**Note** You can configure Oh My ZSH by editing the `/home/laradock/.zshrc` in running container. **Note** You can configure Oh My ZSH by editing the `/home/laradock/.zshrc` in running container.
> With the ZSH autosuggestions plugin.
[ZSH autosuggestions plugin](https://github.com/zsh-users/zsh-autosuggestions) suggests commands as you type based on history and completions.
1 - Enable ZSH as described previously
2 - Set `SHELL_OH_MY_ZSH_AUTOSUGESTIONS` to `true`
3 - Rebuild and use ZSH as described previously
> With bash aliases loaded.
Laradock provides aliases through the `aliases.sh` file located in the `laradock/workspace` directory. You can load it into ZSH.
1 - Enable ZSH as described previously
2 - Set `SHELL_OH_MY_ZSH_ALIASES` to `true`
3 - Rebuild and enjoy aliases
<br> <br>
<a name="phpstorm-debugging"></a> <a name="phpstorm-debugging"></a>
## PHPStorm Debugging Guide ## PHPStorm Debugging Guide

View File

@ -63,6 +63,8 @@ services:
args: args:
- CHANGE_SOURCE=${CHANGE_SOURCE} - CHANGE_SOURCE=${CHANGE_SOURCE}
- SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH} - SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH}
- SHELL_OH_MY_ZSH_AUTOSUGESTIONS=${SHELL_OH_MY_ZSH_AUTOSUGESTIONS}
- SHELL_OH_MY_ZSH_ALIASES=${SHELL_OH_MY_ZSH_ALIASES}
- UBUNTU_SOURCE=${UBUNTU_SOURCE} - UBUNTU_SOURCE=${UBUNTU_SOURCE}
- BASE_IMAGE_TAG_PREFIX=${WORKSPACE_BASE_IMAGE_TAG_PREFIX} - BASE_IMAGE_TAG_PREFIX=${WORKSPACE_BASE_IMAGE_TAG_PREFIX}
- LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHP_VERSION=${PHP_VERSION}

View File

@ -83,6 +83,8 @@ DOCKER_SYNC_STRATEGY=native_osx
# If you want to use "Oh My ZSH!" with Laravel autocomplete plugin, set SHELL_OH_MY_ZSH to true. # If you want to use "Oh My ZSH!" with Laravel autocomplete plugin, set SHELL_OH_MY_ZSH to true.
SHELL_OH_MY_ZSH=false SHELL_OH_MY_ZSH=false
SHELL_OH_MY_ZSH_AUTOSUGESTIONS=false
SHELL_OH_MY_ZSH_ALIASES=false
########################################################### ###########################################################
################ Containers Customization ################# ################ Containers Customization #################

View File

@ -1424,6 +1424,9 @@ RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \
apt install -y zsh \ apt install -y zsh \
;fi ;fi
ARG SHELL_OH_MY_ZSH_AUTOSUGESTIONS=false
ARG SHELL_OH_MY_ZSH_ALIASES=false
USER laradock USER laradock
RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \ RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --keep-zshrc" && \ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --keep-zshrc" && \
@ -1439,7 +1442,21 @@ bindkey "^[[3~" delete-char\n\
bindkey "^[[4~" end-of-line\n\ bindkey "^[[4~" end-of-line\n\
bindkey "^[[5~" up-line-or-history\n\ bindkey "^[[5~" up-line-or-history\n\
bindkey "^[[6~" down-line-or-history\n\ bindkey "^[[6~" down-line-or-history\n\
bindkey "^?" backward-delete-char\n' >> /home/laradock/.zshrc \ bindkey "^?" backward-delete-char\n' >> /home/laradock/.zshrc && \
if [ ${SHELL_OH_MY_ZSH_AUTOSUGESTIONS} = true ]; then \
sh -c "git clone https://github.com/zsh-users/zsh-autosuggestions /home/laradock/.oh-my-zsh/custom/plugins/zsh-autosuggestions" && \
sed -i 's~plugins=(~plugins=(zsh-autosuggestions ~g' /home/laradock/.zshrc && \
sed -i '1iZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20' /home/laradock/.zshrc && \
sed -i '1iZSH_AUTOSUGGEST_STRATEGY=(history completion)' /home/laradock/.zshrc && \
sed -i '1iZSH_AUTOSUGGEST_USE_ASYNC=1' /home/laradock/.zshrc && \
sed -i '1iTERM=xterm-256color' /home/laradock/.zshrc \
;fi && \
if [ ${SHELL_OH_MY_ZSH_ALIASES} = true ]; then \
echo "" >> /home/laradock/.zshrc && \
echo "# Load Custom Aliases" >> /home/laradock/.zshrc && \
echo "source /home/laradock/aliases.sh" >> /home/laradock/.zshrc && \
echo "" >> /home/laradock/.zshrc \
;fi \
;fi ;fi
USER root USER root