Update prompt without zprezto

This commit is contained in:
Andrew Tomaka 2015-12-10 11:35:28 -05:00
parent f10fd2d5e9
commit 48c0739427
4 changed files with 12 additions and 62 deletions

View file

@ -1,3 +1,5 @@
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.." alias ....="cd ../../.."
alias .....="cd ../../../.." alias .....="cd ../../../.."
alias a="ls -l --human-readable --all --color=auto" alias a="ls -l --human-readable --all --color=auto"

View file

@ -1,49 +0,0 @@
# ZSH Theme - Preview: ADD PREVIEW
# Based on bira theme. Based on gnzh.
# load some modules
autoload -U colors zsh/terminfo # Used in the colour alias below
colors
setopt prompt_subst
# make some aliases for the colors: (coud use normal escap.seq's too)
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GRAY; do
eval PR_$color='%{$fg[${(L)color}]%}'
done
eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
eval PR_BOLD="%{$terminfo[bold]%}"
# Show username
eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
else
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
fi
local PR_PROMPT="%(?.$PR_GREEN->.$PR_RED->%{%})$PR_NO_COLOR"
local return_code="%(?..%{$PR_RED%}%?%{$PR_NO_COLOR%})"
local current_time="[$PR_BOLD%D{%I:%M:%S}$PR_NO_COLOR]"
local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
local rvm_ruby=''
if which rvm-prompt &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rvm-prompt i v g s)%{$PR_NO_COLOR%}'
else
if which rbenv &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rbenv version | sed -e "s/ (set.*$//")%{$PR_NO_COLOR%}'
fi
fi
local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
PROMPT="${current_time} ${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|$PR_PROMPT "
RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="] %{$PR_NO_COLOR%}"

View file

@ -1,5 +1,3 @@
pmodload 'helper'
function prompt_atomaka_pwd { function prompt_atomaka_pwd {
local pwd="${PWD/#$HOME/~}" local pwd="${PWD/#$HOME/~}"
@ -19,15 +17,15 @@ function prompt_atomaka_userhost {
eval PR_HOST='%F{green}%M%f' # no SSH eval PR_HOST='%F{green}%M%f' # no SSH
fi fi
_prompt_atomaka_userhost='${PR_USER}%F{cyan}@${PR_HOST}%f' _prompt_atomaka_userhost="${PR_USER}%F{cyan}@${PR_HOST}%f"
} }
function prompt_atomaka_ruby { function prompt_atomaka_ruby {
if which rvm-prompt &> /dev/null; then if which rvm-prompt &> /dev/null; then
_prompt_atomaka_ruby='[%F{red}$(rvm-prompt i v g s)%f]' _prompt_atomaka_ruby="[%F{red}$(rvm-prompt i v g s)%f]"
else else
if which rbenv &> /dev/null; then if which rbenv &> /dev/null; then
_prompt_atomaka_ruby='[%F{red}$(rbenv version | sed -e "s/ (set.*$//")%f]' _prompt_atomaka_ruby="[%F{red}$(rbenv version | sed -e "s/ (set.*$//")%f]"
fi fi
fi fi
} }
@ -46,12 +44,13 @@ function prompt_atomaka_vcs {
zstyle ':vcs_info:*:prompt:*' formats "${branch_format}" zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"
zstyle ':vcs_info:*:prompt:*' nvcsformats "" zstyle ':vcs_info:*:prompt:*' nvcsformats ""
_prompt_atomaka_vcs='${vcs_info_msg_0_}' _prompt_atomaka_vcs="${vcs_info_msg_0_}"
} }
function prompt_atomaka_precmd { function prompt_atomaka_precmd {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
setopt prompt_subst
# Format PWD. # Format PWD.
prompt_atomaka_pwd prompt_atomaka_pwd
@ -80,8 +79,6 @@ function prompt_atomaka_setup {
# Add hook for calling git-info before each command. # Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_atomaka_precmd add-zsh-hook precmd prompt_atomaka_precmd
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
# keep this # keep this
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '

10
zshrc
View file

@ -27,18 +27,18 @@ HISTSIZE=20000
HISTFILE=~/.zsh_history HISTFILE=~/.zsh_history
SAVEHIST=20000 SAVEHIST=20000
# autocorrect
autoload -U compinit
compinit
# Make sure C-s works in vim # Make sure C-s works in vim
stty start undef stty start undef
stty stop undef stty stop undef
# load zprezto
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# Aliases/Functions files # Aliases/Functions files
source $HOME/.aliases source $HOME/.aliases
source $HOME/.functions source $HOME/.functions
source $HOME/.zsh/prompt
if [[ "$OSTYPE" == darwin* ]]; then if [[ "$OSTYPE" == darwin* ]]; then
source $HOME/.aliases-mac source $HOME/.aliases-mac