]> git.armaanb.net Git - admone.git/commitdiff
made a variety of usability changes
authorArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Thu, 29 Oct 2020 15:23:25 +0000 (11:23 -0400)
committerArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Thu, 29 Oct 2020 15:23:25 +0000 (11:23 -0400)
README.md
admone.zsh

index b4e74ac51a37eb10d194d8cbc07f8b587d181d1e..4514f6eb511e231b66ecd23468c2aaa7c2d1a306 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,15 +2,14 @@
 A tolerable ZSH prompt
 
 ## Installation
 A tolerable ZSH prompt
 
 ## Installation
-Source this script somewhere in your ZSHRC
-Theoretically works with plugin managers as well although this is untested
+Source this script somewhere in your ZSHRC. Theoretically works with plugin managers as well, although this is untested
 
 ## Configuration
 Configuration is done by modifying the variables set at the start of the script. Just get in there and mess around a bit, its not very difficult to understand
 
 ## My design requirements
 
 ## Configuration
 Configuration is done by modifying the variables set at the start of the script. Just get in there and mess around a bit, its not very difficult to understand
 
 ## My design requirements
-  - No OhMyZSH dependency
-  - Fast to load
+  - No dependency on OhMyZSH
+  - Quick to load
   - 2 lines
   - Git intergration
   - Easily extensible
   - 2 lines
   - Git intergration
   - Easily extensible
index e1fbc64b7cffc58c8297b0e9d0f09875969f090c..555159a3a8ed8f96706d225ec52d4516167d0e57 100644 (file)
@@ -15,7 +15,8 @@ ADMONE_PRE_LOWER="╰ "
 ADMONE_BLOCK_SEPARATOR="-"
 ADMONE_BLOCK_LEFT="["
 ADMONE_BLOCK_RIGHT="]"
 ADMONE_BLOCK_SEPARATOR="-"
 ADMONE_BLOCK_LEFT="["
 ADMONE_BLOCK_RIGHT="]"
-ADMONE_INCLUDE="admone-pwd;admone-git;admone-exit-code;admone-12hr"
+ADMONE_VI_MODE_CURSOR="1"
+ADMONE_INCLUDE="admone-pwd;admone-git;admone-exit-code;admone-12hr;admone-time"
 
 function admone-pwd {
   echo "%F{blue}%~%f%F{240}"
 
 function admone-pwd {
   echo "%F{blue}%~%f%F{240}"
@@ -27,7 +28,6 @@ function admone-git {
 function admone-exit-code {
   echo "%(?,,%F{1}%?%F{240})"
 }
 function admone-exit-code {
   echo "%(?,,%F{1}%?%F{240})"
 }
-
 function admone-date {
   echo $(date -I)
 }
 function admone-date {
   echo $(date -I)
 }
@@ -37,6 +37,11 @@ function admone-12hr {
 function admone-24hr {
   echo $(date +%x)
 }
 function admone-24hr {
   echo $(date +%x)
 }
+function admone-time {
+  # Intergration with https://codeberg.org/armaan/zsh-command-time
+  echo %F{cyan}$timer_show%f
+}
+
 #######################################################################
 
 #
 #######################################################################
 
 #
@@ -45,28 +50,30 @@ function admone-24hr {
 
 # Cursor shape depends on vi mode
 function zle-keymap-select zle-line-init zle-line-finish {
 
 # Cursor shape depends on vi mode
 function zle-keymap-select zle-line-init zle-line-finish {
-  case $KEYMAP in
-    vicmd)
-      print -n -- "\E]50;CursorShape=0\C-G"
-      ;;
-    viins|main)
-      print -n -- "\E]50;CursorShape=1\C-G"
-      ;;
-    *)
-      ;;
-  esac
+  if [[ $ADMONE_VI_MODE_CURSOR == 1 ]]; then
+    case $KEYMAP in
+      vicmd)
+        print -n -- "\E]50;CursorShape=0\C-G"
+        ;;
+      viins|main)
+        print -n -- "\E]50;CursorShape=1\C-G"
+        ;;
+      *)
+        ;;
+    esac
 
 
-  zle reset-prompt
-  zle -R
+    zle reset-prompt
+    zle -R
+  fi
 }
 
 function set-prompt() {
 }
 
 function set-prompt() {
-  upper="%B${ADMONE_PRE_UPPER}"
-  lower="%B${ADMONE_PRE_LOWER}%B%F{%(?.cyan.red)}${ADMONE_PROMPT_CHAR}%f%b "
+  upper="${ADMONE_PRE_UPPER}"
+  lower="${ADMONE_PRE_LOWER}%B%F{%(?.cyan.red)}${ADMONE_PROMPT_CHAR}%f%b "
 
   NUM_FUNCS="$(echo $ADMONE_INCLUDE | grep -o ';' | wc -l)"
   REAL_NUM_FUNCS=$((NUM_FUNCS+1))
 
   NUM_FUNCS="$(echo $ADMONE_INCLUDE | grep -o ';' | wc -l)"
   REAL_NUM_FUNCS=$((NUM_FUNCS+1))
+
   for (( i = 0; i <= $NUM_FUNCS; i++ )); do
     (( val = $i + 1 ))
     THE_COMMAND="$(echo $ADMONE_INCLUDE | cut -d ';' -f $val)"
   for (( i = 0; i <= $NUM_FUNCS; i++ )); do
     (( val = $i + 1 ))
     THE_COMMAND="$(echo $ADMONE_INCLUDE | cut -d ';' -f $val)"