You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/quickstart_python.rst
+21-26Lines changed: 21 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ has some awesome CLI features, or setup vanilla :py:mod:`readline` support.
23
23
"""""""""""""""""""""""""""
24
24
25
25
.. seealso::
26
-
Source: `How do I add tab-completion to the python shell`_ on
26
+
Source: `How do I add tab-completion to the python shell`_ on
27
27
`StackOverflow`_.
28
28
29
29
Create ``~.pythonrc`` in ``$HOME`` folder:
@@ -40,7 +40,7 @@ Create ``~.pythonrc`` in ``$HOME`` folder:
40
40
import rlcompleter
41
41
readline.parse_and_bind("tab: complete")
42
42
43
-
Then to your ``.bashrc`` or ``.zshrc`` file, add:
43
+
Then in your ``.bashrc`` or ``.zshrc`` file, add:
44
44
45
45
.. code-block:: bash
46
46
@@ -130,7 +130,7 @@ Find your :class:`Session`
130
130
and allow a quick option to grab the current tmux's environment's
131
131
:class:`Server`, :class:`Window` and :class:`Pane` via CLI.
132
132
133
-
If you have multiple tmux session's open. You can see that all of the
133
+
If you have multiple tmux sessions open, you can see that all of the
134
134
methods in :class:`Server` are available.
135
135
136
136
We can list sessions with :meth:`Server.list_sessions`:
@@ -140,16 +140,16 @@ We can list sessions with :meth:`Server.list_sessions`:
140
140
>>> server.list_sessions()
141
141
[Session($3 a_tmuxp_session), Session($1 tmuxp)]
142
142
143
-
This returns a list of :class:`Session` objects you can grab. You could
144
-
our current session with:
143
+
This returns a list of :class:`Session` objects you can grab. We can
144
+
find our current session with:
145
145
146
146
.. code-block:: python
147
147
148
148
>>> server.list_sessions()[0]
149
149
150
-
That's not guaranteed. tmuxp works against current tmux information, the
151
-
session's name could be changed, or another tmux session may be created,
152
-
so :meth:`Server.getById` and :meth:`Server.findWhere` exists as a lookup:
150
+
However, this isn't guaranteed, tmuxp works against current tmux information, the
151
+
session's name could be changed, or another tmux session may be created,
152
+
so :meth:`Server.getById` and :meth:`Server.findWhere` exists as a lookup.
153
153
154
154
Get session by ID
155
155
-----------------
@@ -197,8 +197,8 @@ Playing with our tmux session
197
197
.. todo::
198
198
199
199
Consider migrating tmuxp to use a ``.execute`` sqlalchemy style and have
200
-
commands such as ``new_window()`` return CLI output. Also tmuxp could use
201
-
use "engine" as a way to control if it's using socket's or shell commands
200
+
commands such as ``new_window()`` return CLI output. Also tmuxp could
201
+
use "engine" as a way to control if it's using a socket or shell commands
202
202
to handle tmux.
203
203
204
204
We now have access to ``session`` from above with all of the methods
@@ -231,23 +231,20 @@ Method 1: Use passthrough to tmux's ``target`` system.
231
231
232
232
>>> session.kill_window("ha in")
233
233
234
-
The window in the bg dissapeared. This was the equivalent of ``$ tmux kill-window -t'ha in'``
234
+
The window in the bg dissappeared. This was the equivalent of ``$ tmux kill-window -t'ha in'``
235
235
236
-
Internally, tmux uses ``target``. It's specific behavior depends on what the target is, view
237
-
the manpage for tmux for more.
236
+
Internally, tmux uses ``target``. Its specific behavior depends on what the target is, view the tmux manpage for more information.
238
237
239
-
This section contains a list of the commands supported by tmux. Most commands accept the
240
-
optional -t argument with one of target-client, target-session target-window, or target-pane.
238
+
This section contains a list of the commands supported by tmux. Most commands accept the optional -t argument with one of target-client, target-session target-window, or target-pane.
241
239
242
-
In this case, you can also go back in time an recreate the window again. The CLI should have history,
243
-
so press the up arrow key should work.
240
+
In this case, you can also go back in time and recreate the window again. The CLI should have history, so navigate up with the arrow key.
244
241
245
242
.. code-block:: python
246
243
247
244
>>> session.new_window(attach=False, window_name="ha in the bg")
248
245
Window(@113:ha in the bg, Session($3 a_tmuxp_session))
249
246
250
-
Try to kill by the ``@[0-9999]`` the created window gave you.
247
+
Try to kill the window by the matching id ``@[0-9999]``.
251
248
252
249
.. code-block:: python
253
250
@@ -312,7 +309,7 @@ You should have noticed :meth:`Window.rename_window` renamed the window.
312
309
Moving cursor across windows and panes
313
310
--------------------------------------
314
311
315
-
You have to ways you can move your cursor to new sessions, windows and panes.
312
+
You have two ways you can move your cursor to new sessions, windows and panes.
316
313
317
314
For one, arguments such as ``attach=False`` can be omittted.
318
315
@@ -321,7 +318,7 @@ For one, arguments such as ``attach=False`` can be omittted.
321
318
>>> pane = window.split_window()
322
319
323
320
This gives you the :class:`Pane` along with moving the cursor to a new window. You
324
-
can also use the ``.select_*`` available on the object. In this case, pane has
321
+
can also use the ``.select_*`` available on the object, in this case the pane has
325
322
:meth:`Pane.select_pane()`.
326
323
327
324
.. code-block:: python
@@ -338,7 +335,7 @@ Sending commands to tmux panes remotely
338
335
---------------------------------------
339
336
340
337
You may send commands to panes, windows and sessions **without** them being visible.
341
-
As long as you have the object, or are iterating through a list of them, you can ``.send_keys``.
338
+
As long as you have the object, or are iterating through a list of them, you can use ``.send_keys``.
342
339
343
340
.. code-block:: python
344
341
@@ -347,12 +344,10 @@ As long as you have the object, or are iterating through a list of them, you can
347
344
>>> pane.send_keys('echo hey', enter=False)
348
345
349
346
See the other window, notice that :meth:`Pane.send_keys` has " ``echo hey``" written,
350
-
*still in the prompt*. Note the leading space character so the command won't be added
351
-
to the user's history. Use `pane.cmd('send-keys', text)` to send keys without this
352
-
leading space.
347
+
*still in the prompt*. Note the leading space character so the command won't be added to the user's history. Use `pane.cmd('send-keys', text)` to send keys without this leading space.
353
348
354
349
``enter=False`` can be used to send keys without pressing return. In this case,
355
-
you may leave it to the user to press return themselves, or complete a command
350
+
you may leave it to the user to press return himself, or complete a command
356
351
using :meth:`Pane.enter()`:
357
352
358
353
.. code-block:: python
@@ -363,7 +358,7 @@ Final notes
363
358
-----------
364
359
365
360
These objects created use tmux's internal usage of ID's to make servers,
366
-
sessions, windows and panes accessible at the object level.
361
+
sessions, windows and panes accessible at the object level.
367
362
368
363
You don't have to see the tmux session to be able to orchestrate it. After
369
364
all, :class:`WorkspaceBuilder` uses these same internals to build your
0 commit comments