From f2676dabcfd4c1ba15d6cd54403166c8ab900d4a Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Thu, 10 Dec 2015 16:17:09 -0500 Subject: [PATCH] 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.... --- Makefile | 9 ++++----- aliases | 1 + tmux.conf | 2 +- zpreztorc | 20 -------------------- zsh/new-prompt | 35 +++++++++++++++++++++++++++++++++++ zshenv | 9 +++++++++ zshrc | 18 +++--------------- 7 files changed, 53 insertions(+), 41 deletions(-) delete mode 100644 zpreztorc create mode 100644 zsh/new-prompt create mode 100644 zshenv diff --git a/Makefile b/Makefile index 8d36350..224ccdd 100644 --- a/Makefile +++ b/Makefile @@ -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`/$@ \ diff --git a/aliases b/aliases index 1d98e16..3ee316a 100644 --- a/aliases +++ b/aliases @@ -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" diff --git a/tmux.conf b/tmux.conf index 225fde2..978bb82 100644 --- a/tmux.conf +++ b/tmux.conf @@ -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" diff --git a/zpreztorc b/zpreztorc deleted file mode 100644 index 42bf40a..0000000 --- a/zpreztorc +++ /dev/null @@ -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' diff --git a/zsh/new-prompt b/zsh/new-prompt new file mode 100644 index 0000000..ffd04b2 --- /dev/null +++ b/zsh/new-prompt @@ -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 " diff --git a/zshenv b/zshenv new file mode 100644 index 0000000..278fd10 --- /dev/null +++ b/zshenv @@ -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" diff --git a/zshrc b/zshrc index ef8153e..477f54e 100644 --- a/zshrc +++ b/zshrc @@ -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