Skip to content

Commit 0e0cf96

Browse files
committed
👍 Manually define nvim_win_get_config in Neovim
1 parent 10bc512 commit 0e0cf96

File tree

3 files changed

+41
-24
lines changed

3 files changed

+41
-24
lines changed

function/nvim/_generated.ts

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

function/nvim/_manual.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "./nvim_open_win.ts";
2+
export * from "./nvim_win_get_config.ts";

function/nvim/nvim_win_get_config.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type { Denops } from "../../mod.ts";
2+
import type { NvimOpenWinConfig } from "./nvim_open_win.ts";
3+
4+
/**
5+
* Gets window configuration.
6+
*
7+
* The returned value may be given to `nvim_open_win()`.
8+
*
9+
* `relative` is empty for normal windows.
10+
*
11+
* Parameters:
12+
* - **{window}** Window handle, or 0 for current window
13+
*
14+
* Return:
15+
* Map defining the window configuration, see `nvim_open_win()`
16+
*/
17+
export function nvim_win_get_config(
18+
denops: Denops,
19+
window: number,
20+
): Promise<NvimGetConfigResult>;
21+
export function nvim_win_get_config(
22+
denops: Denops,
23+
...args: unknown[]
24+
): Promise<unknown> {
25+
return denops.call("nvim_win_get_config", ...args);
26+
}
27+
28+
export interface NvimGetConfigResult
29+
extends Omit<NvimOpenWinConfig, "relative"> {
30+
/**
31+
* Sets the window layout to "floating", placed at (row,col) coordinates
32+
* relative to:
33+
* - "" Normal window
34+
* - "editor" The global editor grid
35+
* - "win" Window given by the `win` field, or current window.
36+
* - "cursor" Cursor position in current window.
37+
* - "mouse" Mouse position
38+
*/
39+
relative: "" | "editor" | "win" | "cursor" | "mouse";
40+
}

0 commit comments

Comments
 (0)