File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -141,12 +141,27 @@ def cmd(
141141 cmd : str ,
142142 * args : t .Any ,
143143 ) -> tmux_cmd :
144- """Execute tmux subcommand against target window. See :meth:`Server.cmd` .
144+ """Execute tmux subcommand within window context .
145145
146- Send command to tmux with :attr:`window_id` as ``target-window``.
146+ Automatically adds ``-t`` for object's indow ID to the command. Pass ``-t``
147+ in args to override.
147148
148- Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
149- ``args`` will override using the object's ``window_id`` as target.
149+ Examples
150+ --------
151+ Create a pane from a window:
152+
153+ >>> window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0]
154+ '%...'
155+
156+ Magic, directly to a `Pane`:
157+
158+ >>> Pane.from_pane_id(pane_id=session.cmd(
159+ ... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=session.server)
160+ Pane(%... Window(@... ...:..., Session($1 libtmux_...)))
161+
162+ Returns
163+ -------
164+ :meth:`server.cmd`
150165 """
151166 if not any ("-t" in str (x ) for x in args ):
152167 args = ("-t" , self .window_id , * args )
You can’t perform that action at this time.
0 commit comments