Tmux .tmux.conf doesn't load properly
The issue was invisible bytes creeping inside the document. Only when editing in Vim was I able to see it. Thanks.
tmux : config files are not used
After you make changes to ~/.tmux.conf
make sure tmux sources them with the tmux source-file ~/.tmux.conf
shell command.
tmux not loading asdf config
The actual problem was because of the $PATH
has been prepended automatically by /etc/zprofile
again when I opened the tmux session.
In order to prevent that, I just disable it when it's in tmux session:
# /etc/zprofile
# system-wide environment settings for zsh(1)
if [ -x /usr/libexec/path_helper ]; then
if [ -z "$TMUX" ]; then
eval `/usr/libexec/path_helper -s`
fi
fi
Error in tmux's configuration file
Start with what you want the shell to get:
iwgetid | cut -d '"' -f 2
Wrap it in #()
so that it will be treated as a shell command in the expansion of status-left
:
#(iwgetid | cut -d '"' -f 2)
Embed this as a string that tmux can parse. You tried to put single quotes around it:
'#(iwgetid | cut -d '"' -f 2)'
The problem is that tmux will interpret the first of the “inner” single quotes and the first of the “outer” single quotes as a single string segment, leaving the following double quote at the top-level where it now forms an unterminated string segment; the error message is not terribly clear in this situation.
To fix the problem you need to properly quote the format string (which embeds the shell command) for your chosen tmux quote characters. You might do it like this:
set -g status-left '#(iwgetid | cut -d '"'\"'"' -f 2)'
But, that is a bit hard to read, so you might consider switching your shell command to something more easily tmux-quotable:
iwgetid | cut -d \" -f 2
Which you can embed in status-left
with tmux single quotes like this:
set -g status-left '#(iwgetid | cut -d \" -f 2)'
Or with tmux double quotes like this:
set -g status-left "#(iwgetid | cut -d \\\" -f 2)"
Keep in mind that tmux quoting is similar to, but not identical to Bourne-style shell quoting (e.g. top-level backslash escaping does not work the same). This quoting system is used in the config file, command-prompt
(e.g. Prefix :
), the confirm-before
and if-shell
command parameters, and the command templates for the choose-
commands.
Tmux - Tmux true color is not working properly
Perhaps you overlooked this in setting up (one can see that you overlooked Tc
):
commit 427b8204268af5548d09b830e101c59daa095df9
Author: nicm <nicm>
Date: Fri Jan 29 11:13:56 2016 +0000
Support for RGB colour, using the extended cell mechanism to avoid
wasting unnecessary space. The 'Tc' flag must be set in the external
TERM entry (using terminal-overrides or a custom terminfo entry), if not
tmux will map to the closest of the 256 or 16 colour palettes.
Mostly from Suraj N Kurapati, based on a diff originally by someone else.
in tmux.conf:
# Enable RGB colour if running in xterm(1)
set-option -sa terminal-overrides ",xterm*:Tc"
in the manpage:
TERMINFO EXTENSIONS
tmux understands some unofficial extensions to terminfo(5):
...
Tc Indicate that the terminal supports the ‘direct colour’ RGB
escape sequence (for example, \e[38;2;255;255;255m).
If supported, this is used for the OSC initialize colour escape
sequence (which may be enabled by adding the ‘initc’ and ‘ccc’
capabilities to the tmux terminfo(5) entry).
Regarding -s
versus -g
, the manual page says:
set-option
[-agoqsuw] [-t target-session | target-window] option value
(alias: set)
Set a window option with -w (equivalent to the
set-window-option command), a server option with-s
, otherwise
a session option. If-g
is given, the global session or window
option is set. The -u flag unsets an option, so a session
inherits the option from the global options (or with -g,
restores a global option to the default).The -o flag prevents setting an option that is already set and
the -q flag suppresses errors about unknown or ambiguous
options.With
-a
, and if the option expects a string or a style, value
is appended to the existing setting.
As I understand it,
Using -s
means that new connections (created by the server) will get this setting, which is useful in shell initialization, while -g
makes its changes too late for the shell initialization.
Further reading:
- Add TrueColor Support #34
- Tmux true color support. #622
- Why only 16 (or 256) colors? (ncurses FAQ)
Start Tmux with Command & Specify Configuration File
You need to move the -f …
to before new-session
. It is an argument for tmux itself; the new-session
(sub)command does not understand or accept -f
.
Also, the configuration file (~/.tmux.conf
, or the one specified with -f
) is only used when initially starting a server. If you have other (possibly detached) sessions running under the default server, then the -f …
portion of your command will go unused. Check for other sessions with tmux ls
.
You might want to use -L
(or -S
) to specify an alternate server (i.e. one where you can make sure your session is always the only one):
tmux -L myapp -f myapp-tmux.conf new-session -d -s myapp 'python myapp.py'
Later, to attach to that session:
tmux -L myapp attach -t myapp
(You may leave off -t myapp
if the sever only has that one session.)
If you do want to use you existing server (so that changes made via the configuration file can affect your other sessions), then you might want to use source
instead:
tmux source myapp-tmux.conf \; new-session -d -s myapp 'python myapp.py'
Tmux commands doesn't work
You have changed the default escape-sequence in your configuration: from Ctrl-B
(tmux default) to Ctrl-A
(just like the similar terminal multiplexer screen
).
The relevant configuration lines are in the third paragraph:
# unbind default prefix and set it to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
If you want to use tmux default one just comment out (with a leading #
) or remove the lines above in your tmux.conf
.
Related Topics
Find Syslog Max Message Length
How to 'Chmod -R +W' with Ant, Files and Folders
Unexpected Periodic Behaviour of an Ultra Low Latency Hard Real Time Multi-Threaded X86 Code
What Exactly Is Program Stack's Growth Direction
Linux Kernel Code in Memory Check with Sha256 Sum
Matching Third Field in a CSV with Pattern File in Gnu Linux (Awk/Sed/Grep)
Catch Signal in Bash But Don't Finish Currently Running Command
Running Meteor Application on a Single Core
Linux Configuration - Ssmtp: Cannot Open Smtp.Gmail.Com:587
Removing File from Folder in Linux
How to Execute 'X86_64-Conda_Cos6-Linux-Gnu-Gcc': No Such File or Directory (Pysam Installation)
Count Number of Column in a Pipe Delimited File
How to Set Environment Variable in Linux Permanently
System Calls: Difference Between Sys_Exit(), Sys_Exit and Exit()