Add ianonavy prompt.
This commit is contained in:
parent
fedad8e9cf
commit
cd094b472a
109
modules/prompt/functions/prompt_ianonavy_setup
Normal file
109
modules/prompt/functions/prompt_ianonavy_setup
Normal file
@ -0,0 +1,109 @@
|
||||
#
|
||||
# All information at your chilly fingertips.
|
||||
#
|
||||
# Authors:
|
||||
# Tom Frost <tom@ianonavyeddesign.com>
|
||||
# Ian Naval <ian@ianonavy.com>
|
||||
#
|
||||
# Screenshots:
|
||||
# http://i.tomfro.st/U1Kov.png
|
||||
#
|
||||
|
||||
# Dependencies
|
||||
pmodload 'helper'
|
||||
|
||||
function prompt_ianonavy_precmd {
|
||||
setopt LOCAL_OPTIONS
|
||||
unsetopt XTRACE KSH_ARRAYS
|
||||
|
||||
if (( $+functions[git-info] )); then
|
||||
git-info
|
||||
fi
|
||||
|
||||
if (( $+functions[python-info] )); then
|
||||
python-info
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_ianonavy_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_ianonavy_precmd
|
||||
|
||||
_prompt_ianonavy_nocolor="%{$terminfo[sgr0]%}"
|
||||
_prompt_ianonavy_colors=(
|
||||
"${_prompt_ianonavy_nocolor}%F{blue}"
|
||||
"${_prompt_ianonavy_nocolor}%F{blue}%{$terminfo[bold]%}"
|
||||
"${_prompt_ianonavy_nocolor}%F{green}"
|
||||
"${_prompt_ianonavy_nocolor}%F{green}%{$terminfo[bold]%}"
|
||||
"${_prompt_ianonavy_nocolor}%F{red}"
|
||||
"${_prompt_ianonavy_nocolor}%F{red}%{$terminfo[bold]%}"
|
||||
"${_prompt_ianonavy_nocolor}%F{yellow}"
|
||||
"${_prompt_ianonavy_nocolor}%F{yellow}%{$terminfo[bold]%}"
|
||||
"${_prompt_ianonavy_nocolor}%F{magenta}"
|
||||
"${_prompt_ianonavy_nocolor}%F{magenta}%{$terminfo[bold]%}"
|
||||
"${_prompt_ianonavy_nocolor}%F{white}"
|
||||
"${_prompt_ianonavy_nocolor}%F{white}%{$terminfo[bold]%}"
|
||||
)
|
||||
|
||||
# Set editor-info params
|
||||
zstyle ':prezto:module:editor:info:completing' format '${_prompt_ianonavy_colors[5]}...${_prompt_ianonavy_nocolor}'
|
||||
zstyle ':prezto:module:editor:info:keymap:primary' format '➤'
|
||||
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '♺'
|
||||
zstyle ':prezto:module:editor:info:keymap:alternate' format '⍟'
|
||||
|
||||
# Set git-info parameters
|
||||
zstyle ':prezto:module:git:info' verbose 'yes'
|
||||
zstyle ':prezto:module:git:info:action' format "${_prompt_ianonavy_colors[1]}∙${_prompt_ianonavy_colors[7]}%s${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:added' format "${_prompt_ianonavy_colors[4]}✚${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:ahead' format "${_prompt_ianonavy_colors[8]}⚡${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:behind' format "${_prompt_ianonavy_colors[8]}↯${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:branch' format "${_prompt_ianonavy_colors[1]}∙${_prompt_ianonavy_colors[2]}%b${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:clean' format "${_prompt_ianonavy_colors[3]}✔${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:commit' format "${_prompt_ianonavy_colors[2]}%.7c${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:deleted' format "${_prompt_ianonavy_colors[6]}✖${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:modified' format "${_prompt_ianonavy_colors[7]}✱${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:renamed' format "${_prompt_ianonavy_colors[6]}➜${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:stashed' format "${_prompt_ianonavy_colors[7]}✭${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:unmerged' format "${_prompt_ianonavy_colors[7]}═${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:untracked' format "${_prompt_ianonavy_colors[6]}▪${_prompt_ianonavy_nocolor}"
|
||||
zstyle ':prezto:module:git:info:keys' format \
|
||||
'prompt' "${_prompt_ianonavy_colors[1]}%c%b%s${_prompt_ianonavy_colors[1]}∙%C%A%B%S%a%d%m%r%U%u${_prompt_ianonavy_colors[1]} " \
|
||||
'rprompt' ''
|
||||
|
||||
# Set python-info parameters
|
||||
zstyle ':prezto:module:python:info:virtualenv' format "${_prompt_ianonavy_colors[12]}%v${_prompt_ianonavy_nocolor} "
|
||||
|
||||
# Get the time
|
||||
local time="${_prompt_ianonavy_colors[9]}%D{%H:%M} "
|
||||
|
||||
# Remote hosts change colors
|
||||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||
local host="${_prompt_ianonavy_colors[8]}%m" #SSH
|
||||
else
|
||||
local host="${_prompt_ianonavy_colors[4]}%m" # no SSH
|
||||
fi
|
||||
|
||||
local user="%(!.${_prompt_ianonavy_colors[6]}.${_prompt_ianonavy_colors[4]})%n${_prompt_ianonavy_colors[1]}@"
|
||||
if [[ "$USER" == "ian" ]]; then
|
||||
user=""
|
||||
fi
|
||||
local promptcolor='%(!.${_prompt_ianonavy_colors[6]}.${_prompt_ianonavy_nocolor})'
|
||||
autoload -U colors && colors
|
||||
|
||||
# Define prompts.
|
||||
PROMPT="
|
||||
${_prompt_ianonavy_colors[1]}${user}${host}${_prompt_ianonavy_colors[1]} ${_prompt_ianonavy_colors[2]}%~ ${_prompt_ianonavy_colors[1]}$time${_prompt_ianonavy_colors[1]}"'$python_info[virtualenv]'""'${git_info[prompt]}'"
|
||||
${promptcolor}"'${editor_info[keymap]}'"${_prompt_ianonavy_nocolor} "
|
||||
RPROMPT='%{$fg[red]%}%(?..%? ↵)%{$reset_color%}'
|
||||
SPROMPT='zsh: correct ${_prompt_ianonavy_colors[6]}%R${_prompt_ianonavy_nocolor} to ${_prompt_ianonavy_colors[4]}%r${_prompt_ianonavy_nocolor} [nyae]? '
|
||||
}
|
||||
|
||||
prompt_ianonavy_setup "$@"
|
3
modules/utility/functions/up
Normal file
3
modules/utility/functions/up
Normal file
@ -0,0 +1,3 @@
|
||||
up() {
|
||||
scp $1 ian@files.ianonavy.com:/home/ian/sites/ianonavy.com/files/ && echo "File available at http://files.ianonavy.com/$1"
|
||||
}
|
@ -28,10 +28,18 @@ zstyle ':prezto:load' pmodule \
|
||||
'terminal' \
|
||||
'editor' \
|
||||
'history' \
|
||||
'history-substring-search' \
|
||||
'directory' \
|
||||
'spectrum' \
|
||||
'utility' \
|
||||
'completion' \
|
||||
'git' \
|
||||
'homebrew' \
|
||||
'python' \
|
||||
'ruby' \
|
||||
'node' \
|
||||
'syntax-highlighting' \
|
||||
'tmux' \
|
||||
'prompt'
|
||||
|
||||
#
|
||||
@ -49,7 +57,7 @@ zstyle ':prezto:module:editor' key-bindings 'emacs'
|
||||
#
|
||||
|
||||
# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'.
|
||||
# zstyle ':prezto:module:git:status:ignore' submodules 'all'
|
||||
zstyle ':prezto:module:git:status:ignore' submodules 'all'
|
||||
|
||||
#
|
||||
# GNU Utility
|
||||
@ -85,7 +93,7 @@ zstyle ':prezto:module:editor' key-bindings 'emacs'
|
||||
# Set the prompt theme to load.
|
||||
# Setting it to 'random' loads a random theme.
|
||||
# Auto set to 'off' on dumb terminals.
|
||||
zstyle ':prezto:module:prompt' theme 'sorin'
|
||||
zstyle ':prezto:module:prompt' theme 'ianonavy'
|
||||
|
||||
#
|
||||
# Ruby
|
||||
@ -152,3 +160,4 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
||||
|
||||
# Auto start a session when Zsh is launched in a SSH connection.
|
||||
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
#
|
||||
|
@ -17,8 +17,8 @@ fi
|
||||
# Editors
|
||||
#
|
||||
|
||||
export EDITOR='nano'
|
||||
export VISUAL='nano'
|
||||
export EDITOR='vi'
|
||||
export VISUAL='vi'
|
||||
export PAGER='less'
|
||||
|
||||
#
|
||||
|
@ -11,4 +11,8 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
||||
fi
|
||||
|
||||
# Customize to your needs...
|
||||
export GOPATH=/home/ian/.go
|
||||
export PATH=$PATH:$GOPATH/bin
|
||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
|
||||
alias vi=vim
|
||||
|
Loading…
x
Reference in New Issue
Block a user