.tmux: Command prompt position -- don't hide status line

I would like to enter tmux commands (using prefix-: and the for the command prompt line itself to appear on a new line just above/below the status line. I don’t want to hide the status line underneath.

This is useful because sometimes I want to include arguments in the prompt that I read from the status line e.g. the name of a tab.

I have tried adding the following to my user config, but it had no effect:

# Set the command prompt position
set -g command-prompt-position top

# Add a blank line above the command prompt
set -ag command-prompt-format "%%"

I can’t find related issues/docs on this – is it possible as a config change?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

The idea is that .tmux.conf and .tmux.conf.local files are polyglots

  • tmux sees the upper part as a configuration file see all lines that start with # as comments
  • cut -c3- ~/.tmux.conf.local | sh -s strips the first 3 columns and pipes this to sh, which starts interpreting the first line
  • : << 'EOF' tells sh to send the following Here Document (upon finding the EOF string) to :, which means “just ignore all of it”
  • The Here Document contains the upper part, which is in tmux syntax, with the first 3 columns truncated and doesn’t make sense anymore but that’s fine because we just ignore it all
  • The difference between : << 'EOF' and : << EOF is:
    • With quotation, sh won’t try to interpolate the content of the Here Document
    • Without quotation, sh tries to interpolate the content of the Here Document and is unhappy because the “opening” ` is not matched with a “closing” `

Hmm,

# command_prompt() {
#   _status_format_0=$(tmux show -gv 'status-format[0]')
#   tmux set 'status-format[0]' "$_status_format_0"
#   tmux set 'status-format[1]' "$_status_format_0"
#   tmux set status 2
#   tmux command-prompt
#   tmux set -u 'status-format'
#   tmux set -u status
# }

Is it better?