@foxfirecodes/pi-stash 0.1.0 → 0.2.0
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.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -15
- package/extensions/pi-stash.js +2 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -12,21 +12,7 @@ This is useful when you have a longer prompt drafted but want to quickly ask or
|
|
|
12
12
|
|
|
13
13
|
## Keybinding
|
|
14
14
|
|
|
15
|
-
The default keybinding is `ctrl+s
|
|
16
|
-
|
|
17
|
-
You can customize it with the `--pi-stash-key` extension flag:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
pi --pi-stash-key ctrl+x
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Or with an environment variable:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
PI_STASH_KEY=ctrl+x pi
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
The key string uses pi's key format, for example `ctrl+x`, `ctrl+shift+s`, or `alt+s`. If your terminal swallows `ctrl+s` for flow control, choose a different key or disable XON/XOFF flow control in your shell.
|
|
15
|
+
The default keybinding is `ctrl+q`. I will consider adding the ability to configure it later, but for now it's hardcoded.
|
|
30
16
|
|
|
31
17
|
## Install
|
|
32
18
|
|
package/extensions/pi-stash.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
const DEFAULT_STASH_KEY = "ctrl+
|
|
2
|
-
const KEYBIND_FLAG = "pi-stash-key";
|
|
1
|
+
const DEFAULT_STASH_KEY = "ctrl+q";
|
|
3
2
|
const STATUS_ID = "pi-stash";
|
|
4
3
|
|
|
5
|
-
function configuredKeybind(pi) {
|
|
6
|
-
const flagValue = pi.getFlag(KEYBIND_FLAG);
|
|
7
|
-
return typeof flagValue === "string" ? flagValue : DEFAULT_STASH_KEY;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
4
|
function formatStatus(ctx, keybind) {
|
|
11
5
|
const text = `stash:${keybind}`;
|
|
12
6
|
return ctx.ui.theme?.fg ? ctx.ui.theme.fg("accent", text) : text;
|
|
@@ -64,14 +58,8 @@ export default function piStash(pi) {
|
|
|
64
58
|
ctx.ui.notify("No prompt to stash.", "info");
|
|
65
59
|
}
|
|
66
60
|
|
|
67
|
-
pi.registerFlag(KEYBIND_FLAG, {
|
|
68
|
-
description: `Keybinding for pi-stash prompt stash/restore (default: ${DEFAULT_STASH_KEY})`,
|
|
69
|
-
type: "string",
|
|
70
|
-
});
|
|
71
|
-
|
|
72
61
|
pi.on("session_start", async (_event, ctx) => {
|
|
73
|
-
|
|
74
|
-
pi.registerShortcut(keybind, {
|
|
62
|
+
pi.registerShortcut(DEFAULT_STASH_KEY, {
|
|
75
63
|
description: "Stash or restore the current prompt",
|
|
76
64
|
handler: stashOrRestorePrompt,
|
|
77
65
|
});
|