tmux-path-store 2026.10.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tmux_path_store-2026.10.5/LICENSE +21 -0
- tmux_path_store-2026.10.5/PKG-INFO +265 -0
- tmux_path_store-2026.10.5/README.md +253 -0
- tmux_path_store-2026.10.5/pyproject.toml +37 -0
- tmux_path_store-2026.10.5/pyproject.toml.orig +37 -0
- tmux_path_store-2026.10.5/tmux_path_store/__init__.py +641 -0
- tmux_path_store-2026.10.5/tmux_path_store/__main__.py +4 -0
- tmux_path_store-2026.10.5/tmux_path_store/shell_templates/csh.tmpl +1 -0
- tmux_path_store-2026.10.5/tmux_path_store/shell_templates/fish.tmpl +225 -0
- tmux_path_store-2026.10.5/tmux_path_store/shell_templates/nu.tmpl +82 -0
- tmux_path_store-2026.10.5/tmux_path_store/shell_templates/posix.tmpl +1 -0
- tmux_path_store-2026.10.5/tmux_path_store/shell_templates/pwsh.tmpl +80 -0
- tmux_path_store-2026.10.5/tmux_path_store/shell_templates/xonsh.tmpl +88 -0
- tmux_path_store-2026.10.5/tmux_path_store/shells.py +66 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Myles Prather
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tmux-path-store
|
|
3
|
+
Version: 2026.10.5
|
|
4
|
+
Summary: Directory and file bookmarks for each tmux window.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Project-URL: Homepage, https://github.com/smprather/tmux-path-store
|
|
9
|
+
Project-URL: Repository, https://github.com/smprather/tmux-path-store
|
|
10
|
+
Project-URL: Issues, https://github.com/smprather/tmux-path-store/issues
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
<div align="center">
|
|
14
|
+
|
|
15
|
+
# ⛯ tmux-path-store
|
|
16
|
+
|
|
17
|
+
**Your project's directories and files, one short command away.**
|
|
18
|
+
|
|
19
|
+
[](https://github.com/smprather/tmux-path-store/actions/workflows/ci.yml)
|
|
20
|
+
[](https://pypi.org/project/tmux-path-store/)
|
|
21
|
+
[](https://github.com/smprather/tmux-path-store/blob/main/pyproject.toml)
|
|
22
|
+
|
|
23
|
+
[Quick start](#quick-start) · [Shell setup](#shell-setup) · [Commands](#commands) · [Editors](#editors) · [Scripting](#storage-and-scripting) · [Development](#development)
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
Bookmark the directories and files you use for a project under its **tmux window
|
|
28
|
+
name**. Jump back with `cdh`, switch to a related directory with `cd1`, or open a
|
|
29
|
+
saved file with `f0`.
|
|
30
|
+
|
|
31
|
+
Built for engineering workflows where project files, reports, and shared
|
|
32
|
+
resources live across the filesystem.
|
|
33
|
+
|
|
34
|
+
- **10 directory and 10 file slots** per window name, numbered `0`–`9`.
|
|
35
|
+
- **Shell shortcuts** for navigating, editing, listing, swapping, and clearing bookmarks.
|
|
36
|
+
- **Persistent local storage**, backed by Python's standard library with no runtime Python dependencies.
|
|
37
|
+
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
Use Linux or macOS with [tmux](https://github.com/tmux/tmux/wiki) on your `PATH`,
|
|
41
|
+
[uv](https://docs.astral.sh/uv/), and Python **3.11 or later**.
|
|
42
|
+
|
|
43
|
+
Install from PyPI:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv tool install tmux-path-store
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
<details>
|
|
50
|
+
<summary><strong>Install from source or offline</strong></summary>
|
|
51
|
+
|
|
52
|
+
Install from a checkout:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git clone https://github.com/smprather/tmux-path-store.git
|
|
56
|
+
cd tmux-path-store
|
|
57
|
+
uv tool install .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use `uv tool install --offline .` once Python and the build requirements are
|
|
61
|
+
available locally.
|
|
62
|
+
|
|
63
|
+
</details>
|
|
64
|
+
|
|
65
|
+
Enable shortcuts in your current Bash session; see [shell setup](#shell-setup)
|
|
66
|
+
for other shells and permanent configuration:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
eval "$(tmux-path-store --bash)"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Inside tmux, give your window a project name and try these commands with your own
|
|
73
|
+
project paths:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
tmux rename-window board-rev-a
|
|
77
|
+
cd /work/board-rev-a
|
|
78
|
+
|
|
79
|
+
shd # Save this project's home directory in slot 0
|
|
80
|
+
sd1 ./reports # Save a related directory in slot 1
|
|
81
|
+
sf0 ./constraints.sdc # Save an existing file in file slot 0
|
|
82
|
+
|
|
83
|
+
cd1 # Jump to the reports directory
|
|
84
|
+
cdh # Return to the project's home directory
|
|
85
|
+
f0 # Open the saved file in your editor
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
> [!IMPORTANT]
|
|
89
|
+
> Bookmarks are keyed by the exact window name, shared across tmux sessions.
|
|
90
|
+
> Reusing a name reuses its bookmarks. Renaming a window leaves its bookmarks
|
|
91
|
+
> under the previous name, so use stable, distinct project names.
|
|
92
|
+
|
|
93
|
+
## Shell setup
|
|
94
|
+
|
|
95
|
+
Add the matching initialization command to your shell's startup file, then reload
|
|
96
|
+
it or open a new shell.
|
|
97
|
+
|
|
98
|
+
| Shell | Startup file | Initialization |
|
|
99
|
+
| ------------------- | -------------------------------------------------------------- | ---------------------------------- |
|
|
100
|
+
| Bash | `~/.bashrc` | `eval "$(tmux-path-store --bash)"` |
|
|
101
|
+
| Zsh | `~/.zshrc` | `eval "$(tmux-path-store --zsh)"` |
|
|
102
|
+
| sh, dash, ksh, mksh | `~/.profile` for login shells, or the file configured by `ENV` | `eval "$(tmux-path-store --sh)"` |
|
|
103
|
+
| csh, tcsh | `~/.cshrc` or `~/.tcshrc` | `` eval `tmux-path-store --csh` `` |
|
|
104
|
+
| Fish | `~/.config/fish/config.fish` | `tmux-path-store --fish \| source` |
|
|
105
|
+
|
|
106
|
+
`--dash`, `--ksh`, and `--mksh` select the same hooks as `--sh`;
|
|
107
|
+
`--tcsh` is an alias for `--csh`.
|
|
108
|
+
|
|
109
|
+
<details>
|
|
110
|
+
<summary><strong>Nushell</strong></summary>
|
|
111
|
+
|
|
112
|
+
Generate a hook file from Nushell:
|
|
113
|
+
|
|
114
|
+
```nu
|
|
115
|
+
mkdir $nu.default-config-dir
|
|
116
|
+
let hook = ($nu.default-config-dir | path join 'tmux-path-store.nu')
|
|
117
|
+
tmux-path-store --nu | save --force $hook
|
|
118
|
+
print $"source '($hook)'"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Add the printed `source` line to the configuration file at `$nu.config-path`.
|
|
122
|
+
Nushell needs this literal file path because it loads definitions while parsing.
|
|
123
|
+
Regenerate the hook file after upgrading. `--nushell` also works.
|
|
124
|
+
|
|
125
|
+
</details>
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
<summary><strong>PowerShell on Unix</strong></summary>
|
|
129
|
+
|
|
130
|
+
Add this line to your startup file at `$PROFILE`:
|
|
131
|
+
|
|
132
|
+
```powershell
|
|
133
|
+
tmux-path-store --pwsh | Out-String | Invoke-Expression
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`--powershell` also works. The tool requires tmux and Unix file locking, so native
|
|
137
|
+
Windows is not supported.
|
|
138
|
+
|
|
139
|
+
</details>
|
|
140
|
+
|
|
141
|
+
<details>
|
|
142
|
+
<summary><strong>Xonsh</strong></summary>
|
|
143
|
+
|
|
144
|
+
Add this line to `~/.xonshrc`:
|
|
145
|
+
|
|
146
|
+
```xonsh
|
|
147
|
+
exec($(tmux-path-store --xonsh))
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
> [!NOTE]
|
|
153
|
+
> PowerShell navigation rejects literal backslashes in Unix directory names
|
|
154
|
+
> because its filesystem provider treats them as separators
|
|
155
|
+
> ([upstream issue](https://github.com/PowerShell/PowerShell/issues/3666)).
|
|
156
|
+
> Nushell rejects control characters its native `cd` would remove, including
|
|
157
|
+
> carriage returns and escape characters; tabs and newlines are preserved.
|
|
158
|
+
|
|
159
|
+
## Commands
|
|
160
|
+
|
|
161
|
+
In the table below, replace `N` with a slot number from **0 to 9**.
|
|
162
|
+
Directory and file slots are independent.
|
|
163
|
+
|
|
164
|
+
| Shortcut | Action |
|
|
165
|
+
| ------------------------------------ | --------------------------------------------------------------------------------------------------- |
|
|
166
|
+
| `shd`, `sdh` | Save the current directory as the project home (`sd0`) |
|
|
167
|
+
| `cdh` | Jump to the project home (`cd0`) |
|
|
168
|
+
| `sdN [directory]` | Save a directory; defaults to the current directory |
|
|
169
|
+
| `sfN [file]` | Save an existing file; defaults to the most recently modified regular file in the current directory |
|
|
170
|
+
| `cdN` | Jump to directory slot N |
|
|
171
|
+
| `fN` | Open file slot N in your editor |
|
|
172
|
+
| `ef <index> [index ...]` | Open multiple file slots, for example `ef 0 2` |
|
|
173
|
+
| `ld [window ...]`, `lf [window ...]` | List directories or files for the current or named windows |
|
|
174
|
+
| `lda`, `lfa` | List directories or files for all saved windows |
|
|
175
|
+
| `lw` | List window names with saved bookmarks |
|
|
176
|
+
| `recent [count]` | List recently used directories and files, most recent first |
|
|
177
|
+
| `rdN`, `rfN` | Clear a directory or file slot |
|
|
178
|
+
| `swd <a> <b>`, `swf <a> <b>` | Swap two directory or file slots |
|
|
179
|
+
| `dw [window ...]` | Remove saved bookmarks for named windows; defaults to the current window |
|
|
180
|
+
| `tps` | Show shortcut help (`tmux-path-store --help`) |
|
|
181
|
+
|
|
182
|
+
Directory arguments are made absolute when saved. File arguments are stored as absolute paths;
|
|
183
|
+
files that do not exist yet are allowed. Each new window name needs a saved directory or file
|
|
184
|
+
before you can navigate or edit its slots.
|
|
185
|
+
|
|
186
|
+
## Editors
|
|
187
|
+
|
|
188
|
+
File shortcuts use `EDITOR`, falling back to `vi`. For example, in Bash or Zsh:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
export EDITOR='code --wait'
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Arguments follow POSIX quoting rules in every shell. Quote executable paths
|
|
195
|
+
containing spaces inside the value, for example
|
|
196
|
+
`EDITOR='"/opt/My Editor/bin/editor" --wait'`. Shell operators and variable
|
|
197
|
+
references in the value are not evaluated.
|
|
198
|
+
|
|
199
|
+
`ef` warns about empty slots and opens the defined ones; it fails if none are
|
|
200
|
+
defined. Missing files are opened anyway after a warning, so an editor can
|
|
201
|
+
create them. Editor exit codes are preserved. In PowerShell, inspect
|
|
202
|
+
`$LASTEXITCODE`.
|
|
203
|
+
|
|
204
|
+
## Storage and scripting
|
|
205
|
+
|
|
206
|
+
Bookmarks persist across tmux restarts in
|
|
207
|
+
`${XDG_STATE_HOME:-~/.local/state}/tmux_path_store/db.json`. Writes are atomic,
|
|
208
|
+
coordinated with file locks, and use file permissions `0600`. The file is a
|
|
209
|
+
versioned object; unset slots are simply absent, and stored slots record when
|
|
210
|
+
they were saved and last used:
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{"version": 2, "windows": {"board-rev-a": {"dirs": {"0": {"path": "/work/board-rev-a", "saved_at": 1790000000000000000}}, "files": {}}}}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Older list and version-1 formats are migrated on the next write. `recent` ranks
|
|
217
|
+
the current window's entries by `last_used`, then `saved_at`.
|
|
218
|
+
|
|
219
|
+
The CLI also works without the shortcuts:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
tmux-path-store set-dir 0 /work/board-rev-a
|
|
223
|
+
tmux-path-store set-file 0 /work/board-rev-a/constraints.sdc
|
|
224
|
+
tmux-path-store get-dir --json 0
|
|
225
|
+
tmux-path-store get-file --null 0
|
|
226
|
+
tmux-path-store open-files 0
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
`get-dir` and `get-file` return newline-terminated paths by default; use `--json`
|
|
230
|
+
for a JSON string or `--null` for NUL-terminated output. Check the exit status
|
|
231
|
+
before consuming output; diagnostics go to stderr.
|
|
232
|
+
|
|
233
|
+
Set `TMUX_WINDOW` to select a saved window explicitly in scripts:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
TMUX_WINDOW=board-rev-a tmux-path-store get-dir 0
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Otherwise, `TMUX_PANE` identifies the invoking pane's window when available.
|
|
240
|
+
Commands that only read saved data (`lw`, `ld`/`lf` with explicit windows) work
|
|
241
|
+
without a reachable tmux server. Resolving the active window outside tmux uses
|
|
242
|
+
the server's most recently used client, so scripts should set `TMUX_WINDOW`.
|
|
243
|
+
`open-files` launches the editor directly; data commands print data, not shell
|
|
244
|
+
code. csh/tcsh navigation is the exception: `csh-cd` returns the path of a
|
|
245
|
+
private, self-deleting source file.
|
|
246
|
+
|
|
247
|
+
## Development
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
uv sync --locked
|
|
251
|
+
uv run python -m unittest discover -s tests -p 'test_*.py'
|
|
252
|
+
uv run ruff check tmux_path_store tests
|
|
253
|
+
uv run ty check tmux_path_store tests
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Local integration tests exercise installed shells; CI requires all 12 supported
|
|
257
|
+
shell names. tmux tests use private sockets and clean up only their own sessions.
|
|
258
|
+
CLI and storage logic live in `tmux_path_store/__init__.py`;
|
|
259
|
+
shell hooks live in `tmux_path_store/shell_templates/` and are loaded by
|
|
260
|
+
`tmux_path_store/shells.py`.
|
|
261
|
+
|
|
262
|
+
Versions and release tags use CalVer `YYYY.M.N`, with no `v` prefix or zero
|
|
263
|
+
padding. `M` is the month and `N` starts at 1 each month; for example,
|
|
264
|
+
`2026.10.5`, then `2026.11.1` at the next month's first release.
|
|
265
|
+
Run `tmux-path-store --version` to inspect the installed version.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ⛯ tmux-path-store
|
|
4
|
+
|
|
5
|
+
**Your project's directories and files, one short command away.**
|
|
6
|
+
|
|
7
|
+
[](https://github.com/smprather/tmux-path-store/actions/workflows/ci.yml)
|
|
8
|
+
[](https://pypi.org/project/tmux-path-store/)
|
|
9
|
+
[](https://github.com/smprather/tmux-path-store/blob/main/pyproject.toml)
|
|
10
|
+
|
|
11
|
+
[Quick start](#quick-start) · [Shell setup](#shell-setup) · [Commands](#commands) · [Editors](#editors) · [Scripting](#storage-and-scripting) · [Development](#development)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
Bookmark the directories and files you use for a project under its **tmux window
|
|
16
|
+
name**. Jump back with `cdh`, switch to a related directory with `cd1`, or open a
|
|
17
|
+
saved file with `f0`.
|
|
18
|
+
|
|
19
|
+
Built for engineering workflows where project files, reports, and shared
|
|
20
|
+
resources live across the filesystem.
|
|
21
|
+
|
|
22
|
+
- **10 directory and 10 file slots** per window name, numbered `0`–`9`.
|
|
23
|
+
- **Shell shortcuts** for navigating, editing, listing, swapping, and clearing bookmarks.
|
|
24
|
+
- **Persistent local storage**, backed by Python's standard library with no runtime Python dependencies.
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
Use Linux or macOS with [tmux](https://github.com/tmux/tmux/wiki) on your `PATH`,
|
|
29
|
+
[uv](https://docs.astral.sh/uv/), and Python **3.11 or later**.
|
|
30
|
+
|
|
31
|
+
Install from PyPI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv tool install tmux-path-store
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<details>
|
|
38
|
+
<summary><strong>Install from source or offline</strong></summary>
|
|
39
|
+
|
|
40
|
+
Install from a checkout:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/smprather/tmux-path-store.git
|
|
44
|
+
cd tmux-path-store
|
|
45
|
+
uv tool install .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Use `uv tool install --offline .` once Python and the build requirements are
|
|
49
|
+
available locally.
|
|
50
|
+
|
|
51
|
+
</details>
|
|
52
|
+
|
|
53
|
+
Enable shortcuts in your current Bash session; see [shell setup](#shell-setup)
|
|
54
|
+
for other shells and permanent configuration:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
eval "$(tmux-path-store --bash)"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Inside tmux, give your window a project name and try these commands with your own
|
|
61
|
+
project paths:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
tmux rename-window board-rev-a
|
|
65
|
+
cd /work/board-rev-a
|
|
66
|
+
|
|
67
|
+
shd # Save this project's home directory in slot 0
|
|
68
|
+
sd1 ./reports # Save a related directory in slot 1
|
|
69
|
+
sf0 ./constraints.sdc # Save an existing file in file slot 0
|
|
70
|
+
|
|
71
|
+
cd1 # Jump to the reports directory
|
|
72
|
+
cdh # Return to the project's home directory
|
|
73
|
+
f0 # Open the saved file in your editor
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> [!IMPORTANT]
|
|
77
|
+
> Bookmarks are keyed by the exact window name, shared across tmux sessions.
|
|
78
|
+
> Reusing a name reuses its bookmarks. Renaming a window leaves its bookmarks
|
|
79
|
+
> under the previous name, so use stable, distinct project names.
|
|
80
|
+
|
|
81
|
+
## Shell setup
|
|
82
|
+
|
|
83
|
+
Add the matching initialization command to your shell's startup file, then reload
|
|
84
|
+
it or open a new shell.
|
|
85
|
+
|
|
86
|
+
| Shell | Startup file | Initialization |
|
|
87
|
+
| ------------------- | -------------------------------------------------------------- | ---------------------------------- |
|
|
88
|
+
| Bash | `~/.bashrc` | `eval "$(tmux-path-store --bash)"` |
|
|
89
|
+
| Zsh | `~/.zshrc` | `eval "$(tmux-path-store --zsh)"` |
|
|
90
|
+
| sh, dash, ksh, mksh | `~/.profile` for login shells, or the file configured by `ENV` | `eval "$(tmux-path-store --sh)"` |
|
|
91
|
+
| csh, tcsh | `~/.cshrc` or `~/.tcshrc` | `` eval `tmux-path-store --csh` `` |
|
|
92
|
+
| Fish | `~/.config/fish/config.fish` | `tmux-path-store --fish \| source` |
|
|
93
|
+
|
|
94
|
+
`--dash`, `--ksh`, and `--mksh` select the same hooks as `--sh`;
|
|
95
|
+
`--tcsh` is an alias for `--csh`.
|
|
96
|
+
|
|
97
|
+
<details>
|
|
98
|
+
<summary><strong>Nushell</strong></summary>
|
|
99
|
+
|
|
100
|
+
Generate a hook file from Nushell:
|
|
101
|
+
|
|
102
|
+
```nu
|
|
103
|
+
mkdir $nu.default-config-dir
|
|
104
|
+
let hook = ($nu.default-config-dir | path join 'tmux-path-store.nu')
|
|
105
|
+
tmux-path-store --nu | save --force $hook
|
|
106
|
+
print $"source '($hook)'"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Add the printed `source` line to the configuration file at `$nu.config-path`.
|
|
110
|
+
Nushell needs this literal file path because it loads definitions while parsing.
|
|
111
|
+
Regenerate the hook file after upgrading. `--nushell` also works.
|
|
112
|
+
|
|
113
|
+
</details>
|
|
114
|
+
|
|
115
|
+
<details>
|
|
116
|
+
<summary><strong>PowerShell on Unix</strong></summary>
|
|
117
|
+
|
|
118
|
+
Add this line to your startup file at `$PROFILE`:
|
|
119
|
+
|
|
120
|
+
```powershell
|
|
121
|
+
tmux-path-store --pwsh | Out-String | Invoke-Expression
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`--powershell` also works. The tool requires tmux and Unix file locking, so native
|
|
125
|
+
Windows is not supported.
|
|
126
|
+
|
|
127
|
+
</details>
|
|
128
|
+
|
|
129
|
+
<details>
|
|
130
|
+
<summary><strong>Xonsh</strong></summary>
|
|
131
|
+
|
|
132
|
+
Add this line to `~/.xonshrc`:
|
|
133
|
+
|
|
134
|
+
```xonsh
|
|
135
|
+
exec($(tmux-path-store --xonsh))
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
</details>
|
|
139
|
+
|
|
140
|
+
> [!NOTE]
|
|
141
|
+
> PowerShell navigation rejects literal backslashes in Unix directory names
|
|
142
|
+
> because its filesystem provider treats them as separators
|
|
143
|
+
> ([upstream issue](https://github.com/PowerShell/PowerShell/issues/3666)).
|
|
144
|
+
> Nushell rejects control characters its native `cd` would remove, including
|
|
145
|
+
> carriage returns and escape characters; tabs and newlines are preserved.
|
|
146
|
+
|
|
147
|
+
## Commands
|
|
148
|
+
|
|
149
|
+
In the table below, replace `N` with a slot number from **0 to 9**.
|
|
150
|
+
Directory and file slots are independent.
|
|
151
|
+
|
|
152
|
+
| Shortcut | Action |
|
|
153
|
+
| ------------------------------------ | --------------------------------------------------------------------------------------------------- |
|
|
154
|
+
| `shd`, `sdh` | Save the current directory as the project home (`sd0`) |
|
|
155
|
+
| `cdh` | Jump to the project home (`cd0`) |
|
|
156
|
+
| `sdN [directory]` | Save a directory; defaults to the current directory |
|
|
157
|
+
| `sfN [file]` | Save an existing file; defaults to the most recently modified regular file in the current directory |
|
|
158
|
+
| `cdN` | Jump to directory slot N |
|
|
159
|
+
| `fN` | Open file slot N in your editor |
|
|
160
|
+
| `ef <index> [index ...]` | Open multiple file slots, for example `ef 0 2` |
|
|
161
|
+
| `ld [window ...]`, `lf [window ...]` | List directories or files for the current or named windows |
|
|
162
|
+
| `lda`, `lfa` | List directories or files for all saved windows |
|
|
163
|
+
| `lw` | List window names with saved bookmarks |
|
|
164
|
+
| `recent [count]` | List recently used directories and files, most recent first |
|
|
165
|
+
| `rdN`, `rfN` | Clear a directory or file slot |
|
|
166
|
+
| `swd <a> <b>`, `swf <a> <b>` | Swap two directory or file slots |
|
|
167
|
+
| `dw [window ...]` | Remove saved bookmarks for named windows; defaults to the current window |
|
|
168
|
+
| `tps` | Show shortcut help (`tmux-path-store --help`) |
|
|
169
|
+
|
|
170
|
+
Directory arguments are made absolute when saved. File arguments are stored as absolute paths;
|
|
171
|
+
files that do not exist yet are allowed. Each new window name needs a saved directory or file
|
|
172
|
+
before you can navigate or edit its slots.
|
|
173
|
+
|
|
174
|
+
## Editors
|
|
175
|
+
|
|
176
|
+
File shortcuts use `EDITOR`, falling back to `vi`. For example, in Bash or Zsh:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
export EDITOR='code --wait'
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Arguments follow POSIX quoting rules in every shell. Quote executable paths
|
|
183
|
+
containing spaces inside the value, for example
|
|
184
|
+
`EDITOR='"/opt/My Editor/bin/editor" --wait'`. Shell operators and variable
|
|
185
|
+
references in the value are not evaluated.
|
|
186
|
+
|
|
187
|
+
`ef` warns about empty slots and opens the defined ones; it fails if none are
|
|
188
|
+
defined. Missing files are opened anyway after a warning, so an editor can
|
|
189
|
+
create them. Editor exit codes are preserved. In PowerShell, inspect
|
|
190
|
+
`$LASTEXITCODE`.
|
|
191
|
+
|
|
192
|
+
## Storage and scripting
|
|
193
|
+
|
|
194
|
+
Bookmarks persist across tmux restarts in
|
|
195
|
+
`${XDG_STATE_HOME:-~/.local/state}/tmux_path_store/db.json`. Writes are atomic,
|
|
196
|
+
coordinated with file locks, and use file permissions `0600`. The file is a
|
|
197
|
+
versioned object; unset slots are simply absent, and stored slots record when
|
|
198
|
+
they were saved and last used:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{"version": 2, "windows": {"board-rev-a": {"dirs": {"0": {"path": "/work/board-rev-a", "saved_at": 1790000000000000000}}, "files": {}}}}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Older list and version-1 formats are migrated on the next write. `recent` ranks
|
|
205
|
+
the current window's entries by `last_used`, then `saved_at`.
|
|
206
|
+
|
|
207
|
+
The CLI also works without the shortcuts:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
tmux-path-store set-dir 0 /work/board-rev-a
|
|
211
|
+
tmux-path-store set-file 0 /work/board-rev-a/constraints.sdc
|
|
212
|
+
tmux-path-store get-dir --json 0
|
|
213
|
+
tmux-path-store get-file --null 0
|
|
214
|
+
tmux-path-store open-files 0
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`get-dir` and `get-file` return newline-terminated paths by default; use `--json`
|
|
218
|
+
for a JSON string or `--null` for NUL-terminated output. Check the exit status
|
|
219
|
+
before consuming output; diagnostics go to stderr.
|
|
220
|
+
|
|
221
|
+
Set `TMUX_WINDOW` to select a saved window explicitly in scripts:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
TMUX_WINDOW=board-rev-a tmux-path-store get-dir 0
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Otherwise, `TMUX_PANE` identifies the invoking pane's window when available.
|
|
228
|
+
Commands that only read saved data (`lw`, `ld`/`lf` with explicit windows) work
|
|
229
|
+
without a reachable tmux server. Resolving the active window outside tmux uses
|
|
230
|
+
the server's most recently used client, so scripts should set `TMUX_WINDOW`.
|
|
231
|
+
`open-files` launches the editor directly; data commands print data, not shell
|
|
232
|
+
code. csh/tcsh navigation is the exception: `csh-cd` returns the path of a
|
|
233
|
+
private, self-deleting source file.
|
|
234
|
+
|
|
235
|
+
## Development
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
uv sync --locked
|
|
239
|
+
uv run python -m unittest discover -s tests -p 'test_*.py'
|
|
240
|
+
uv run ruff check tmux_path_store tests
|
|
241
|
+
uv run ty check tmux_path_store tests
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Local integration tests exercise installed shells; CI requires all 12 supported
|
|
245
|
+
shell names. tmux tests use private sockets and clean up only their own sessions.
|
|
246
|
+
CLI and storage logic live in `tmux_path_store/__init__.py`;
|
|
247
|
+
shell hooks live in `tmux_path_store/shell_templates/` and are loaded by
|
|
248
|
+
`tmux_path_store/shells.py`.
|
|
249
|
+
|
|
250
|
+
Versions and release tags use CalVer `YYYY.M.N`, with no `v` prefix or zero
|
|
251
|
+
padding. `M` is the month and `N` starts at 1 each month; for example,
|
|
252
|
+
`2026.10.5`, then `2026.11.1` at the next month's first release.
|
|
253
|
+
Run `tmux-path-store --version` to inspect the installed version.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tmux-path-store"
|
|
3
|
+
version = "2026.10.5"
|
|
4
|
+
description = "Directory and file bookmarks for each tmux window."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = []
|
|
10
|
+
|
|
11
|
+
[project.urls]
|
|
12
|
+
Homepage = "https://github.com/smprather/tmux-path-store"
|
|
13
|
+
Repository = "https://github.com/smprather/tmux-path-store"
|
|
14
|
+
Issues = "https://github.com/smprather/tmux-path-store/issues"
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
tmux-path-store = "tmux_path_store:cli"
|
|
18
|
+
|
|
19
|
+
[tool.uv]
|
|
20
|
+
package = true
|
|
21
|
+
|
|
22
|
+
[tool.uv.build-backend]
|
|
23
|
+
module-root = ""
|
|
24
|
+
|
|
25
|
+
[tool.ruff]
|
|
26
|
+
line-length = 110
|
|
27
|
+
target-version = "py311"
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["uv_build>=0.11.13,<0.13.0"]
|
|
31
|
+
build-backend = "uv_build"
|
|
32
|
+
|
|
33
|
+
[dependency-groups]
|
|
34
|
+
dev = [
|
|
35
|
+
"ruff>=0.15.9",
|
|
36
|
+
"ty>=0.0.29",
|
|
37
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tmux-path-store"
|
|
3
|
+
version = "2026.10.5"
|
|
4
|
+
description = "Directory and file bookmarks for each tmux window."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = []
|
|
10
|
+
|
|
11
|
+
[project.urls]
|
|
12
|
+
Homepage = "https://github.com/smprather/tmux-path-store"
|
|
13
|
+
Repository = "https://github.com/smprather/tmux-path-store"
|
|
14
|
+
Issues = "https://github.com/smprather/tmux-path-store/issues"
|
|
15
|
+
|
|
16
|
+
[tool.uv]
|
|
17
|
+
package = true
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
tmux-path-store = "tmux_path_store:cli"
|
|
21
|
+
|
|
22
|
+
[tool.uv.build-backend]
|
|
23
|
+
module-root = ""
|
|
24
|
+
|
|
25
|
+
[build-system]
|
|
26
|
+
requires = ["uv_build>=0.11.13,<0.13.0"]
|
|
27
|
+
build-backend = "uv_build"
|
|
28
|
+
|
|
29
|
+
[tool.ruff]
|
|
30
|
+
line-length = 110
|
|
31
|
+
target-version = "py311"
|
|
32
|
+
|
|
33
|
+
[dependency-groups]
|
|
34
|
+
dev = [
|
|
35
|
+
"ruff>=0.15.9",
|
|
36
|
+
"ty>=0.0.29",
|
|
37
|
+
]
|