From: Armaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me> Date: Thu, 29 Oct 2020 15:23:25 +0000 (-0400) Subject: made a variety of usability changes X-Git-Url: https://git.armaanb.net/?p=admone.git;a=commitdiff_plain;h=e1d9f4e333b03340b4b54a4860c95dfacb679acb made a variety of usability changes --- diff --git a/README.md b/README.md index b4e74ac..4514f6e 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,14 @@ 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 - - No OhMyZSH dependency - - Fast to load + - No dependency on OhMyZSH + - Quick to load - 2 lines - Git intergration - Easily extensible diff --git a/admone.zsh b/admone.zsh index e1fbc64..555159a 100644 --- a/admone.zsh +++ b/admone.zsh @@ -15,7 +15,8 @@ ADMONE_PRE_LOWER="╰ " 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}" @@ -27,7 +28,6 @@ function admone-git { function admone-exit-code { echo "%(?,,%F{1}%?%F{240})" } - function admone-date { echo $(date -I) } @@ -37,6 +37,11 @@ function admone-12hr { 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 { - 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() { - 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)) - + for (( i = 0; i <= $NUM_FUNCS; i++ )); do (( val = $i + 1 )) THE_COMMAND="$(echo $ADMONE_INCLUDE | cut -d ';' -f $val)"