[Git-commits] [grml/grml-etc-core] a4aa14: tmux.conf: detect running as tmate and disable non...

Michael Prokop noreply at github.com
Fri Nov 25 15:35:39 CET 2022


  Branch: refs/heads/master
  Home:   https://github.com/grml/grml-etc-core
  Commit: a4aa1466791b786069ec3c8abddef77e797cf876
      https://github.com/grml/grml-etc-core/commit/a4aa1466791b786069ec3c8abddef77e797cf876
  Author: Darshaka Pathirana <dpat at syn-net.org>
  Date:   2022-11-25 (Fri, 25 Nov 2022)

  Changed paths:
    M etc/tmux.conf

  Log Message:
  -----------
  tmux.conf: detect running as tmate and disable non-supported features

tmux versions >=2.3 support the -q option for source-file to suppress
errors for nonexistent files. Even Debian/oldoldstable has tmux v2.3-4,
so this works nice everwhere, *except* for when invoking tmate, which is
a fork based on an old version of tmux, which then complains about:

| /etc/tmux.conf:75: usage: source-file path
| /etc/tmux.conf:36: usage: source-file path

Try to detect tmate from within the environment, and then enable
the configuration only when *not* running from within tmate.

This commit relies on @mika's commit grml/grml-etc-core at 71101e0 (the
commit message was shamelessly copied, thx!), but two things changed:

* Use "! (env | grep -q TMUX=/tmp/tmate)" instead of "env | grep -q
  TMUX=/tmp/tmate && false" which always results in false:

  $ true && false; echo $?
  1

* Double escape the semicolon (;) (i.e. \\;).

  Because if bind-key is set up to call multiple commands, each command
  needs to be separated with \;.
  (Each command is terminated by a newline or a semicolon. Commands
  separated by semicolons together form a ‘command sequence’).
  And if bind-key is called within if-shell \; needs to be escaped one
  more time. (No escaping would have been needed when using braces ({}),
  but tmate does not seem to support braces.)

  See: COMMAND PARSING AND EXECUTION + PARSING SYNTAX in man page tmux(1).

Replaces the PR: grml/grml-etc-core#151


  Commit: 330bb70cb5074d46e491e656852605378a53c214
      https://github.com/grml/grml-etc-core/commit/330bb70cb5074d46e491e656852605378a53c214
  Author: Michael Prokop <mika at grml.org>
  Date:   2022-11-25 (Fri, 25 Nov 2022)

  Changed paths:
    M etc/tmux.conf

  Log Message:
  -----------
  Merge remote-tracking branch 'origin/github/pr/152'


Compare: https://github.com/grml/grml-etc-core/compare/acf8cd2a2be0...330bb70cb507


More information about the Git-commits mailing list