typewritten icon indicating copy to clipboard operation
typewritten copied to clipboard

feat: Implement dynamic left and right prompt prefix options

Open reobin opened this issue 3 years ago • 1 comments

Closes #148

4 "new" options were implemented:

  • TYPEWRITTEN_LEFT_PROMPT_PREFIX (existed before)
  • TYPEWRITTEN_LEFT_PROMPT_PREFIX_FUNCTION
  • TYPEWRITTEN_RIGHT_PROMPT_PREFIX
  • TYPEWRITTEN_RIGHT_PROMPT_PREFIX_FUNCTION

The _FUNCTION variants are used to enable the use of live evaluated functions as prefixes.

Example of use in .zshrc to display kube context:

display_kube_context() {
  tw_kube_context="$(kubectl config current-context 2> /dev/null)"

  if [[ $tw_kube_context != "" ]]; then
    echo "($(basename $tw_kube_context))"
  fi
}

export TYPEWRITTEN_LEFT_PROMPT_PREFIX_FUNCTION=display_kube_context

reobin avatar Oct 10 '22 14:10 reobin

Hello @KEDLogic ! If you have the chance to review this PR, it would be greatly appreciated. Especially the example snippet for kube context.

reobin avatar Oct 10 '22 14:10 reobin

@all-contributors please add @KEDLogic for documentation and ideas

reobin avatar Oct 19 '22 13:10 reobin

@reobin

I've put up a pull request to add @KEDLogic! :tada:

allcontributors[bot] avatar Oct 19 '22 13:10 allcontributors[bot]