From f673b618351b76360bfcb3fec3fb5978af7b05bf Mon Sep 17 00:00:00 2001 From: Tom Clark Date: Mon, 22 Aug 2022 12:57:23 +0100 Subject: [PATCH] ENH: Add improved terminal annotation via zsh spaceship --- .zshrc | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 7 ++++++ 2 files changed, 69 insertions(+) create mode 100644 .zshrc diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..06d4ef2 --- /dev/null +++ b/.zshrc @@ -0,0 +1,62 @@ + +# OH MY ZSH + +# Path to your oh-my-zsh installation. +export ZSH=$HOME/.oh-my-zsh + +ZSH_THEME="spaceship" + +SPACESHIP_PROMPT_ORDER=( + exec_time + node + dir + git + char +) + +SPACESHIP_PROMPT_FIRST_PREFIX_SHOW="true" +SPACESHIP_PROMPT_ADD_NEWLINE="false" +SPACESHIP_PROMPT_SEPARATE_LINE="false" +SPACESHIP_CHAR_SYMBOL="$ " +SPACESHIP_CHAR_COLOR_SUCCESS="white" +SPACESHIP_USER_SHOW="never" +SPACESHIP_USER_PREFIX="" +SPACESHIP_USER_COLOR="green" +SPACESHIP_USER_SUFFIX="" +SPACESHIP_HOST_SHOW="never" +SPACESHIP_HOST_PREFIX="@" +SPACESHIP_HOST_SUFFIX="" +SPACESHIP_HOST_COLOR="red" +SPACESHIP_DIR_PREFIX=":" +SPACESHIP_DIR_SUFFIX="" +SPACESHIP_DIR_TRUNC="0" +SPACESHIP_DIR_TRUNC_REPO="true" +SPACESHIP_DIR_COLOR="blue" +SPACESHIP_GIT_PREFIX=" " +SPACESHIP_GIT_BRANCH_PREFIX="" +SPACESHIP_GIT_BRANCH_COLOR="green" +SPACESHIP_PYENV_SYMBOL="" +SPACESHIP_PYENV_PREFIX="" +SPACESHIP_PYENV_SUFFIX=" " +SPACESHIP_PYENV_SYMBOL="py v" +SPACESHIP_PYENV_COLOR="magenta" +SPACESHIP_EXEC_TIME_PREFIX="Took " +SPACESHIP_EXEC_TIME_SUFFIX="\n" + +# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git + git-prompt + history + python +) + +source $ZSH/oh-my-zsh.sh + + +# GIT ALIASES +echo "Spaceship symbols are at https://github.com/spaceship-prompt/spaceship-prompt" +echo "Git aliases are at https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git" diff --git a/Dockerfile b/Dockerfile index e2f9121..7c1f54c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -90,6 +90,13 @@ RUN if [ "${INSTALL_DEV_TOOLS}" = "true" ]; then \ -a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \ -a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' \ ; fi + +# Install spaceship theme and terminal prompt onto oh-my-zsh +RUN if [ "${INSTALL_DEV_TOOLS}" = "true" ]; then \ + git clone https://github.com/spaceship-prompt/spaceship-prompt.git "/home/vscode/.oh-my-zsh/custom/themes/spaceship-prompt" --depth=1 && \ + ln -s "/home/vscode/.oh-my-zsh/custom/themes/spaceship-prompt/spaceship.zsh-theme" "/home/vscode/.oh-my-zsh/custom/themes/spaceship.zsh-theme" \ + ; fi +COPY ./.zshrc /home/vscode # The non-root user defined in the devcontainer.json file needs write permission to /usr/local/src # in order for poetry to install git dependencies (this is where it clones them).