diff options
author | 2023-03-07 21:05:37 -0800 | |
---|---|---|
committer | 2023-03-07 21:05:44 -0800 | |
commit | 95b59ea0ef637abde76dad4a100cae6c496c1470 (patch) | |
tree | a3ba1cd677ff935bb44d68066546ccb49085ed83 /docs/api/utils.md | |
parent | 24e90726fd88ad8d629b898afe2d35d0fdae0190 (diff) | |
download | bun-95b59ea0ef637abde76dad4a100cae6c496c1470.tar.gz bun-95b59ea0ef637abde76dad4a100cae6c496c1470.tar.zst bun-95b59ea0ef637abde76dad4a100cae6c496c1470.zip |
Document openInEditor
Diffstat (limited to 'docs/api/utils.md')
-rw-r--r-- | docs/api/utils.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/api/utils.md b/docs/api/utils.md index dcd9c0128..ce3d0d6f9 100644 --- a/docs/api/utils.md +++ b/docs/api/utils.md @@ -118,3 +118,29 @@ test("peek.status", () => { expect(peek.status(rejected)).toBe("rejected"); }); ``` + +## `Bun.openInEditor` + +Open a file in your default editor. Bun auto-detects your editor via the `$VISUAL` or `$EDITOR` environment variables. + +```ts +const currentFile = import.meta.url; +Bun.openInEditor(currentFile); +``` + +You can override this via the `debug.editor` setting in your [`bunfig.toml`](/docs/project/configuration) + +```toml-diff#bunfig.toml ++ [debug] ++ editor = "code" +``` + +Or specify an editor with the `editor` param. You can also specify a line and column number. + +```ts +Bun.openInEditor(import.meta.url, { + editor: "vscode", // or "subl" + line: 10, + column: 5, +}) +``` |