Repository navigation
v0.67.0 - Literal names and the Format opt-in
libtmux 0.67.0 keeps a # in session names, window names, pane titles, start directories and buffer paths as typed, where tmux used to expand it as a format, and adds Format to have tmux expand one value on purpose. Server.new_session() with kill_session=True kills only the exactly named session, and exact=True matches a session name exactly in kill_session(), switch_client() and attach_session().
Highlights
#is literal in names, titles, start directories and buffer paths.rename_window("build#2")names the windowbuild#2, andrename_window("#S")names it#Srather than the session's name. This coversnew_session,new_window,rename_session,rename_window,set_title,split,new_pane, the respawn methods,display_popup's start directory and title,display_menu's title, the paths ofsave_bufferandload_buffer, andrun_shell'scwdon tmux 3.8, the first release that expands it (#901, #910).Formatopts one value into tmux's formats.pane.split(start_directory=Format("#{pane_current_path}"))opens a pane in the active pane's directory again. Each argument decides for itself, so one call can keep its name literal while expanding its start directory.+,joinandFormat.escape()add text from users or files and keep it literal, and adding plain text where tmux would read it as format syntax raisesValueError. Parameters that accept a format are typedstr | Format, so a type checker flags aFormatwhere tmux would store it as typed (#910).new_session(kill_session=True)kills only the exactly named session. Creatingdoomwithkill_session=Trueno longer removesdoomsday(#899).exact=for session names.kill_session,switch_clientandattach_sessionacceptexact=Trueto match a name exactly; without it they still match by prefix or pattern as tmux does, and warn when the name matched only that way (#899).
To keep tmux's expansion where you relied on it:
from libtmux import Format
pane.split(start_directory=Format("#{pane_current_path}"))
window.rename_window(Format("#{pane_current_command}"))See Literal text and tmux formats for which arguments are literal and how to opt in, and the changelog for the full list.
What's Changed
- Server(feat[kill_session]): Add exact= to match session names exactly by @tony in #899
- tmux(fix[formats]): Keep # literal in names, titles and directories by @tony in #901
- formats(feat[Format]): Opt into tmux formats by @tony in #910
Full Changelog: v0.66.0...v0.67.0