Merge pull request #2533 from dbfun/feature-oh-my-zsh

new feature: Install Oh My ZSH! with Laravel autocomplete plugin
This commit is contained in:
Shao Yu-Lung (Allen) 2020-04-07 08:55:19 +08:00 committed by GitHub
commit dc0d970e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 7 deletions

View File

@ -2162,8 +2162,27 @@ A bash prompt that displays information about the current git repository. In par
**Note** You can configure bash-git-prompt by editing the `workspace/gitprompt.sh` file and re-building the workspace container.
For configuration information, visit the [bash-git-prompt repository](https://github.com/magicmonty/bash-git-prompt).
<br>
<a name="Install-Oh-My-Zsh"></a>
## Install Oh My ZSH! with Laravel autocomplete plugin
[Zsh](https://en.wikipedia.org/wiki/Z_shell) is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.
[Oh My Zsh](https://ohmyz.sh/) is a delightful, open source, community-driven framework for managing your Zsh configuration.
[Laravel autocomplete plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/laravel) adds aliases and autocompletion for Laravel Artisan and Bob command-line interfaces.
1 - Open the `.env` file
2 - Search for the `SHELL_OH_MY_ZSH` argument under the Workspace Container
3 - Set it to `true`
4 - Re-build the container `docker-compose build workspace`
5 - Use it `docker-compose exec --user=laradock workspace zsh`
**Note** You can configure Oh My ZSH by editing the `/home/laradock/.zshrc` in running container.
<br>
<a name="phpstorm-debugging"></a>

View File

@ -60,6 +60,7 @@ services:
context: ./workspace
args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH}
- UBUNTU_SOURCE=${UBUNTU_SOURCE}
- LARADOCK_PHP_VERSION=${PHP_VERSION}
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}

View File

@ -78,6 +78,12 @@ UBUNTU_SOURCE=aliyun
# If you are using Docker Sync. For `osx` use 'native_osx', for `windows` use 'unison', for `linux` docker-sync is not required
DOCKER_SYNC_STRATEGY=native_osx
### Install Oh My ZSH! ####################################
# If you want to use "Oh My ZSH!" with Laravel autocomplete plugin, set SHELL_OH_MY_ZSH to true.
SHELL_OH_MY_ZSH=false
###########################################################
################ Containers Customization #################
###########################################################

View File

@ -1304,6 +1304,37 @@ RUN if [ ${INSTALL_GIT_PROMPT} = true ]; then \
RUN set -xe; php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
###########################################################################
# Oh My ZSH!
###########################################################################
USER root
ARG SHELL_OH_MY_ZSH=false
RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \
apt install -y zsh \
;fi
USER laradock
RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --keep-zshrc" && \
sed -i -r 's/^plugins=\(.*?\)$/plugins=(laravel5)/' /home/laradock/.zshrc && \
echo '\n\
bindkey "^[OB" down-line-or-search\n\
bindkey "^[OC" forward-char\n\
bindkey "^[OD" backward-char\n\
bindkey "^[OF" end-of-line\n\
bindkey "^[OH" beginning-of-line\n\
bindkey "^[[1~" beginning-of-line\n\
bindkey "^[[3~" delete-char\n\
bindkey "^[[4~" end-of-line\n\
bindkey "^[[5~" up-line-or-history\n\
bindkey "^[[6~" down-line-or-history\n\
bindkey "^?" backward-delete-char\n' >> /home/laradock/.zshrc \
;fi
USER root
#
#--------------------------------------------------------------------------
# Final Touch