From e279ab85b36454ddda78eec632ef4e9704cd796d Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Mon, 19 Jul 2021 23:56:55 -0400 Subject: [PATCH] zsh: Remove vi_prompt_append, my last zsh script I was proud of this one, so I kept it around for a _long_ time. Truth is, I haven't touched zsh in years and probably won't any time soon. In the spirit of spring cleaning and working towards a FOSS license for this repo, I'm removing it. --- etc/vi_prompt_append.zsh | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 etc/vi_prompt_append.zsh diff --git a/etc/vi_prompt_append.zsh b/etc/vi_prompt_append.zsh deleted file mode 100644 index 6075d50..0000000 --- a/etc/vi_prompt_append.zsh +++ /dev/null @@ -1,37 +0,0 @@ -# Vi Prompt Append! -# -# I like Vi(m) related things! I like Vi in my zsh, BUT, not knowing -# which mode (Normal/Insert) you are in can be damaging. SO, I created -# this little script to append an indicator (and change it) for any -# zsh theme! -# -# Assumes bindkey -v is on! -# -# USAGE: -# Source AFTER your theme! (so prompt isn't reset!) - -# First, the globals -VI_NORMAL_PROMPT="%{$fg_bold[yellow]%}[% N]% %{$reset_color%}" -VI_INSERT_PROMPT="%{$fg_bold[blue]%}[% I]% %{$reset_color%}" -VI_PROMPT_CHAR="$VI_INSERT_PROMPT" - -# Simple function to output the Vi prompt -vi_mode() { - local vi_mode_chars="${VI_PROMPT_CHAR}" - echo -n "$vi_mode_chars" -} - -# The magic is here -- append to PROMPT -# Note to self -- need '' around the vi_mode function -PROMPT='$(vi_mode)'"$PROMPT" - -# This function changes the prompt / resets it on Normal/Insert toggle -# Heavily inspired by Doug Black (https://dougblack.io/words/zsh-vi-mode.html) -function zle-line-init zle-keymap-select { - # for use in my custom vi prompt append - VI_PROMPT_CHAR="${${KEYMAP/vicmd/$VI_NORMAL_PROMPT}/(main|viins)/$VI_INSERT_PROMPT}" - zle reset-prompt -} - -zle -N zle-line-init -zle -N zle-keymap-select -- libgit2 0.28.4