diff --git a/zsh/config b/zsh/config index 9202110e..2fa9205f 100644 --- a/zsh/config +++ b/zsh/config @@ -42,4 +42,8 @@ export RUBYOPT=rubygems COMPLETION_WAITING_DOTS="true" +# Make zsh prompt act like vi +zle -N edit-command-line +bindkey '^f' edit-command-line + # vim:set ft=zsh: diff --git a/zsh/prompt b/zsh/prompt index 306e0b18..31bf9af8 100644 --- a/zsh/prompt +++ b/zsh/prompt @@ -28,6 +28,11 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}+%{$fg[white]%}" # Build Prompt # ################## +prompt_vimode() { + MODE_INDICATOR="-- COMMAND -- " + echo -n "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" +} + prompt() { echo -n "%{$FG[242]%}" echo -n '$(date "+%H:%M:%S")' @@ -42,10 +47,14 @@ prompt() { # The prompt echo -n "%{$fg[red]%}" echo -n "%{$FX[bold]%}" - echo -n " \$ %{$FX[no-bold]%}" + echo -n " \$ " + echo -n "%{$FX[no-bold]%}" + } rprompt() { + echo -n '$(prompt_vimode)' + # Make the rprompt a bright grey to set it apart echo -n "%{$FG[245]%}" echo -n '$(prompt_pwd)' diff --git a/zshrc b/zshrc index 6cf490ea..1ab0fc18 100644 --- a/zshrc +++ b/zshrc @@ -5,7 +5,7 @@ export ZSH=$HOME/.oh-my-zsh # ruby: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ruby # python: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/python # brew: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/brew -plugins=(ruby python brew) +plugins=(ruby python brew vi-mode) # Liiiiive! source $ZSH/oh-my-zsh.sh