Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Breaking changes (order, colors, suffixes) #78

Merged
merged 66 commits into from
May 7, 2017
Merged

Conversation

denysdovhan
Copy link
Member

@denysdovhan denysdovhan commented Apr 4, 2017

Implementation of custom prompt ordering. See #71 for more information.


UPD: This PR is going to introduce the biggest internal changes since Spaceship's first release. Here's the list of changes:

  • Better comments (file is divided by the section)
  • _exists helper
  • Custom ordering using $SPACESHIP_PROMPT_ORDER variable.
  • Prefixes for time and user sections
  • Suffixes options (exposed as $SPACESHIP_*_SUFFIX variables)
  • Custom coloring (exposed as $SPACESHIP_*_COLOR variables)
  • _prompt_section is used for drawing sections
  • user, host and dir sections are standalone
  • Internal functions are prefixes with _
  • nvmnode ⬢ n support #70
  • $SPACESHIP_NODE_DEFAULT_VERSION for default Node.js version What if the user don't use nvm? #33
  • New, slightly better prompt character instead of
  • git -> git_branch + git_status with their own prefixes, suffixes and colors
  • is used as a git symbol (for visual difference with ☿ Mercurial support #54)
  • Better installer
  • Add uninstaller
  • Installing via NPM
  • Add .editorconfig

@denysdovhan denysdovhan added the new-feature A PR that implement feature (section, specific behavior, etc). label Apr 4, 2017
@denysdovhan denysdovhan self-assigned this Apr 4, 2017
@denysdovhan denysdovhan force-pushed the custom-ordering branch 2 times, most recently from 511d459 to 937b7cc Compare April 4, 2017 12:19
Asigment character looks much more obvious than minus
in this context.
@salmanulfarzy
Copy link
Member

Any update on when this will be merged?

@denysdovhan
Copy link
Member Author

@sfarzy it's not ready yet. I'm working on it right now. Unfortunately, I don't have enough time to finish it :(

spaceship.zsh Outdated
SPACESHIP_GIT_UNPULLED="${SPACESHIP_GIT_UNPULLED:="⇣"}"
SPACESHIP_GIT_UNPUSHED="${SPACESHIP_GIT_UNPUSHED:="⇡"}"
SPACESHIP_GIT_COLOR="${SPACESHIP_GIT_COLOR:="magenta"}"
SPACESHIP_GIT_SYMBOL="${SPACESHIP_GIT_SYMBOL:=" "}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this symbol from powerline fonts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this:

image

I've added this icon because it looks nice and it would be more obvious along with hg's icon.

Copy link
Member

@salmanulfarzy salmanulfarzy May 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great and many themes are using it. But don't go well with normal fonts. This is how it looks with some non-powerline fonts

Inconsolata Regular 12

Inconsolata Regular 12

DejaVu Sans Mono Book 12

DejaVu Sans Mono Book 12

Hack poweline 10

Hack powerline 10

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why we have exposed it as $SPACESHIP_GIT_SYMBOL, so it could be replaced by anything else.

Copy link
Member

@salmanulfarzy salmanulfarzy May 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving users a heads up will be nice. All other symbols are compatible with normal fonts, so now we are depending on powerline for a single symbol.

One suggestion is to use u2387 ( ⎇ ) instead of ue0a0 (  ). Which compatible with most fonts tested, even though it doesn't look good as the latter.

It's just a suggestion ignore if irrelevant.

@denysdovhan
Copy link
Member Author

denysdovhan commented May 7, 2017

I've been experimenting a bit with new options and find out that Spaceship became highly customizible. Take a look at this:

GIF Preview:

kapture 2017-05-07 at 15 18 04

Connected via SSH:

image

Here are my options:

# ORDER
SPACESHIP_PROMPT_ORDER=(
  time     #
  vi_mode  # these sections will be
  user     # before prompt char
  host     #
  char
  dir
  git
  node
  ruby
  xcode
  swift
  golang
  docker
  venv
  pyenv
)

# USER
SPACESHIP_USER_PREFIX="" # remove `with` before username
SPACESHIP_USER_SUFFIX="" # remove space before host

# HOST
# Result will look like this:
#   username@:(hostname)
SPACESHIP_HOST_PREFIX="@:("
SPACESHIP_HOST_SUFFIX=") "

# DIR
SPACESHIP_DIR_PREFIX='' # disable directory prefix, cause it's not the first section
SPACESHIP_DIR_TRUNC='1' # show only last directory

# GIT
# Disable git symbol
SPACESHIP_GIT_SYMBOL="" # disable git prefix
SPACESHIP_GIT_BRANCH_PREFIX="" # disable branch prefix too
# Wrap git in `git:(...)`
SPACESHIP_GIT_PREFIX='git:('
SPACESHIP_GIT_SUFFIX=") "
SPACESHIP_GIT_BRANCH_SUFFIX="" # remove space after branch name
# Unwrap git status from `[...]`
SPACESHIP_GIT_STATUS_PREFIX=""
SPACESHIP_GIT_STATUS_SUFFIX=""

# NODE
SPACESHIP_NODE_PREFIX="node:("
SPACESHIP_NODE_SUFFIX=") "
SPACESHIP_NODE_SYMBOL=""

# RUBY
SPACESHIP_RUBY_PREFIX="ruby:("
SPACESHIP_RUBY_SUFFIX=") "
SPACESHIP_RUBY_SYMBOL=""

# XCODE
SPACESHIP_XCODE_PREFIX="xcode:("
SPACESHIP_XCODE_SUFFIX=") "
SPACESHIP_XCODE_SYMBOL=""

# SWIFT
SPACESHIP_SWIFT_PREFIX="swift:("
SPACESHIP_SWIFT_SUFFIX=") "
SPACESHIP_SWIFT_SYMBOL=""

# GOLANG
SPACESHIP_GOLANG_PREFIX="go:("
SPACESHIP_GOLANG_SUFFIX=") "
SPACESHIP_GOLANG_SYMBOL=""

# DOCKER
SPACESHIP_DOCKER_PREFIX="docker:("
SPACESHIP_DOCKER_SUFFIX=") "
SPACESHIP_DOCKER_SYMBOL=""

# VENV
SPACESHIP_VENV_PREFIX="venv:("
SPACESHIP_VENV_SUFFIX=") "

# PYENV
SPACESHIP_PYENV_PREFIX="python:("
SPACESHIP_PYENV_SUFFIX=") "
SPACESHIP_PYENV_SYMBOL=""

Gonna share this setup in Presets wiki-page

@denysdovhan denysdovhan merged commit 837ece5 into master May 7, 2017
denysdovhan added a commit that referenced this pull request May 7, 2017
@denysdovhan
Copy link
Member Author

Hooray! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A PR that implement feature (section, specific behavior, etc).
Development

Successfully merging this pull request may close these issues.

2 participants