Skip to content

Segments

Chris Marsh edited this page Feb 28, 2021 · 4 revisions

Segments

Time

Shows the current time.

Time Segment

Options

  • PL_TIME_SHOW_SECONDS=true|false
    • time format HH:MM:SS or HH:MM

Add to the config file:

PL_SEGMENTS+=(
    'time_segment   bgcolor fgcolor'
)
PL_TIME_SHOW_SECONDS=true

User

Show the user name with an option to show the hostname or (IP address)

User Segment

Options

  • PL_USER_SHOW_HOST=true|false
    • 'username' or 'username@hostname'
  • PL_USER_USE_IP=true|false

Add to the config file:

PL_SEGMENTS+=(
    'user_segment   bgcolor fgcolor'
)
PL_USER_SHOW_HOST=true
PL_USER_SHOW_IP=true

Path

Show the current directory.

Path Segment

Options

  • PL_PATH_TRIM=n
    • n=0 show the full path: eg /usr/share/sounds/alsa/free
    • n=1 show the current directory: eg free
    • n=2+ trim the path, 'n' being the number of trailing directories to retain: eg /usr/.../alsa/free

Add to the config file:

PL_SEGMENTS+=(
    'path_segment    bgcolor fgcolor'
)
PL_PATH_TRIM=3

PWD

Show the current directory with path split into segments

Options

  • PL_PATH_TRIM=n
    • n=0 show the full path: eg / > usr > share > sounds
    • n=1 show the current directory: eg sounds
    • n=2+ trim the path, n being the number of directories to retain: eg ... > share > sounds
PL_SEGMENTS+=(
    'pwd_segment     bgcolor fgcolor'
)

Background Jobs

Shows the number of running background jobs.

Background Jobs Segment

Add to the config file:

PL_SEGMENTS+=(
    background_jobs bgcolor fgcolor'
)

Read-only

Indicates a read only directory

Read Only Segment

Add to the config file:

PL_SEGMENTS+=(
    read_only_segment   bgcolor fgcolor'
)

Return Code

Shows the return code when the last command fails.

Return Code Segment

Add to the config file:

PL_SEGMENTS+=(
    'return_code_segment bgcolor fgcolor'
)

Newline

Line break to split the prompt over multiple lines.

Newline Segment

Add to the config file:

PL_SEGMENTS+=(
    'newline_segment'
)

Prompt

A simple prompt which indicates a normal or root user.

Prompt Segment

Options

  • PL_PROMPT_ROOT_FG=fgcolor
    • Color when user is root
  • PL_PROMPT_ROOT_BG=bgcolor
    • Background color when user is root

Add to the config file:

PL_SEGMENTS+=(
    'prompt_segment background  foreground'
)
PL_PROMPT_ROOT_FG=fgcolor
PL_PROMPT_ROOT_BG=bgcolor

Battery

A battery power indicator.

Battery Segment

Add to the config file.

PL_SEGMENTS+=(
    'battery_segment background  foreground'
)

Duration

Shows the time taken by the last command.

Duration Segment

Add to the config file:

PL_SEGMENTS+=(
    'battery_segment background  foreground'
)

Git

Indicates a git repository and its status.

Git Segment

Options

  • PL_GIT_DIRTY_FG=fgcolor
    • Foreground color when repository is modified
  • PL_GIT_DIRTY_BG=bgcolor
    • Background color when repository is modified
  • PL_GIT_SHOW_STATUS
    • Display Modified,Added,Staged,etc

Add to the config file:

PL_SEGMENTS+=(
    'git_segment    background foreground'
)
PL_GIT_DIRTY_FG=fgcolor
PL_GIT_DIRTY_BG=bgcolor
PL_GIT_SHOW_STATUS=true

SSH

Indicate an active SSH session.

SSH Segment

Options

  • PL_SSH_SHOW_HOST=true|false
    • if true show the host name, if false show symbol only
  • PL_SSH_USE_IP=true|false
    • if true show the IP address instead of the host name

Add to the config file:

PL_SEGMENTS+=(
  'ssh_segment bgcolor fgcolor'
)
PL_SSH_SHOW_HOST=true
PL_SSH_SHOW_IP=true

Screen Session

Indicate when a screen session is active.

Screen Segment

Add to the config file:

PL_SEGMENTS+=(
  'screen_segment  bgcolor fgcolor'
)

Python Virtual Env

Shows the name of python virtual environment when active.

Python Virtual Env

Add to the config file:

PL_SEGMENTS+=(
  'virtual_env_segment  bgcolor fgcolor'
)

Python Conda Env

Shows the name of python conda environment when active.

Python Conda Env

Add to the config file:

PL_SEGMENTS+=(
  'conda_env_segment  bgcolor fgcolor'
)

Kubernetes

If set, display the Kubernetes context and namespace.

Kubernetes Segment

Add to the config file:

PL_SEGMENTS+=(
  'kubernetes_segment  bgcolor fgcolor'
)

AWS Profile

If defined, show the AWS profile name.

AWS Profile Segment

Add to the config file:

PL_SEGMENTS+=(
  'aws_profile_segment  bgcolor fgcolor'
)