@webdavis/omp-clearscreen 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/README.md +35 -26
- package/package.json +8 -9
- package/src/clearscreen.ts +1 -1
- package/src/omp-settings.ts +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# omp-clearscreen
|
|
2
2
|
|
|
3
|
-
Press `Ctrl
|
|
3
|
+
Press `Ctrl+\`, or run the `/clearscreen` command in [omp](https://github.com/can1357/oh-my-pi) to clear the screen.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`/clearscreen` works just like `Ctrl+L` does in a Bash terminal. The messages move up into the terminal's scrollback. If
|
|
6
|
+
you need to see what was on the screen before, just scroll up and it's still there.
|
|
7
|
+
|
|
8
|
+
> The session and the model's context are kept. This is not related to omp's own `/clear`, which drops the context from
|
|
9
|
+
> your session.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- The extension requires omp 19.2+
|
|
14
|
+
- The keyboard shortcut clears the screen only while the prompt has the keyboard
|
|
6
15
|
|
|
7
16
|
## Install
|
|
8
17
|
|
|
@@ -12,41 +21,41 @@ omp plugin install npm:@webdavis/omp-clearscreen
|
|
|
12
21
|
|
|
13
22
|
Restart omp after the install.
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```yaml
|
|
18
|
-
app.live.toggle: "alt+'"
|
|
19
|
-
```
|
|
24
|
+
## Usage
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
Press `Ctrl+\`, or run `/clearscreen`.
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
> [!NOTE]
|
|
29
|
+
> If you run clearscreen while a response is running, the extension shows a warning and clears nothing.
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
## Configuring a different key binding
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`Ctrl+L` is the default. To clear the screen with another key, set it and restart omp:
|
|
33
|
+
`Ctrl+\` is the default. To clear the screen with another key, set it and then start a new session or restart omp:
|
|
30
34
|
|
|
31
35
|
```sh
|
|
32
|
-
omp plugin config set @webdavis/omp-clearscreen key
|
|
36
|
+
omp plugin config set @webdavis/omp-clearscreen key ctrl+l
|
|
33
37
|
```
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Limits
|
|
39
|
+
Alternatively, you can configure it in your `~/.omp/plugins/omp-plugins.lock.json` file, like so:
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
```json
|
|
42
|
+
"settings": {
|
|
43
|
+
"@webdavis/omp-clearscreen": {
|
|
44
|
+
"key": "ctrl+l"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
41
48
|
|
|
42
49
|
## Develop
|
|
43
50
|
|
|
44
51
|
```sh
|
|
45
|
-
bun install
|
|
46
|
-
bun test
|
|
47
|
-
bun
|
|
48
|
-
bun
|
|
49
|
-
bun
|
|
52
|
+
bun install # installs the dependencies listed in package.json
|
|
53
|
+
bun test # runs every test
|
|
54
|
+
bun test test/unit # runs only the isolated tests, which load nothing from omp
|
|
55
|
+
bun test test/integration # runs only the integration tests, which exercise the whole extension against a fake omp
|
|
56
|
+
bun test test/omp # runs only the tests that load omp's real code
|
|
57
|
+
bun run typechecker # runs the TypeScript compiler's type-checker on the code in src/ and test/
|
|
58
|
+
bun run format # formats with Prettier, rewriting the files
|
|
59
|
+
bun run format:check # checks the formatting without changing any file
|
|
60
|
+
bun run verify # runs what CI runs: the tests, the type-checker and the format check
|
|
50
61
|
```
|
|
51
|
-
|
|
52
|
-
The idea comes from [pi-clear-hotkey](https://pi.dev/packages/@jetserge/pi-clear-hotkey) for Pi.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webdavis/omp-clearscreen",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Clear omp's screen
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Clear omp's screen, keeping the scrollback, the session and its context.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"omp",
|
|
7
7
|
"oh-my-pi",
|
|
@@ -31,21 +31,20 @@
|
|
|
31
31
|
"settings": {
|
|
32
32
|
"key": {
|
|
33
33
|
"type": "string",
|
|
34
|
-
"default": "ctrl
|
|
35
|
-
"description": "The key that clears the screen,
|
|
34
|
+
"default": "ctrl+\\",
|
|
35
|
+
"description": "The key that clears the screen. If you change the key, it applies once you start a new session or restart omp."
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"
|
|
41
|
-
"test:omp": "bun test test/omp",
|
|
42
|
-
"test:all": "bun test",
|
|
43
|
-
"check": "tsc --noEmit",
|
|
40
|
+
"typechecker": "tsc --noEmit",
|
|
44
41
|
"format": "prettier --write .",
|
|
45
|
-
"format:check": "prettier --check ."
|
|
42
|
+
"format:check": "prettier --check .",
|
|
43
|
+
"verify": "bun test --timeout=2000 && bun run typechecker && bun run format:check"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
|
48
46
|
"@oh-my-pi/pi-coding-agent": "19.2.0",
|
|
47
|
+
"@types/bun": "^1.4.5",
|
|
49
48
|
"prettier": "^3.10.1",
|
|
50
49
|
"typescript": "^7.0.2"
|
|
51
50
|
}
|
package/src/clearscreen.ts
CHANGED
|
@@ -15,7 +15,7 @@ function clearerFor(ctx: ExtensionContext): ScreenClearer {
|
|
|
15
15
|
export function clearscreenExtensionWith(settings: Settings) {
|
|
16
16
|
return (pi: Pick<ExtensionAPI, "on" | "registerCommand">) => {
|
|
17
17
|
pi.registerCommand("clearscreen", {
|
|
18
|
-
description: "Clear the screen
|
|
18
|
+
description: "Clear the screen, keeping the scrollback, the session and its context",
|
|
19
19
|
handler: (_args, ctx) => clearerFor(ctx).clear(),
|
|
20
20
|
});
|
|
21
21
|
|
package/src/omp-settings.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PluginSettingsStore } from "./plugin-settings-store.ts";
|
|
2
2
|
import type { Settings } from "./settings.ts";
|
|
3
3
|
|
|
4
|
-
const DEFAULT_KEY = "ctrl
|
|
4
|
+
const DEFAULT_KEY = "ctrl+\\";
|
|
5
5
|
|
|
6
6
|
export class OmpSettings implements Settings {
|
|
7
7
|
constructor(private readonly store: PluginSettingsStore) {}
|