Skip to content

Feature request: customise terminal title format #656

@benjamineskola

Description

@benjamineskola

Currently the title format is hardcoded in two calls to prompt_pure_set_title(). This means that if I want to change the format of the title, I have to entirely override that function and then add hooks of my own to set the title with the appropriate ANSI codes. That's both more complicated than it needs to be and inherently fragile, since it assumes that the function name will never change.

I have two (complementary) suggestions:

  1. Add a variable to disable prompt setting, wrapping around the two calls to prompt_pure_set_title(). Default to leaving it enabled but allow the user to switch it off and manage the prompt on their own if they wish.
  2. Add variables that determine the contents of the prompt, using the current values as defaults: ${PURE_PROMPT_TITLE_IDLE:-%~} or something along those lines. That way the user can override one or both of those as they wish.

I can try opening a PR if that's useful.

General information

System report (output of prompt_pure_system_report):

  • Zsh: zsh 5.9 (x86_64-apple-darwin22.0) (/bin/zsh)
  • Operating system: macOS 13.3.1 (22E261)
  • Terminal program: WezTerm (20230408-112425-69ae8472)
  • Tmux: no
  • Git: git version 2.39.2 (Apple Git-143)
  • Pure state:
    • username: ''
    • prompt:
    • version: 1.21.0
  • zsh-async version: 1.8.6
  • PROMPT: typeset -g PROMPT=$'%F{${prompt_pure_colors[path]}}%~%f %F{242}${prompt_pure_vcs_info[branch]}%F{218}${prompt_pure_git_dirty}%f %F{$prompt_pure_colors[git:arrow]}${prompt_pure_git_arrows}%f %{ %}%(12V.%F{$prompt_pure_colors[virtualenv]}%12v%f .)%(?.%F{$prompt_pure_colors[prompt:success]}.%F{$prompt_pure_colors[prompt:error]})${prompt_pure_state[prompt]}%f '
  • Colors: typeset -g -A prompt_pure_colors=( [execution_time]=yellow [git:action]=yellow [git:arrow]=cyan [git:branch]=242 [git:branch:cached]=red [git:dirty]=218 [git:stash]=cyan [host]=242 [path]=blue [prompt:continuation]=242 [prompt:error]=red [prompt:success]=magenta [suspended_jobs]=red [user]=242 [user:root]=default [virtualenv]=242 )
  • TERM: export TERM=xterm-256color
  • Virtualenv: export VIRTUAL_ENV_DISABLE_PROMPT=12
  • Conda: export CONDA_CHANGEPS1=no
  • Detected frameworks: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions