summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2015-12-16 16:04:29 -0500
committerJune McEnroe <june@causal.agency>2015-12-16 16:04:29 -0500
commit45a337f7ecdaadf106979f8206ab5dcf52292d39 (patch)
tree753b9760bd1bbb331e71115067341c1313626370
parentRemove colorcolumn at 120 (diff)
downloadsrc-45a337f7ecdaadf106979f8206ab5dcf52292d39.tar.gz
src-45a337f7ecdaadf106979f8206ab5dcf52292d39.zip
Color prompt yellow in vi normal mode
-rw-r--r--.zshrc24
1 files changed, 18 insertions, 6 deletions
diff --git a/.zshrc b/.zshrc
index 1f9d07b8..7fa8f3b4 100644
--- a/.zshrc
+++ b/.zshrc
@@ -15,14 +15,23 @@ unsetopt beep
 # Vim line editing.
 bindkey -v
 
-# Initialize completion.
+# Initialize completion and colors.
 autoload -Uz compinit && compinit
-
-# Prompt with single character on the left, normally green, magenta over SSH,
-# red after a failed command. Directory and git branch on the right.
-setopt prompt_subst
 autoload colors && colors
+
+# Color prompt magenta over SSH.
 [[ -n "$SSH_CLIENT" ]] && _prompt_ssh_color="$fg[magenta]"
+
+# Color prompt yellow in vi normal mode.
+function zle-line-init zle-keymap-select {
+  _prompt_vi_color=
+  [[ "$KEYMAP" == "vicmd" ]] && _prompt_vi_color="$fg[yellow]"
+  zle reset-prompt
+}
+zle -N zle-line-init
+zle -N zle-keymap-select
+
+# Show git branch or commit in right prompt.
 _prompt_git_branch() {
   [[ -f .git/HEAD ]] || return 0
   local head
@@ -36,7 +45,10 @@ _prompt_git_branch() {
       ;;
   esac
 }
-PROMPT='%{%(?.$fg[green]$_prompt_ssh_color.$fg[red])%}»%{$reset_color%} '
+
+# Single colored character prompt, directory and git branch in right prompt.
+setopt prompt_subst
+PROMPT='%{%(?.$fg[green]$_prompt_ssh_color.$fg[red])$_prompt_vi_color%}»%{$reset_color%} '
 RPROMPT='%{$fg[blue]%}%-50<…<%~%{$fg[yellow]%}$(_prompt_git_branch)%{$reset_color%}'
 
 # Print a newline before every prompt after the first one.
/htagml.1?id=e886fbb30f1b157aa4daba9cda6ca13186a760d8&follow=1'>Add hilex example to htagml manualJune McEnroe 2021-01-12Style causal.agency like bin HTMLJune McEnroe 2021-01-12Avoid matching tag text inside HTML elementsJune McEnroe 2021-01-12Use hilex for up -hJune McEnroe 2021-01-12Use hilex for bin HTMLJune McEnroe 2021-01-12Don't output a pre in hilex by defaultJune McEnroe 2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe God that makes the lexers so much simpler. 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe This simplifies some things, adds support for line number tag definitions, and should enable combining htagml with other preprocessors in the future. 2021-01-12Split fields by tab onlyJune McEnroe Also don't fail hard on non-forward-search definitions. 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe neovim is laggy as hell in my OpenBSD VM, so I switched to vi so I could type without getting frustrated. 2021-01-09Add c -t flag to print expression typeJune McEnroe Also add missing float case. 2021-01-05Update taglineJune McEnroe