Skip to content

[Feature Request] Do we have an option to <prefix>: at the middle/centre of the statusline? #4483

@nyngwang

Description

@nyngwang

This is a question if it's currently achievable, otherwise please treat this as a feature request (and I will update my title for sure!).

Question

Do we have a way to "justify"(like the one status-justify) the position of the command prompt header when we press the default <prefix>:? I have checked the man tmux many times and tried many different options but still can't figure it out.

Reason

In short, consistency of customization. With the current capability of tmux, I have aligned everything to the center:

  1. The session window list by set -g status-justify absolute-centre
  2. The title of pane shown on every pane border by set -g pane-border-format "#[align=centre]..."

The last piece to make everything "centered" is the command prompt header shown when pressing the default keybind <prefix>:. (and it's : by default)

It's not just for aesthetic reason:

  1. For me, if a user has moved most of the information to the center, it's very likely that the user might also want to create/read new information at the center too. This creates better UX, since there is a single source of information. By the default settings of tmux, a user read all information (session name, window name, pane title, etc) on the left-hand side. But in my case, it will be very nice if I could read "session name", "window name", "pane title", "command header" all nearby the center.
  2. From a medical point of view, it's bad for one's neck if one gets used to "looking at the left half of the screen" since "all information are there".

Workaround

Currently, I found a workaround by re-binding the default : with command-prompt -p "..." -T command where the command prompt header is prefixed by a long sequence of dashes for padding, it ended up looking like this:

(There is a trap in this approach that one should not use printf for the padding in the -p "..." part, otherwise the first triggering of <prefix>: will not have printf applied. This can be workaround by replacing -p '#(printf "%%80s:" "" | tr " " "-")' with a static string with 80-dashes. As you can see, this is inconvenience.)

Consequence

It might be strange that : appear in the middle of the message line, but we can increase the readability easily. For example, by providing a meaningful prompt header and by removing the dashes. To demonstrate the effect, I tried command-prompt -p (but it looks a bit cumbersome, since I have to avoid printf) for the reason mentioned above:

unbind :; bind : command-prompt -p "                                                                             -->#[fg=#f8f32b bg=black] tmux-command-here::#[default]" -T command "%%"

I'm stilling finding a way to change the background color for both the command prompt header and that of the prompt text a user is typing.

Wishes

  1. It would be nice if we could have an option to align the command prompt header.
  2. If 1. rejected, It would be nice if we could have a way to align both the command prompt header and the prompt typing by the user when we define command-prompt.

By doing so, we can avoid the problem of printf and the readability of a static string.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions