Prompt work...mostly, notes

Hack together a prompt that does most of what we did before but is a bit
simpler.  Throw it all into precmd because why not....
This commit is contained in:
Andrew Tomaka 2015-12-10 16:17:09 -05:00
parent db3bfa4036
commit f2676dabcf
7 changed files with 53 additions and 41 deletions

View file

@ -5,13 +5,12 @@ symlinks = $(shell ls $(excludes) `pwd`)
all: install
install: repos submodules $(symlinks)
install: repos $(symlinks)
repos:
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle
submodules:
git submodule update --init --recursive
if test ! -d ~/.vim/bundle/vundle ; then \
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle ; \
fi
$(symlinks):
test -e `pwd`/$@ \

View file

@ -70,6 +70,7 @@ alias jbt="./gradlew test"
alias l="ls"
alias ll="ls -lv --human-readable --color=auto"
alias lp="librarian-puppet"
alias ls="ls --color=auto"
alias m="more"
alias md="cd ~/dotfiles > /dev/null 2>&1; make; cd -1 > /dev/null 2>&1"
alias mf="mkdir"

View file

@ -65,4 +65,4 @@ set-option -g status-right '%d %b %Y @ %k:%M'
# because the new tmux is inadequate
source-file ~/.tmux.1-8.conf # always source the 1.8 file
if-shell 'tmux -V | grep -q "1.9\|2.0"' "source-file ~/.tmux.1-9.conf"
if-shell 'tmux -V | grep -q "1.9\|2.0\|2.1"' "source-file ~/.tmux.1-9.conf"

View file

@ -1,20 +0,0 @@
fpath=(
${HOME}/.zsh/modules/prompt/functions
${fpath}
)
zstyle ':prezto:*:*' color 'yes'
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'ruby' \
'prompt'
zstyle ':prezto:module:prompt' theme 'atomaka'

35
zsh/new-prompt Normal file
View file

@ -0,0 +1,35 @@
local current_time="[%B%D{%I:%M:%S}%b]"
local current_dir='%B%F{blue}%~%f%b'
# user
local user="%F{green}%n%f"
# host
local host=""
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
host='%F{yellow}%M%f' #SSH
else
host='%F{green}%M%f' # no SSH
fi
# vcs
precmd() {
setopt promptsubst
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git hg svn
zstyle ':vcs_info:*:prompt:*' nvcsformats ""
zstyle ':vcs_info:*:prompt:*' check-for-changes true
zstyle ':vcs_info:*:prompt:*' unstagedstr "*"
zstyle ':vcs_info:*:prompt:*' stagedstr "*"
zstyle ':vcs_info:*:prompt:*' formats "[%F{yellow}%b%f%u%c]"
vcs_info 'prompt'
}
local vcs='${vcs_info_msg_0_}'
# prompt
local return_code="%(?..%?)"
local prompt="%(?.%F{green}->.%F{red}-%B${return_code}%b%F{red}->%{%})%f"
PROMPT="${current_time} ${user}@${host} ${current_dir} ${vcs}
|$prompt "

9
zshenv Normal file
View file

@ -0,0 +1,9 @@
PERSONAL_BIN_PATH="$HOME/bin"
RBENV_PATH="$HOME/.rbenv/bin"
GNU_TOOLS_PATH="/usr/local/opt/coreutils/libexec/gnubin"
GNU_TOOLS_MAN_PATH="/usr/local/opt/coreutils/libexec/gnuman"
[[ -d "$PERSONAL_BIN_PATH" ]] && PATH="$PERSONAL_BIN_PATH:$PATH"
[[ -d "$RBENV_PATH" ]] && PATH="$RBENV_PATH:$PATH"
[[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH"
[[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH"

18
zshrc
View file

@ -1,27 +1,15 @@
PATH="$HOME/bin:$PATH"
if [[ "$OSTYPE" == darwin* ]]; then
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
NVM_DIR="/usr/local/opt/nvm"
else
NVM_DIR="/home/atomaka/.nvm"
fi
# add path to newer bins on cse servers (github/rmblair)
if test -d /soft/linux/pkg/bin ; then
export PATH=/soft/linux/pkg/bin:${PATH};
export PATH=/soft/lus/linux/vim/7.4-$(uname -m)/bin:$PATH;
fi
[[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH"
[[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH"
# clean up duplicate paths
typeset -U PATH
# List directory when changing (github/r00k)
chpwd() {
ls -lvh --color=auto
}
# Larger history
HISTSIZE=20000
HISTFILE=~/.zsh_history
@ -38,7 +26,7 @@ stty stop undef
# Aliases/Functions files
source $HOME/.aliases
source $HOME/.functions
source $HOME/.zsh/prompt
source $HOME/.zsh/new-prompt
if [[ "$OSTYPE" == darwin* ]]; then
source $HOME/.aliases-mac