Skip to content

Instantly share code, notes, and snippets.

@joshjordan
Last active January 16, 2016 22:47
Show Gist options
  • Select an option

  • Save joshjordan/033fd9f674a670da0460 to your computer and use it in GitHub Desktop.

Select an option

Save joshjordan/033fd9f674a670da0460 to your computer and use it in GitHub Desktop.

Revisions

  1. joshjordan revised this gist Jan 16, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions prompt_joshjordan_setup
    Original file line number Diff line number Diff line change
    @@ -76,3 +76,4 @@ function prompt_joshjordan_setup {
    }

    prompt_joshjordan_setup "$@"
    export LSCOLORS=ExFxBxDxCxegedabagacad
  2. joshjordan revised this gist Oct 27, 2014. No changes.
  3. joshjordan renamed this gist Oct 27, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. joshjordan created this gist Oct 27, 2014.
    78 changes: 78 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,78 @@
    #
    # My prezto prompt. Simplified version of (read: almost completely lifted from) steeef theme
    #

    function prompt_joshjordan_precmd {
    # Check for untracked files or updated submodules since vcs_info does not.
    if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
    branch_format="(${_prompt_joshjordan_colors[1]}%b%f%u%c${_prompt_joshjordan_colors[4]}●%f)"
    else
    branch_format="(${_prompt_joshjordan_colors[1]}%b%f%u%c)"
    fi

    zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"

    vcs_info 'prompt'
    }

    function prompt_joshjordan_setup {
    setopt LOCAL_OPTIONS
    unsetopt XTRACE KSH_ARRAYS
    prompt_opts=(cr percent subst)

    # Load required functions.
    autoload -Uz add-zsh-hook
    autoload -Uz vcs_info

    # Add hook for calling vcs_info before each command.
    add-zsh-hook precmd prompt_joshjordan_precmd

    # Use extended color pallete if available.
    if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
    _prompt_joshjordan_colors=(
    "%F{81}" # Turquoise
    "%F{166}" # Orange
    "%F{135}" # Purple
    "%F{161}" # Hotpink
    "%F{118}" # Limegreen
    )
    else
    _prompt_joshjordan_colors=(
    "%F{cyan}"
    "%F{yellow}"
    "%F{magenta}"
    "%F{red}"
    "%F{green}"
    )
    fi

    # Formats:
    # %b - branchname
    # %u - unstagedstr (see below)
    # %c - stagedstr (see below)
    # %a - action (e.g. rebase-i)
    # %R - repository path
    # %S - path in the repository
    local branch_format="(${_prompt_joshjordan_colors[1]}%b%f%u%c)"
    local action_format="(${_prompt_joshjordan_colors[5]}%a%f)"
    local unstaged_format="${_prompt_joshjordan_colors[2]}●%f"
    local staged_format="${_prompt_joshjordan_colors[5]}●%f"

    # Set vcs_info parameters.
    zstyle ':vcs_info:*' enable bzr git hg svn
    zstyle ':vcs_info:*:prompt:*' check-for-changes true
    zstyle ':vcs_info:*:prompt:*' unstagedstr "${unstaged_format}"
    zstyle ':vcs_info:*:prompt:*' stagedstr "${staged_format}"
    zstyle ':vcs_info:*:prompt:*' actionformats "${branch_format}${action_format}"
    zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"
    zstyle ':vcs_info:*:prompt:*' nvcsformats ""

    # Get the time
    local time="%D{%L:%M:%S%p}"

    # Define prompts.
    PROMPT="${_prompt_joshjordan_colors[5]}%~%f "'${vcs_info_msg_0_}'" $ "
    RPROMPT="[ $time ]"
    }

    prompt_joshjordan_setup "$@"