Skip to content

Commit 9078a01

Browse files
committed
Add g:guise_edit_opener and use 'tab drop'
1 parent f8263fc commit 9078a01

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

denops/guise/editor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as autocmd from "https://deno.land/x/denops_std@v2.1.3/autocmd/mod.ts";
33
import * as anonymous from "https://deno.land/x/denops_std@v2.1.3/anonymous/mod.ts";
44
import * as batch from "https://deno.land/x/denops_std@v2.1.3/batch/mod.ts";
55
import * as fn from "https://deno.land/x/denops_std@v2.1.3/function/mod.ts";
6+
import * as vars from "https://deno.land/x/denops_std@v2.1.3/variable/mod.ts";
67
import * as option from "https://deno.land/x/denops_std@v2.1.3/option/mod.ts";
78
import { deferred } from "https://deno.land/std@0.111.0/async/mod.ts";
89

@@ -17,7 +18,8 @@ export async function open(denops: Denops): Promise<void> {
1718
* Open a `filename` buffer in a new tab page and wait the buffer is closed.
1819
*/
1920
export async function edit(denops: Denops, filename: string): Promise<void> {
20-
await denops.cmd("silent noswapfile tabedit `=filename`", { filename });
21+
let opener = await vars.g.get(denops, "guise_edit_opener", "tab drop");
22+
await denops.cmd(`silent noswapfile ${opener} \`=filename\` | edit`, { filename });
2123
const [winid, bufnr] = await batch.gather(denops, async (denops) => {
2224
await fn.win_getid(denops);
2325
await fn.bufnr(denops);

doc/guise.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ INTERFACE *guise-interface*
2525
-----------------------------------------------------------------------------
2626
VARIABLE *guise-variable*
2727

28+
*g:guise_edit_opener*
29+
Opener expression used to edit file
30+
31+
Default: "tab drop"
32+
2833
*g:guise#disable_vim*
2934
Do NOT start channel server for Vim.
3035

0 commit comments

Comments
 (0)