Update ZSH config to use liquidprompt
This commit is contained in:
parent
3602c61dd8
commit
13cefee2c6
4 changed files with 4 additions and 105 deletions
1
zsh/zsh.symlink/liquidprompt
Submodule
1
zsh/zsh.symlink/liquidprompt
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 9c80396021a8106bfaeade9a1ea51b85152e951d
|
|
@ -1 +1 @@
|
|||
Subproject commit fb28eaf1d6c3c697f1e9721ee9ec911b8d0118ec
|
||||
Subproject commit 01c69f3ce201db8d2127cb35bdc904ce4fd0fd85
|
|
@ -1 +1 @@
|
|||
Subproject commit aac4a4423898fccbd1ab72c369ac09995a9139f1
|
||||
Subproject commit ad522a091429ba180c930f84b2a023b40de4dbcc
|
|
@ -1,5 +1,3 @@
|
|||
source /etc/bash_completion.d/git-prompt
|
||||
|
||||
## Path
|
||||
# Default path
|
||||
export PATH="/sbin"
|
||||
|
@ -9,9 +7,6 @@ PATH="/usr/bin:$PATH"
|
|||
PATH="/usr/local/sbin:$PATH"
|
||||
PATH="/usr/local/bin:$PATH"
|
||||
|
||||
# LaTeX!
|
||||
PATH="/usr/texbin:$PATH"
|
||||
|
||||
# Local path
|
||||
PATH="$HOME/dotfiles/bin:$PATH"
|
||||
|
||||
|
@ -71,105 +66,12 @@ function nice-hostname {
|
|||
echo $(command hostname | cut -d . -f 1)
|
||||
}
|
||||
|
||||
## Feature Colors
|
||||
#
|
||||
# These are used in the prompt and Tmux status bar as a reminder of
|
||||
# where we are.
|
||||
|
||||
declare -A FEATURE_COLORS
|
||||
FEATURE_COLORS=(
|
||||
kronecker green
|
||||
galois cyan
|
||||
dirac magenta
|
||||
hilbert blue
|
||||
)
|
||||
|
||||
COLOR_NAME="$FEATURE_COLORS[$(nice-hostname)]"
|
||||
COLOR="$fg[$COLOR_NAME]"
|
||||
|
||||
## Git
|
||||
|
||||
# Show the current Git branch.
|
||||
#
|
||||
# If we are not on a branch, print the short ref.
|
||||
function git-prompt-info {
|
||||
local ref=$(__git_ps1 | sed 's/(//g' | sed 's/)//g' | sed 's/^ //')
|
||||
|
||||
if [ -z "$ref" ]
|
||||
then
|
||||
echo ""
|
||||
return 0
|
||||
fi
|
||||
|
||||
COLOR="$fg[$FEATURE_COLORS[$(nice-hostname)]]"
|
||||
echo "($COLOR$ref$reset_color)"
|
||||
}
|
||||
|
||||
# Keep track of editing mode.
|
||||
#
|
||||
# Since I use Vi key bindings, I need a way to know which editing mode
|
||||
# I am in.
|
||||
|
||||
EDITING_MODE="I"
|
||||
|
||||
function set-editing-mode {
|
||||
EDITING_MODE="$1"
|
||||
}
|
||||
|
||||
function get-editing-mode {
|
||||
echo "$EDITING_MODE"
|
||||
}
|
||||
|
||||
## Prompt
|
||||
|
||||
# Autoload colors so we can make the prompt green.
|
||||
autoload -U colors && colors
|
||||
|
||||
# We set the prompt in the line editor function.
|
||||
|
||||
# Use Vi key bindings rather than emacs.
|
||||
bindkey -v
|
||||
|
||||
# Don't beep at me when I do something wrong.
|
||||
#
|
||||
# I found it was beeping when I wasn't doing something wrong, and that
|
||||
# really gets on my nerves.
|
||||
setopt no_beep
|
||||
|
||||
# Add my shortcut for escape.
|
||||
#
|
||||
# See my vimrc for why I do this
|
||||
bindkey -M viins hh vi-cmd-mode
|
||||
|
||||
# Ensure backspace continues to work in insert mode
|
||||
bindkey '^?' backward-delete-char
|
||||
|
||||
# Disable traditional escape and arrow keys.
|
||||
bindkey -rM viins "^["
|
||||
bindkey -rpM viins "^["
|
||||
bindkey -rM vicmd "^["
|
||||
bindkey -rpM vicmd "^["
|
||||
|
||||
# Show if we are in normal mode.
|
||||
function zle-line-init zle-keymap-select () {
|
||||
if [[ "$KEYMAP" == "vicmd" ]]; then
|
||||
RESULT="N"
|
||||
else
|
||||
RESULT="I"
|
||||
fi
|
||||
|
||||
set-editing-mode "$RESULT"
|
||||
|
||||
COLOR="$fg[$FEATURE_COLORS[$(nice-hostname)]]"
|
||||
PS1="$(command whoami)@%{$COLOR%}$(nice-hostname)%{$reset_color%} in %1d$(git-prompt-info)
|
||||
[%{$COLOR%}$(get-editing-mode)%{$reset_color%}]→ "
|
||||
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
|
||||
unset zle_bracketed_paste
|
||||
|
||||
## Changing Directories
|
||||
|
@ -235,8 +137,4 @@ setopt extended_history
|
|||
# to do things correctly and see if it's slow.
|
||||
setopt hist_lex_words
|
||||
|
||||
alias pbcopy='xclip -selection clipboard'
|
||||
alias pbpaste='xclip -selection clipboard -o'
|
||||
|
||||
# Because this just doesn't work in GNOME
|
||||
xmodmap $HOME/.xmodmap
|
||||
source "$HOME/.zsh/liquidprompt/liquidprompt"
|
||||
|
|
Loading…
Add table
Reference in a new issue