Skip to content

Commit 9f191ba

Browse files
committed
👍 Add swapname() to buffer-function
1 parent 69ff43e commit 9f191ba

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

denops_std/function/_generated.ts

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

denops_std/function/buffer.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,3 +667,21 @@ export async function setbufvar(
667667
): Promise<void> {
668668
await denops.call("setbufvar", buf, varname, val);
669669
}
670+
671+
/**
672+
* The result is the swap file path of the buffer **{expr}**.
673+
* For the use of **{buf}**, see `bufname()` above.
674+
* If buffer **{buf}** is the current buffer, the result is equal to
675+
* `:swapname` (unless there is no swap file).
676+
* If buffer **{buf}** has no swap file, returns an empty string.
677+
*
678+
* Can also be used as a `method`:
679+
*
680+
* GetBufname()->swapname()
681+
*/
682+
export async function swapname(
683+
denops: Denops,
684+
buf: BufNameArg,
685+
): Promise<string> {
686+
return await denops.call("swapname", buf) as string;
687+
}

0 commit comments

Comments
 (0)