I like the idea of a "local" variable (user option) even better than
using an env variable. At least for the toggle thingy. I just didn't
know that this was possible.

But yea, an env var should work too.

Cheers,
 K. C.

On 2018-03-22 15:04, Nicholas Marriott wrote:
> Great. I don't know why an environment variable didn't work, it seems
> like it should. I'll take a look when I get home.
> 
> 
> On Thu, 22 Mar 2018, 19:03 Helmut K. C. Tessarek, <tessa...@evermeet.cx
> <mailto:tessa...@evermeet.cx>> wrote:
> 
>     Eureka! Great idea.
> 
>     This worked:
> 
>     bind C-b if -F '#{@TPCS}' \
>     'set -g @TPCS "0"; display-message "TPCS=0"' \
>     'set -g @TPCS "1"; display-message "TPCS=1"'
> 
>     Cheers,
>       K. C.
> 
>     On 2018-03-22 14:42, Nicholas Marriott wrote:
>     > It is definitely possible. Did you try a user option instead of an
>     > environment variable?
>     >
>     > On Thu, 22 Mar 2018, 18:39 Helmut K. C. Tessarek,
>     <tessa...@evermeet.cx <mailto:tessa...@evermeet.cx>
>     > <mailto:tessa...@evermeet.cx <mailto:tessa...@evermeet.cx>>> wrote:
>     >
>     >     I tried that too. It does not work. So maybe this use-case is not
>     >     supported or possible.
>     >
>     >     Too bad, I really would have loved using a toggle, but I'm
>     afraid I will
>     >     have to map my 2 sequences to 2 separate keys instead.
>     >
>     >     Unless you have another idea...
>     >
>     >     Cheers,
>     >       K. C.
>     >
>     >     On 2018-03-22 14:24, Nicholas Marriott wrote:
>     >     > I can't try it now. #{} is not expanded in config file. But $
>     >     might be.
>     >     >
>     >     >
>     >     >
>     >     > On Thu, 22 Mar 2018, 18:14 Helmut K. C. Tessarek,
>     >     <tessa...@evermeet.cx <mailto:tessa...@evermeet.cx>
>     <mailto:tessa...@evermeet.cx <mailto:tessa...@evermeet.cx>>
>     >     > <mailto:tessa...@evermeet.cx <mailto:tessa...@evermeet.cx>
>     <mailto:tessa...@evermeet.cx <mailto:tessa...@evermeet.cx>>>> wrote:
>     >     >
>     >     >     It still does not work. I believe the variable is only
>     >     interpreted the
>     >     >     first time when the config file is read.
>     >     >
>     >     >     Please try the following:
>     >     >
>     >     >     bind C-b if -F '#{TPCS}' \
>     >     >             'setenv -g TPCS 0; display-message "TPCS=0"' \
>     >     >             'setenv -g TPCS 1; display-message "TPCS=1"'
>     >     >
>     >     >     If you try it, you'll see that "TPCS=1" is shown all the
>     time.
>     >     >
>     >     >     Cheers,
>     >     >       K. C.
>     >     >
>     >     >
>     >     >     On 2018-03-22 14:05, Nicholas Marriott wrote:
>     >     >     > It is #{}.
>     >     >     >
>     >     >     > $ tmux setenv -g FOO 1
>     >     >     > $ tmux if -F '#{FOO}' 'run "echo yes >/tmp/foo"' 'run
>     "echo no
>     >     >     >/tmp/foo"'
>     >     >     > $ cat /tmp/foo
>     >     >     > yes
>     >     >     > $ tmux setenv -g FOO 0
>     >     >     > $ tmux if -F '#{FOO}' 'run "echo yes >/tmp/foo"' 'run
>     "echo no
>     >     >     >/tmp/foo"'
>     >     >     > $ cat /tmp/foo
>     >     >     > no
>     >     >     > $ tmux setenv -gu FOO
>     >     >     > $ tmux if -F '#{FOO}' 'run "echo yes >/tmp/foo"' 'run
>     "echo no
>     >     >     >/tmp/foo"'
>     >     >     > $ cat /tmp/foo
>     >     >     > no
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > On Thu, Mar 22, 2018 at 01:45:42PM -0400, Helmut K. C.
>     >     Tessarek wrote:
>     >     >     >> Thanks for the reply.
>     >     >     >>
>     >     >     >> On 2018-03-22 13:37, Nicholas Marriott wrote:
>     >     >     >>> Try if -F '#{TPCS}'
>     >     >     >>>
>     >     >     >>> Or maybe $TPCS I forget.
>     >     >     >>
>     >     >     >> I tried the following:
>     >     >     >>
>     >     >     >> bind C-b if -F '#{TPCS}' \ [next 2 lines as before]
>     >     >     >>
>     >     >     >> and
>     >     >     >>
>     >     >     >> bind C-b if -F '$TPCS' \ [next 2 lines as before]
>     >     >     >>
>     >     >     >> Unfortunately neither worked.
>     >     >     >>
>     >     >     >> Cheers,
>     >     >     >>   K. C.
>     >     >     >>
>     >     >     >> --
>     >     >     >> regards Helmut K. C. Tessarek              KeyID
>     >     0x172380A011EF4944
>     >     >     >> Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0
>     >     11EF 4944
>     >     >     >>
>     >     >     >> /*
>     >     >     >>    Thou shalt not follow the NULL pointer for chaos
>     and madness
>     >     >     >>    await thee at its end.
>     >     >     >> */
>     >     >     >>
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >     >
>     >     >     --
>     >     >     regards Helmut K. C. Tessarek              KeyID
>     >     0x172380A011EF4944
>     >     >     Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723
>     80A0 11EF
>     >     4944
>     >     >
>     >     >     /*
>     >     >        Thou shalt not follow the NULL pointer for chaos and
>     madness
>     >     >        await thee at its end.
>     >     >     */
>     >     >
>     >
>     >
>     >     --
>     >     regards Helmut K. C. Tessarek              KeyID
>     0x172380A011EF4944
>     >     Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF
>     4944
>     >
>     >     /*
>     >        Thou shalt not follow the NULL pointer for chaos and madness
>     >        await thee at its end.
>     >     */
>     >
> 
> 
>     --
>     regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
>     Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944
> 
>     /*
>        Thou shalt not follow the NULL pointer for chaos and madness
>        await thee at its end.
>     */
> 


-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tmux-users+unsubscr...@googlegroups.com.
To post to this group, send an email to tmux-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to