Skip to content

Commit 4f7d5ac

Browse files
committed
docs(configuration): More info on files
1 parent e2658b6 commit 4f7d5ac

File tree

1 file changed

+79
-18
lines changed

1 file changed

+79
-18
lines changed

docs/configuration/index.md

Lines changed: 79 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
# Configuration
66

7-
The configuration syntax is declarative and based on tmux's Session, Window and
8-
Panes hierarchy. Both JSON and YAML is accepted.
7+
tmuxp loads your terminal workspace into tmux using config files.
8+
9+
The configuration file can be JSON or YAML. It's declarative style resembles tmux's object hierarchy: session, window and wanes.
910

1011
## Launching your session
1112

12-
When you have `tmuxp` installed in your environment alongside tmux, you can load
13-
a workspace with:
13+
Once you have `tmuxp` installed alongside tmux, you can load a workspace with:
1414

1515
```console
1616
$ tmuxp load ./path/to/file
@@ -24,7 +24,7 @@ tmuxp will offers to assist when:
2424
- _When inside a tmux client_, `tmuxp` will let you create a new session and switch to it, or append the windows to your existing
2525
session.
2626

27-
## What's in a config?
27+
## What's in a config file?
2828

2929
1. A session name
3030
2. A list of _windows_
@@ -69,33 +69,94 @@ Breaking down the basic configuration into sections:
6969
7070
```yaml
7171
windows:
72-
- window_name: Window 1
73-
panes: ...
74-
# window settings
75-
- window_name: Window 2
76-
panes: ...
77-
# window settings
72+
- window_name: Window 1
73+
panes: ...
74+
# window settings
75+
- window_name: Window 2
76+
panes: ...
77+
# window settings
7878
```
79+
7980
3. A list of _panes_ for each window
8081

8182
```yaml
8283
windows:
8384
panes:
84-
- # pane settings
85-
- # pane settings
85+
- # pane settings
86+
- # pane settings
8687
```
88+
8789
4. A list of _commands_ for each pane
8890
8991
```yaml
9092
windows:
9193
panes:
92-
- shell_commands:
93-
- cmd: echo "pane 1 - cmd 1"
94-
# command options
95-
- cmd: echo "pane 1 - cmd 2"
96-
# command options
94+
- shell_commands:
95+
- cmd: echo "pane 1 - cmd 1"
96+
# command options
97+
- cmd: echo "pane 1 - cmd 2"
98+
# command options
9799
```
98100

101+
## Where do I store config files?
102+
103+
### Direct
104+
105+
You can create a configuration and load it from anywhere in your file system.
106+
107+
```console
108+
$ tmuxp load [config_file]
109+
```
110+
111+
````{tab} Relative
112+
```console
113+
$ tmuxp load ./favorites.yaml
114+
```
115+
````
116+
117+
````{tab} Absolute
118+
```console
119+
$ tmuxp load /opt/myapp/favorites.yaml
120+
```
121+
````
122+
123+
### User-based configurations
124+
125+
tmuxp uses the [XDG Base Directory] specification.
126+
127+
Often on POSIX machines, you will store them in `~/.config/tmuxp`.
128+
129+
Assume you store `apple.yaml` in `$XDG_CONFIG_HOME/tmuxp/apple.yaml`, you can
130+
then use:
131+
132+
```console
133+
$ tmuxp load apple
134+
```
135+
136+
[xdg base directory]: https://specifications.freedesktop.org/basedir-spec/latest/
137+
138+
### Project-specific
139+
140+
You can store a configuration in your project's root directory as `.tmuxp.yaml` or `.tmuxp.json`, then:
141+
142+
Assume `.tmuxp.yaml` inside `/opt/myapp`
143+
144+
```console
145+
$ tmuxp load [config_path]
146+
```
147+
148+
````{tab} In project root
149+
```console
150+
$ tmuxp load ./
151+
```
152+
````
153+
154+
````{tab} Absolute
155+
```console
156+
$ tmuxp load /opt/myapp
157+
```
158+
````
159+
99160
## Reference and usage
100161

101162
```{toctree}

0 commit comments

Comments
 (0)