Skip to content

Commit dcbb49a

Browse files
committed
Remove 'env' which cannot be treated as variables
Environment variables ($) should have specific ways to handle, like & or @
1 parent 36c7f89 commit dcbb49a

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

vim/variable.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ import { Denops } from "../deps.ts";
88
* w - Window local variables
99
* t - Tab page local variables
1010
* v - Vim's variables
11-
* env - Environment variables
1211
*
1312
*/
14-
export type VariableGroups = "g" | "b" | "w" | "t" | "v" | "env";
13+
export type VariableGroups = "g" | "b" | "w" | "t" | "v";
1514

1615
export async function getVar<T = unknown>(
1716
denops: Denops,
1817
group: VariableGroups,
1918
prop: string,
2019
): Promise<T> {
21-
const name = group === "env" ? `\$${prop}` : `${group}:${prop}`;
20+
const name = `${group}:${prop}`;
2221
// deno-lint-ignore no-explicit-any
2322
return (await denops.eval(name)) as any;
2423
}
@@ -29,7 +28,7 @@ export async function setVar<T = unknown>(
2928
prop: string,
3029
value: T,
3130
): Promise<void> {
32-
const name = group === "env" ? `\$${prop}` : `${group}:${prop}`;
31+
const name = `${group}:${prop}`;
3332
await denops.cmd(`let ${name} = value`, {
3433
value,
3534
});
@@ -40,7 +39,7 @@ export async function removeVar(
4039
group: VariableGroups,
4140
prop: string,
4241
): Promise<void> {
43-
const name = group === "env" ? `\$${prop}` : `${group}:${prop}`;
42+
const name = `${group}:${prop}`;
4443
await denops.cmd(`unlet ${name}`);
4544
}
4645

vim/vim.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export class Vim {
1111
readonly w: VariableHelper;
1212
readonly t: VariableHelper;
1313
readonly v: VariableHelper;
14-
readonly env: VariableHelper;
1514

1615
constructor(denops: Denops) {
1716
this.#denops = denops;
@@ -20,7 +19,6 @@ export class Vim {
2019
this.w = new VariableHelper(denops, "w");
2120
this.t = new VariableHelper(denops, "t");
2221
this.v = new VariableHelper(denops, "v");
23-
this.env = new VariableHelper(denops, "env");
2422
}
2523

2624
static get(): Vim {

0 commit comments

Comments
 (0)