0

I've just started using tmux. Some workflows I have at the moment work very well with a vertically-split, 1/3rd-2/3rd screen (or 1/4-3/4).

Unfortunately, the zsh prompt I currently have, when I'm working on this particular task, gets too long (thanks to long prompts).

Is there a way that I can choose the prompt I want to use per-session, to allow me to use a shorter, more task-specific prompt in the smaller window, and a larger prompt in the second window?

1 Answer 1

0
  • to specifically truncate one shell and not another, you should have i. some way to tell one from the other and a shell function call inside your prompt definition such as

    setopt PROMPT_SUBST
    function my_local_function() { ... }
    PROMPT='%B%m%~%b$(my_local_function) %# '
    

See this for a real life example of mucking with the prompt using functions (<-- disclaimer: notice that the lame git prompt code project there is my own...)

Alternatives are:

  • You can place a ternary expression inside your prompt %(x.true-text.false-text) (see the shell manual). Can be used to truncate the number of displayed dirs.

  • You can also restrict the length of the prompt truncating it with %8<..<%/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .