gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.54k stars 3.33k forks source link

Command prompt position -- don't hide status line #741

Closed Nicholas-Autio-Mitchell closed 2 months ago

Nicholas-Autio-Mitchell commented 2 months ago

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?

gpakosz commented 2 months ago

Hello @Nicholas-Autio-Mitchell 👋,

You can try the following, ⚠️ pretty much untested and very specific to you needs...

Edit your .local customization file and so that it contains the following:

...

bind : run-shell "cut -c3- $TMUX_CONF_LOCAL | sh -s command_prompt"

# -- tpm -----------------------------------------------------------------------

...

# # /!\ do not remove the following line
# EOF
#
# # /!\ do not "uncomment" the functions: the leading "# " characters are needed
#
# command_prompt() {
#   _status=$(tmux show -v 'status')
#   _status_format_0=$(tmux show -v 'status-format[0]')
#   _status_format_1=$(tmux show -v 'status-format[1]')
#   tmux set 'status-format[1]' "$_status_format_0"
#   tmux set status 2
#   tmux command-prompt
#   tmux set status "$_status"
#   tmux set 'status-format[1]' "$_status_format_1"
# }

...
Nicholas-Autio-Mitchell commented 2 months ago

Thanks for the quick reply!

That did open a new line for the command prompt, but at the same time made the status line disappear (and it never comes back).

gpakosz commented 2 months ago

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?

Nicholas-Autio-Mitchell commented 2 months ago

That works - thanks a bunch!