Skip to content

Commit 9b90369

Browse files
committed
docs(traversal): improvements
1 parent 348939b commit 9b90369

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

docs/topics/traversal.md

+30-28
Original file line numberDiff line numberDiff line change
@@ -5,88 +5,90 @@
55
libtmux convenient access to move around the hierachy of sessions,
66
windows and panes in tmux.
77

8-
this is done by libtmux's object abstraction of {}`target`\_s (the `-t`
9-
command) and the permanent internal ID's tmux gives to objects.
8+
This is done by libtmux's object abstraction of {term}`target`s (the `-t`
9+
argument) and the permanent internal ID's tmux gives to objects.
1010

11-
open two terminals:
11+
Open two terminals:
1212

13-
terminal one: start tmux in a seperate terminal:
13+
Terminal one: start tmux in a seperate terminal:
1414

15-
```
15+
```console
1616
$ tmux
1717
```
1818

19-
terminal two, `python` or `ptpython` if you have it:
19+
Terminal two, `python` or `ptpython` if you have it:
2020

21-
```
21+
```console
2222
$ python
2323
```
2424

25-
import tmux:
25+
Import `libtmux`:
2626

27-
```
28-
import tmux
27+
```python
28+
import libtmux
2929
```
3030

31-
attach default tmux {class}`libtmux.Server` to `t`:
31+
Attach default tmux {class}`~libtmux.Server` to `t`:
3232

33-
```
33+
```python
3434
>>> t = libtmux.Server();
3535
>>> t
3636
<libtmux.server.Server object at 0x10edd31d0>
3737
```
3838

39-
get first session {class}`Session` to {}`session`:
39+
Get first session {class}`~libtmux.Session` to `session`:
4040

41-
```
41+
```python
4242
>>> session = t.sessions[0]
4343
>>> session
4444
Session($0 libtmux)
4545
```
4646

47-
get a list of sessions:
47+
Get a list of sessions:
4848

49-
```
49+
```python
5050
>>> t.sessions
5151
[Session($0 libtmux), Session($1 tmuxp)]
5252
```
5353

54-
iterate through sessions in a server:
54+
Iterate through sessions in a server:
5555

56-
```
56+
```python
5757
>>> for sess in t.sessions:
5858
... print(sess)
5959

6060
Session($0 libtmux)
6161
Session($1 tmuxp)
6262
```
6363

64-
grab a {class}`Window` from a session:
64+
Grab a {class}`~libtmux.Window` from a session:
6565

66-
```
66+
```python
6767
>>> session.windows[0]
6868
Window(@1 1:libtmux, Session($0 libtmux))
6969
```
7070

71-
grab the currently focused window from session:
72-
73-
> > > > session.attached_window
74-
> > > > Window(@2 2:docs, Session($0 libtmux))grab the currently focused {class}`Pane` from session:
71+
Grab the currently focused window from session:
7572

73+
```python
74+
>>> session.attached_window
75+
>>> Window(@2 2:docs, Session($0 libtmux))grab the currently focused {class}`Pane` from session:
7676
```
77+
78+
```python
7779
>>> session.attached_pane
7880
Pane(%5 Window(@2 2:docs, Session($0 libtmux)))
7981
```
8082

81-
assign the attached pane to `p`:
83+
Assign the attached {class}`~libtmux.Pane` to `p`:
8284

83-
```
85+
```python
8486
>>> p = session.attached_pane
8587
```
8688

87-
access the window/server of a pane:
89+
Access the window/server of a pane:
8890

89-
```
91+
```python
9092
>>> p.window
9193
Window(@2 2:docs, Session($0 libtmux))
9294

0 commit comments

Comments
 (0)