Skip to content

Commit 2eb9713

Browse files
committed
👍 Isolate variable module from vim
1 parent 1f33403 commit 2eb9713

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed
File renamed without changes.

variable/helper_test.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { assertEquals, test } from "../deps_test.ts";
2+
import { getVar, removeVar, setVar } from "./helper.ts";
3+
4+
test({
5+
mode: "any",
6+
name: "getVar() return the value of the variable",
7+
fn: async (denops) => {
8+
await denops.cmd("let g:denops_std_vim_variable_test = 'hello'");
9+
const result = await getVar(
10+
denops,
11+
"g",
12+
"denops_std_vim_variable_test",
13+
);
14+
assertEquals(result, "hello");
15+
},
16+
});
17+
18+
test({
19+
mode: "any",
20+
name: "setVar() replace the value of the variable",
21+
fn: async (denops) => {
22+
await denops.cmd("let g:denops_std_vim_variable_test = 'hello'");
23+
await setVar(denops, "g", "denops_std_vim_variable_test", "world");
24+
const result = await getVar(
25+
denops,
26+
"g",
27+
"denops_std_vim_variable_test",
28+
);
29+
assertEquals(result, "world");
30+
},
31+
});
32+
33+
test({
34+
mode: "any",
35+
name: "removeVar() remove the variable",
36+
fn: async (denops) => {
37+
await denops.cmd("let g:denops_std_vim_variable_test = 'hello'");
38+
await removeVar(denops, "g", "denops_std_vim_variable_test");
39+
const result = await getVar(
40+
denops,
41+
"g",
42+
"denops_std_vim_variable_test",
43+
);
44+
assertEquals(result, null);
45+
},
46+
});

variable/mod.ts

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

vim/mod.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from "./autocmd.ts";
22
export * from "./execute.ts";
3-
export * from "./variable.ts";
43
export * from "./load.ts";
54
export * from "./vim.ts";

vim/variable_test.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

vim/vim.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Context, Denops, Dispatcher } from "../deps.ts";
22
import { execute } from "./execute.ts";
33
import { autocmd, AutocmdHelper } from "./autocmd.ts";
4-
import { VariableHelper } from "./variable.ts";
54
import { FunctionHelper } from "./function.ts";
65
import { load } from "./load.ts";
76

@@ -16,21 +15,10 @@ import { load } from "./load.ts";
1615
export class Vim {
1716
#denops: Denops;
1817

19-
readonly g: VariableHelper;
20-
readonly b: VariableHelper;
21-
readonly w: VariableHelper;
22-
readonly t: VariableHelper;
23-
readonly v: VariableHelper;
24-
2518
readonly fn: FunctionHelper;
2619

2720
constructor(denops: Denops) {
2821
this.#denops = denops;
29-
this.g = new VariableHelper(denops, "g");
30-
this.b = new VariableHelper(denops, "b");
31-
this.w = new VariableHelper(denops, "w");
32-
this.t = new VariableHelper(denops, "t");
33-
this.v = new VariableHelper(denops, "v");
3422
this.fn = new FunctionHelper(denops);
3523
}
3624

0 commit comments

Comments
 (0)