I tried to find something similar recently, in my case, for setting the window information (for the Tmux command choose-window
) to something more informative than the default.
In the man page, the relevant information seems to be in the FORMATS section, which is also used by the status-{left,right}
commands:
FORMATS
Certain commands accept the -F flag with a format argument. This is a
string which controls the output format of the command. Replacement
variables are enclosed in ‘#{’ and ‘}’, for example ‘#{session_name}’.
The possible variables are listed in the table below, or the name of a
tmux option may be used for an option's value. Some variables have a
shorter alias such as ‘#S’, and ‘##’ is replaced by a single ‘#’.
Conditionals are available by prefixing with ‘?’ and separating two
alternatives with a comma; if the specified variable exists and is not
zero, the first alternative is chosen, otherwise the second is used.
For example ‘#{?session_attached,attached,not attached}’ will include
the string ‘attached’ if the session is attached and the string ‘not
attached’ if it is unattached, or ‘#{?automatic-rename,yes,no}’ will
include ‘yes’ if automatic-rename is enabled, or ‘no’ if not.
A limit may be placed on the length of the resultant string by prefixing it by an ‘=’, a number and a colon. Positive numbers count from the start of
the string and negative from the end, so ‘#{=5:pane_title}’ will
include at most the first 5 characters of the pane title, or
‘#{=-5:pane_title}’ the last 5 characters. Prefixing a time variable
with ‘t:’ will convert it to a string, so if ‘#{window_activity}’
gives ‘1445765102’, ‘#{t:window_activity}’ gives ‘Sun Oct 25 09:25:02
2015’. The ‘b:’ and ‘d:’ prefixes are basename(3) and dirname(3) of
the variable respectively. A prefix of the form ‘s/foo/bar/:’ will
substitute ‘foo’ with ‘bar’ throughout.
In addition, the first line of
a shell command's output may be inserted using ‘#()’. For example,
‘#(uptime)’ will insert the system's uptime. When constructing
formats, tmux does not wait for ‘#()’ commands to finish; instead, the
previous result from running the same command is used, or a
placeholder if the command has not been run before. Commands are
executed with the tmux global environment set (see the ENVIRONMENT
section).
After some attempts, I can't seem to make the built-in sed
-like method work with the #{pane_current_path}
directory name. Since you can also use any shell command or environmental variables, though, you can simply use some variation of
set status-left "#(basename ${PWD})"
I don't know about Powerline compatibility, since at the moment I'm not using it.