Skip to content

Segments

Chris Marsh edited this page Feb 13, 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 config file with:

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
    • 'username' or 'username@127.0.0.1'

Add to your 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 .../alsa/free

Add to the config file:

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

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_AHEAD=true
    • Optional segment to show when the repository is ahead or behind
  • PL_GIT_MODIFIED=true
    • Optional segment to Show number of modified files
  • PL_GIT_STAGED=true
    • Optional segment to show number of staged files
  • PL_GIT_CONFLICTS=true
    • Optional segment to show number of conflicts
  • PL_GIT_UNTRACKED=true
    • Optional segment to show number of untracked files
  • PL_GIT_STASH=true
    • Optional segment to show number of stashed changes

Add to the config file:

PL_SEGMENTS+=(
    'git_segment    bgcolor fgcolor'
)
PL_GIT_DIRTY_FG=fgcolor
PL_GIT_DIRTY_BG=bgcolor
PL_GIT_AHEAD=true
PL_GIT_MODIFIED=true
PL_GIT_STAGED=true
PL_GIT_CONFLICTS=true
PL_GIT_UNTRACKED=true
PL_GIT_STASH=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


Virtual Env


Conda Env


Kubernetes


AWS Profile