Add zsh vi-mode settings

This commit is contained in:
Henrik Lissner 2013-08-02 15:37:20 -04:00
parent 1920e5b76a
commit 4b70bc8f0e
3 changed files with 15 additions and 2 deletions

View file

@ -42,4 +42,8 @@ export RUBYOPT=rubygems
COMPLETION_WAITING_DOTS="true" COMPLETION_WAITING_DOTS="true"
# Make zsh prompt act like vi
zle -N edit-command-line
bindkey '^f' edit-command-line
# vim:set ft=zsh: # vim:set ft=zsh:

View file

@ -28,6 +28,11 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}+%{$fg[white]%}"
# Build Prompt # # Build Prompt #
################## ##################
prompt_vimode() {
MODE_INDICATOR="-- COMMAND -- "
echo -n "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
}
prompt() { prompt() {
echo -n "%{$FG[242]%}" echo -n "%{$FG[242]%}"
echo -n '$(date "+%H:%M:%S")' echo -n '$(date "+%H:%M:%S")'
@ -42,10 +47,14 @@ prompt() {
# The prompt # The prompt
echo -n "%{$fg[red]%}" echo -n "%{$fg[red]%}"
echo -n "%{$FX[bold]%}" echo -n "%{$FX[bold]%}"
echo -n " \$ %{$FX[no-bold]%}" echo -n " \$ "
echo -n "%{$FX[no-bold]%}"
} }
rprompt() { rprompt() {
echo -n '$(prompt_vimode)'
# Make the rprompt a bright grey to set it apart # Make the rprompt a bright grey to set it apart
echo -n "%{$FG[245]%}" echo -n "%{$FG[245]%}"
echo -n '$(prompt_pwd)' echo -n '$(prompt_pwd)'

2
zshrc
View file

@ -5,7 +5,7 @@ export ZSH=$HOME/.oh-my-zsh
# ruby: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ruby # ruby: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ruby
# python: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/python # python: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/python
# brew: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/brew # brew: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/brew
plugins=(ruby python brew) plugins=(ruby python brew vi-mode)
# Liiiiive! # Liiiiive!
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh