1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
(quickstart)=
# Quickstart
## Installation
Ensure you have at least tmux **>= 1.8** and python **>= 3.7**.
```console
$ pip install --user tmuxp
```
You can upgrade to the latest release with:
```console
$ pip install --user --upgrade tmuxp
```
Then install {ref}`completion`.
If you are a Homebrew user you can install it with:
```console
$ brew install tmuxp
```
(developmental-releases)=
### Developmental releases
New versions of tmuxp are published to PyPI as alpha, beta, or release candidates.
In their versions you will see notification like `a1`, `b1`, and `rc1`, respectively.
`1.10.0b4` would mean the 4th beta release of `1.10.0` before general availability.
- [pip]\:
```console
$ pip install --user --upgrade --pre tmuxp
```
- [pipx]\:
```console
$ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force
```
Then use `tmuxp@next load [session]`.
via trunk (can break easily):
- [pip]\:
```console
$ pip install --user -e git+https://github.com/tmux-python/tmuxp.git#egg=tmuxp
```
- [pipx]\:
```console
$ pipx install --suffix=@master 'tmuxp @ git+https://github.com/tmux-python/tmuxp.git@master' --force
```
[pip]: https://pip.pypa.io/en/stable/
[pipx]: https://pypa.github.io/pipx/docs/
## Commands
:::{seealso}
{ref}`examples`, {ref}`commands`, {ref}`completion`.
:::
tmuxp launches workspaces / sessions from JSON and YAML files.
Workspace files can be stored in `$HOME/.tmuxp` or in project
directories as `.tmuxp.py`, `.tmuxp.json` or `.tmuxp.yaml`.
Every workspace file is required to have:
1. `session_name`
2. list of `windows`
3. list of `panes` for every window in `windows`
Create a file, `~/.tmuxp/example.yaml`:
```{literalinclude} ../examples/2-pane-vertical.yaml
:language: yaml
```
```console
$ tmuxp load example.yaml
```
This creates your tmuxp session.
Load multiple tmux sessions at once:
```console
$ tmuxp load example.yaml anothersession.yaml
```
tmuxp will offer to `switch-client` for you if you're already in a
session. You can also load a workspace and append the windows to
the current active session.
You can also have a custom tmuxp config directory by setting the
`TMUXP_CONFIGDIR` in your environment variables.
```console
$ TMUXP_CONFIGDIR=$HOME/.tmuxpmoo tmuxp load cpython
```
Or in your `~/.bashrc` / `~/.zshrc` you can set:
```console
export TMUXP_CONFIGDIR=$HOME/.yourconfigdir/tmuxp
```
You can also [Import][import] configs [teamocil] and [tmuxinator].
## Pythonics
:::{seealso}
{ref}`libtmux python API documentation <libtmux:api>` and {ref}`developing`.
:::
ORM - [Object Relational Mapper][object relational mapper]
AL - [Abstraction Layer][abstraction layer]
### python abstraction layer
| {ref}`tmuxp python api <libtmux:api>` | {term}`tmux(1)` equivalent |
| ------------------------------------- | -------------------------- |
| {meth}`libtmux.Server.new_session` | `$ tmux new-session` |
| {meth}`libtmux.Server.sessions` | `$ tmux list-sessions` |
| {meth}`libtmux.Session.windows` | `$ tmux list-windows` |
| {meth}`libtmux.Session.new_window` | `$ tmux new-window` |
| {meth}`libtmux.Window.panes` | `$ tmux list-panes` |
| {meth}`libtmux.Window.split` | `$ tmux split-window` |
| {meth}`libtmux.Pane.send_keys` | `$ tmux send-keys` |
[import]: http://tmuxp.git-pull.com/commands/#import
[tmuxinator]: https://github.com/aziz/tmuxinator
[teamocil]: https://github.com/remiprev/teamocil
[abstraction layer]: http://en.wikipedia.org/wiki/Abstraction_layer
[object relational mapper]: http://en.wikipedia.org/wiki/Object-relational_mapping
|