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@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
Merge remote-tracking branch 'origin/github/pr/138'
tmux.conf: Add bind-key J to join marked pane to active window We have "bind-key j" which joins "the last active pane to the currently active window". This is cool, if you are able to directly jump to the window where the pane should go to. Old people like me do not remember the window (number) where they came from and skim around until they find the window in question, try to remember the window number, jump back and forth from window with the needed pane and finally "join the last active pane to the currently active window". This is a bit cumbersome, but with "bind-key m" it is possible to mark the pane in question, skim around until one fine the window where the pane belongs and "join the marked pane to the currently active window".
tmux.conf: source user-specific local conf file ~/.tmux.conf.local To manage a user-specific local configuration file (like in Grml's '.vimrc.conf' + '.zshrc.conf') we need to source '~/.tmux.conf.local'. "bind-key R" (Reload Config) does now reload the 'main" config file '~/.tmux.conf' and the user-specific local configuration file '~/.tmux.conf.local'. With 'source-file -q', no error will be returned if the file does not exist.
tmux.conf: Fix /etc/tmux.conf:19: unknown key: \\ error message The previous change (see: c2cbdb01) tried to fix the error "unknown key: confirm-before". Unfortunately that change only solved the problem for tmux v3.0+. (Starting a new tmux session and reloading the configuration did not bring up the error message in the older (<v3.0) tmux versions, so I wrongly assumed that the change also worked for older versions.) The changelog ("CHANGES FROM 2.9 to 3.0") states the following: | INCOMPATIBLE: tmux's configuration parsing has changed to use yacc(1). There | is one incompatible change: a \ on its own must be escaped or quoted as | either \\ or '\' (the latter works on older tmux versions). | Entirely the same parser is now used for parsing the configuration file | and for string commands. This means that constructs previously only | available in .tmux.conf, such as %if, can now be used in string commands | (for example, those given to if-shell - not commands invoked from the | shell, they are still parsed by the shell itself). This change has been tested (I really hope so!) with the tmux versions running Debian/jessie (docker), Debian/stretch (docker), Debian/buster (host system) and Debian/bullseye (Grml daily ISO): * Debian/jessie: v1.9 * Debian/stretch: v2.3 * Debian/buster: v2.8 * Debian/bullseye: v3.1 Closes (again): grml/grml-etc-core#93
tmux.conf: Fix unknown key: confirm-before error message Quoting the man page tmux(1) of v3.1b: | Any other characters preceded by \ are replaced by themselves (that is, | the \ is removed) and are not treated as having any special meaning - so | for example \; will not mark a command sequence and \$ will not expand | an environment variable. and quoting the man page tmux(1) of v2.8: | Each command should be separated by spaces and a semicolon; commands are | executed sequentially from left to right and lines ending with a | backslash continue on to the next line, except when escaped by another | backslash. A literal semicolon may be included by escaping it with a | backslash (for example, when specifying a command sequence to bind-key). This implies that a backslash should also be escaped by a backslash but tmux still used to work with the unescaped backslash in older versions. This change has been tested with the tmux versions running Debian/jessie, Debian/stretch, Debian/buster and Debian/bullseye (currently testing): * Debian/jessie: v1.9 * Debian/stretch: v2.3 * Debian/buster: v2.8 * Debian/bullseye: v3.1 Closes: grml/grml-etc-core#93
tmux: use foo-style to set status styles From tmux 1.9, (20 Feb 2014), foo-{bg,fg,attr} commands have been deprecated and tmux recommended to use foo-style instead. Those options have been removed from tmux 2.9 It's more than 5 years from the deprecation of foo-{bg,fg,attr}. it should be safe to use the new option by now. Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
tmux: drop deprecated status-utf8 option From tmux's FAQ: | Since the 1.0 release, tmux will turn on UTF-8 related options automatically | (ie status-utf8, and utf8) if the above conditions are met. In tmux's upstream there's also: | commit 1b86f520ea1620628e569ea833c7b13306c18a4e | Author: nicm <nicm> | Date: Thu Nov 12 11:09:11 2015 +0000 | | Nuke the utf8 and status-utf8 options and make tmux only a UTF-8 | terminal. We still support non-UTF-8 terminals outside tmux, but inside | it is always UTF-8 (as when the utf8 and status-utf8 options were on). Starting with tmux v2.2 this option is no longer supported. While we still have tmux 1.9-6 in Debian/jessie there's at least a backport of v2.3-4~bpo8+1 available in jessie-backports (and corresponding v2.3-4 in testing/unstable), so the best we can do is drop the configuration setting overall. Thanks: Timo Boettcher for forwarding the bug report
tmux: remove obsolete mouse-select-pane option
tmux: background a window, reload config, improve binding
tmux join-pane
tmux: kill-pane instead of kill-window
tmux: kill-session for gebi
tmux: make copy&pase mode useable
tmux: date and time, and commented out alternatives
tmux: better user@host:session scheme
tmux: mouse-select-pane off to enable terminal window copy&paste
tmux.conf: more space, session name
tmux.conf: new statusline, space and backspace enabled for window switching
Add tmux.conf