Skip to content

sebneira/zsh-tctx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-tctx

Prompt for zsh that displays the current tctx context.

Examples

zsh's robbyrussell theme

zsh prompt

p10k theme

p10k prompt

Installation

Oh My Zsh

This will add the tctx context to the right of your prompt.

  1. Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)

    git clone https://github.com/sikian/zsh-tctx ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-tctx
  2. Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):

    plugins=( 
        # other plugins...
        zsh-tctx
    )
  3. Start a new terminal session.

Powerlevel10k

If you're using powerlevel10k (highly recommended!), you can extend it with the tctx prompt as follows.

  1. Clone this repository

    git clone https://github.com/sikian/zsh-tctx ~/.zsh/zsh-tctx
  2. Add the prompt to your ~/.p10k.zsh.

    a. Add tctx to whichever PROMPT_ELEMENTS you prefer. Example:

    typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
      # =========================[ Line #1 ]=========================
      os_icon
      dir
      vcs
      tctx                    # tctx prompt!
      # =========================[ Line #2 ]=========================
      newline
      prompt_char
    )

    b. Search for POWERLEVEL9K_EXAMPLE_BACKGROUND and source $HOME/.zsh/zsh-tctx/p10k-tctx.zsh after:

    ...
    typeset -g POWERLEVEL9K_EXAMPLE_BACKGROUND=1
    
    # Source tctx prompt function
    source $HOME/.zsh/zsh-tctx/p10k-tctx.zsh
    ...
  3. Start a new terminal session.

Manual (Git Clone)

  1. Clone this repository somewhere on your machine. This guide will assume ~/.zsh/zsh-tctx.

    git clone https://github.com/sikian/zsh-tctx ~/.zsh/zsh-tctx
  2. Add the following to your .zshrc:

    source ~/.zsh/zsh-tctx/zsh-tctx.zsh
  3. Start a new terminal session.

Customization

If you'd rather have other colours, you can either change the source code or just change the following env vars in your ~/.profile or ~/.zshrc to whatever suits you best:

export ZSH_TCTX_PROMPT_BACKGROUND=
export ZSH_TCTX_PROMPT_PREFIX=
export ZSH_TCTX_PROMPT_PREFIX_FOREGROUND=
export ZSH_TCTX_PROMPT_PROD_FOREGROUND=
export ZSH_TCTX_PROMPT_DEFAULT_FOREGROUND=

For a list of colors, run in your terminal:

for i in {0..255}; do print -Pn "%K{$i}  %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done

Current defaults:

export ZSH_TCTX_PROMPT_BACKGROUND=
export ZSH_TCTX_PROMPT_PREFIX=tctx
export ZSH_TCTX_PROMPT_PREFIX_FOREGROUND=255
export ZSH_TCTX_PROMPT_PROD_FOREGROUND=009
export ZSH_TCTX_PROMPT_DEFAULT_FOREGROUND=005

About

tctx prompt for zsh and p10k

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages