How to set and use variable in tmux.conf depending on whether an environment variable is set

后端 未结 2 1568
醉梦人生
醉梦人生 2021-02-14 10:42

(Disclaimer: I am fully aware that there are solutions to the problem I describe below that involve writing and calling shell scripts that interact with a running tmux server, o

2条回答
  •  心在旅途
    2021-02-14 11:07

    Also you can use display -p to print formats. In master and 2.9 you can add -v to see how they are parsed:

    $ tmux setenv -g FOO bar
    $ tmux display -pv '#{==:#{FOO},baz}'
    # expanding format: #{==:#{FOO},baz}
    # found #{}: ==:#{FOO},baz
    # modifier 0 is ==
    #  expanding format: #{FOO}
    #  found #{}: FOO
    #  format 'FOO' found: bar
    #  replaced 'FOO' with 'bar'
    #  result is: bar
    #  expanding format: baz
    #  result is: baz
    # compare == left is: bar
    # compare == right is: baz
    # replaced '==:#{FOO},baz' with '0'
    # result is: 0
    0
    

提交回复
热议问题