Skip to content

Commit 25fc5ca

Browse files
committed
some highlighting for properties documentation
1 parent 9091889 commit 25fc5ca

File tree

1 file changed

+50
-16
lines changed

1 file changed

+50
-16
lines changed

doc/properties.rst

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,33 @@ terminal one: start tmux in a seperate terminal::
1717

1818
.. NOTE::
1919

20-
Make sure you have :ref:`libtmux installed <installation>`::
20+
Make sure you have :ref:`libtmux installed <installation>`:
21+
22+
.. code-block:: sh
2123
2224
pip install libtmux
2325
2426
To upgrade:
2527

28+
.. code-block:: sh
29+
2630
pip install -U libtmux
2731
28-
terminal two, ``python`` or ``ptpython`` if you have it::
32+
terminal two, ``python`` or ``ptpython`` if you have it:
33+
34+
.. code-block:: sh
2935
3036
$ python
3137
32-
import tmux::
38+
import tmux:
39+
40+
.. code-block:: python
3341
3442
import tmux
3543
36-
attach default tmux :class:`libtmux.Server` to ``t``::
44+
attach default tmux :class:`libtmux.Server` to ``t``:
45+
46+
.. code-block:: python
3747
3848
>>> t = libtmux.Server();
3949
>>> t
@@ -42,14 +52,18 @@ attach default tmux :class:`libtmux.Server` to ``t``::
4252
Session
4353
-------
4454

45-
get our ``session`` object::
55+
get our ``session`` object:
56+
57+
.. code-block:: python
4658
4759
>>> session = t.sessions[0]
4860
4961
>>> session
5062
Session($0 libtmux)
5163
52-
quick access to basic attributes::
64+
quick access to basic attributes:
65+
66+
.. code-block:: python
5367
5468
>>> session.name
5569
u'libtmux'
@@ -63,7 +77,9 @@ quick access to basic attributes::
6377
>>> session.height
6478
u'114'
6579
66-
to see all attributes for a session::
80+
to see all attributes for a session:
81+
82+
.. code-block:: python
6783
6884
>>> session._info.keys()
6985
[u'session_height', u'session_windows', u'session_width', u'session_id', u'session_created', u'session_attached', u'session_grouped', u'session_name']
@@ -73,22 +89,28 @@ to see all attributes for a session::
7389
7490
7591
some may conflict with python API, to access them, you can use ``.get()``, to get the count
76-
of sessions in a window::
92+
of sessions in a window:
93+
94+
.. code-block:: python
7795
7896
>>> session.get('session_windows')
7997
u'3'
8098
8199
Windows
82100
-------
83101

84-
The same concepts apply for window::
102+
The same concepts apply for window:
103+
104+
.. code-block:: python
85105
86106
>>> window = session.attached_window
87107
88108
>>> window
89109
Window(@2 2:docs, Session($0 libtmux))
90110
91-
basics::
111+
basics:
112+
113+
.. code-block:: python
92114
93115
>>> window.name
94116
u'docs'
@@ -102,30 +124,38 @@ basics::
102124
>>> window.width
103125
u'213'
104126
105-
everything available::
127+
everything available:
128+
129+
.. code-block:: python
106130
107131
>>> window._info
108132
{u'window_panes': u'4', u'window_active': u'1', u'window_height': u'114', u'window_activity_flag': u'0', u'window_width': u'213', u'session_id': u'$0', u'window_id': u'@2', u'window_layout': u'dad5,213x114,0,0[213x60,0,0,4,213x53,0,61{70x53,0,61,5,70x53,71,61,6,71x53,142,61,7}]', u'window_silence_flag': u'0', u'window_index': u'2', u'window_bell_flag': u'0', u'session_name': u'libtmux', u'window_flags': u'*', u'window_name': u'docs'}
109133
110134
>>> window.keys()
111135
[u'window_panes', u'window_active', u'window_height', u'window_activity_flag', u'window_width', u'session_id', u'window_id', u'window_layout', u'window_silence_flag', u'window_index', u'window_bell_flag', u'session_name', u'window_flags', u'window_name']
112136
113-
use ``get()`` for details not accessible via properties::
137+
use ``get()`` for details not accessible via properties:
138+
139+
.. code-block:: python
114140
115141
>>> pane.get('window_panes')
116142
u'4'
117143
118144
Panes
119145
-----
120146

121-
get our pane::
147+
get our pane:
148+
149+
.. code-block:: python
122150
123151
>>> pane = window.attached_pane
124152
125153
>>> pane
126154
Pane(%5 Window(@2 2:docs, Session($0 libtmux)))
127155
128-
basics::
156+
basics:
157+
158+
.. code-block:: python
129159
130160
>>> pane.current_command
131161
u'python'
@@ -139,15 +169,19 @@ basics::
139169
>>> pane.index
140170
u'1'
141171
142-
everything::
172+
everything:
173+
174+
.. code-block:: python
143175
144176
>>> pane._info
145177
{u'alternate_saved_x': u'0', u'alternate_saved_y': u'0', u'cursor_y': u'47', u'cursor_x': u'0', u'pane_in_mode': u'0', u'insert_flag': u'0', u'keypad_flag': u'0', u'cursor_flag': u'1', u'pane_current_command': u'python', u'window_index': u'2', u'history_size': u'216', u'scroll_region_lower': u'52', u'keypad_cursor_flag': u'0', u'history_bytes': u'38778', u'pane_active': u'1', u'pane_dead': u'0', u'pane_synchronized': u'0', u'window_id': u'@2', u'pane_index': u'1', u'pane_width': u'70', u'mouse_any_flag': u'0', u'mouse_button_flag': u'0', u'window_name': u'docs', u'pane_current_path': u'/Users/me/work/python/libtmux/doc', u'pane_tty': u'/dev/ttys007', u'pane_title': u'Python REPL (ptpython)', u'session_id': u'$0', u'alternate_on': u'0', u'mouse_standard_flag': u'0', u'wrap_flag': u'1', u'history_limit': u'2000', u'pane_pid': u'37172', u'pane_height': u'53', u'session_name': u'libtmux', u'scroll_region_upper': u'0', u'pane_id': u'%5'}
146178
147179
>>> pane._info.keys()
148180
[u'alternate_saved_x', u'alternate_saved_y', u'cursor_y', u'cursor_x', u'pane_in_mode', u'insert_flag', u'keypad_flag', u'cursor_flag', u'pane_current_command', u'window_index', u'history_size', u'scroll_region_lower', u'keypad_cursor_flag', u'history_bytes', u'pane_active', u'pane_dead', u'pane_synchronized', u'window_id', u'pane_index', u'pane_width', u'mouse_any_flag', u'mouse_button_flag', u'window_name', u'pane_current_path', u'pane_tty', u'pane_title', u'session_id', u'alternate_on', u'mouse_standard_flag', u'wrap_flag', u'history_limit', u'pane_pid', u'pane_height', u'session_name', u'scroll_region_upper', u'pane_id']
149181
150-
use ``get()`` for details keys::
182+
use ``get()`` for details keys:
183+
184+
.. code-block:: python
151185
152186
>>> pane.get('pane_width')
153187
u'70'

0 commit comments

Comments
 (0)