Skip to content

Instantly share code, notes, and snippets.

@elijahmanor
Last active August 16, 2018 19:29
Show Gist options
  • Select an option

  • Save elijahmanor/b647e91fcddb1e48d28e46ed430bc909 to your computer and use it in GitHub Desktop.

Select an option

Save elijahmanor/b647e91fcddb1e48d28e46ed430bc909 to your computer and use it in GitHub Desktop.
Custom Spaceship Section for npm Version
SPACESHIP_PACKAGE_SHOW=false
SPACESHIP_NODE_SHOW=true
SPACESHIP_DOCKER_SHOW=false
# NPM VERSION
SPACESHIP_NPM_SHOW="${SPACESHIP_NPM_SHOW=true}"
SPACESHIP_NPM_PREFIX=""
SPACESHIP_NPM_SUFFIX=" "
SPACESHIP_NPM_SYMBOL="${SPACESHIP_NPM_SYMBOL="📦 "}"
SPACESHIP_NPM_COLOR="${SPACESHIP_NPM_COLOR="yellow"}"
spaceship_npm() {
[[ $SPACESHIP_NPM_SHOW == false ]] && return
spaceship::exists npm || return
local 'npm_status'
npm_status=$(npm -v)
spaceship::section \
"$SPACESHIP_NPM_COLOR" \
"$SPACESHIP_NPM_PREFIX" \
"$SPACESHIP_NPM_SYMBOL$npm_status" \
"$SPACESHIP_NPM_SUFFIX"
}
SPACESHIP_PROMPT_ORDER=(
time # Time stampts section
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
package # Package version
node # Node.js section
ruby # Ruby section
elixir # Elixir section
xcode # Xcode section
swift # Swift section
golang # Go section
php # PHP section
rust # Rust section
haskell # Haskell Stack section
julia # Julia section
docker # Docker section
aws # Amazon Web Services section
venv # virtualenv section
conda # conda virtualenv section
pyenv # Pyenv section
dotnet # .NET section
ember # Ember.js section
kubecontext # Kubectl context section
npm # !!!!!!!!!!MY NEW NPM SECTION!!!!!!!!!!
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
# Set Spaceship ZSH as a prompt
autoload -U promptinit; promptinit
prompt spaceship
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment