Search code examples
debuggingtmux

How to debug print the values of tmux settings?


For example, if I want to know the value of textwidth in vim, I can dereference it by appending a ?. Thus, I will simply type :set textwidth?.

How can you do the equivalent in tmux?


Solution

  • To dereference the value of a tmux setting or variable, you can run the following terminal command:

    tmux display-pane -p #{<setting-or-variable-name>}
    

    Or, to be more verbose

    tmux display-pane -p "The value of your setting or variable is #{<setting-or-variable-name>}"
    

    Example of a working command:

    tmux display-message -p "You have #{display-panes-time}ms to press a number key after running 'display-pane'"
    

    Note: The corresponding command-prompt commands, surprisingly, will fail:

    :display-pane #{display-panes-time}
    :display-pane #{display-panes-colour}
    

    However, when you add quotes, they act as expected:

    :display-pane "#{display-panes-time}"
    :display-pane "#{display-panes-colour}"
    

    What...?