diff --git a/.scripts/gen-option/format.ts b/.scripts/gen-option/format.ts index 76a56531..e45e1f3d 100644 --- a/.scripts/gen-option/format.ts +++ b/.scripts/gen-option/format.ts @@ -1,7 +1,5 @@ import type { Option, OptionScope, OptionType } from "./types.ts"; -const denops = "@denops/core"; - const translate: Record = { "default": "defaultValue", "delete": "delete_", @@ -9,37 +7,6 @@ const translate: Record = { "function": "function_", }; -function defaultValue(type: OptionType): string { - switch (type) { - case "string": - return `""`; - case "number": - return `0`; - case "boolean": - return `false`; - default: { - const unknownType: never = type; - throw new Error(`Unknown type ${unknownType}`); - } - } -} - -function coerceValue(expr: string, type: OptionType): string { - switch (type) { - case "string": - return `(${expr}) as string`; - case "number": - return `(${expr}) as number`; - case "boolean": - // Vim returns (0 | 1) so coerce to boolean. - return `Boolean(${expr})`; - default: { - const unknownType: never = type; - throw new Error(`Unknown type ${unknownType}`); - } - } -} - export function formatDocs(docs: string): string[] { const lines = docs.replaceAll(/\*\//g, "* /").split("\n"); const normalizedLines = lines.map((v) => ` * ${v}`.trimEnd()); @@ -51,13 +18,9 @@ function formatOption(option: Option): string[] { const name = translate[option.name] ?? option.name; const lines = [ ...formatDocs(docs), - `export const ${name}: ${getOptionTypeName(scope, type)} = {`, - ...formatOptionBody(name, type), - ...(scope.includes("global") ? formatGlobalOptionBody(name, type) : []), - ...(scope.includes("local") ? formatLocalOptionBody(name, type) : []), - ...(scope.includes("local") ? formatBufferOptionBody(name, type) : []), - ...(scope.includes("local") ? formatWindowOptionBody(name, type) : []), - `};`, + `export const ${name}: ${getOptionTypeName(scope, type)} = ${ + getOptionConstructor(name, type) + };`, "", ]; return lines; @@ -73,90 +36,28 @@ function getOptionTypeName(scope: OptionScope[], type: OptionType): string { } } -function formatOptionBody(name: string, type: OptionType): string[] { - const lines = [ - ` async get(denops: Denops): Promise<${type}> {`, - ` const result = await options.get(denops, "${name}");`, - ` return ${coerceValue(`result ?? ${defaultValue(type)}`, type)};`, - ` },`, - ` set(denops: Denops, value: ${type}): Promise {`, - ` return options.set(denops, "${name}", value);`, - ` },`, - ` reset(denops: Denops): Promise {`, - ` return options.remove(denops, "${name}");`, - ` },`, - ]; - return lines; -} - -function formatGlobalOptionBody(name: string, type: OptionType): string[] { - const lines = [ - ` async getGlobal(denops: Denops): Promise<${type}> {`, - ` const result = await globalOptions.get(denops, "${name}");`, - ` return ${coerceValue(`result ?? ${defaultValue(type)}`, type)};`, - ` },`, - ` setGlobal(denops: Denops, value: ${type}): Promise {`, - ` return globalOptions.set(denops, "${name}", value);`, - ` },`, - ` resetGlobal(denops: Denops): Promise {`, - ` return globalOptions.remove(denops, "${name}");`, - ` },`, - ]; - return lines; -} - -function formatLocalOptionBody(name: string, type: OptionType): string[] { - const lines = [ - ` async getLocal(denops: Denops): Promise<${type}> {`, - ` const result = await localOptions.get(denops, "${name}");`, - ` return ${coerceValue(`result ?? ${defaultValue(type)}`, type)};`, - ` },`, - ` setLocal(denops: Denops, value: ${type}): Promise {`, - ` return localOptions.set(denops, "${name}", value);`, - ` },`, - ` resetLocal(denops: Denops): Promise {`, - ` return localOptions.remove(denops, "${name}");`, - ` },`, - ]; - return lines; -} - -function formatBufferOptionBody(name: string, type: OptionType): string[] { - const lines = [ - ` async getBuffer(denops: Denops, bufnr: number): Promise<${type}> {`, - ` const result = await getbufvar(denops, bufnr, "&${name}");`, - ` return ${coerceValue(`result ?? ${defaultValue(type)}`, type)};`, - ` },`, - ` setBuffer(denops: Denops, bufnr: number, value: ${type}): Promise {`, - ` return setbufvar(denops, bufnr, "&${name}", value);`, - ` },`, - ]; - return lines; -} - -function formatWindowOptionBody(name: string, type: OptionType): string[] { - const lines = [ - ` async getWindow(denops: Denops, winnr: number): Promise<${type}> {`, - ` const result = await getwinvar(denops, winnr, "&${name}");`, - ` return ${coerceValue(`result ?? ${defaultValue(type)}`, type)};`, - ` },`, - ` setWindow(denops: Denops, winnr: number, value: ${type}): Promise {`, - ` return setwinvar(denops, winnr, "&${name}", value);`, - ` },`, - ]; - return lines; +function getOptionConstructor(name: string, type: OptionType): string { + switch (type) { + case "string": + return `new StringOption("${name}")`; + case "number": + return `new NumberOption("${name}")`; + case "boolean": + return `new BooleanOption("${name}")`; + default: { + const unknownType: never = type; + throw new Error(`Unknown type ${unknownType}`); + } + } } export function format(options: Option[], root: string): string[] { - const fn = `${root}/../function/mod.ts`; - const variable = `${root}/../variable/mod.ts`; const types = `${root}/types.ts`; + const utils = `${root}/_utils.ts`; const lines = [ "// NOTE: This file is generated. Do NOT modify it manually.", - `import type { Denops } from "${denops}";`, - `import { getbufvar, setbufvar, getwinvar, setwinvar } from "${fn}";`, - `import { globalOptions, localOptions, options } from "${variable}";`, `import type { GlobalOption, GlobalOrLocalOption, LocalOption } from "${types}";`, + `import { BooleanOption, NumberOption, StringOption } from "${utils}";`, "", ...options.map(formatOption), ]; diff --git a/option/_generated.ts b/option/_generated.ts index 58b9bdc6..5384d867 100644 --- a/option/_generated.ts +++ b/option/_generated.ts @@ -1,17 +1,10 @@ // NOTE: This file is generated. Do NOT modify it manually. -import type { Denops } from "@denops/core"; -import { - getbufvar, - getwinvar, - setbufvar, - setwinvar, -} from "./../function/mod.ts"; -import { globalOptions, localOptions, options } from "./../variable/mod.ts"; import type { GlobalOption, GlobalOrLocalOption, LocalOption, } from "./types.ts"; +import { BooleanOption, NumberOption, StringOption } from "./_utils.ts"; /** * Allow CTRL-_ in Insert and Command-line mode. This is default off, to @@ -24,28 +17,9 @@ import type { * * *only available when compiled with the `+rightleft` feature* */ -export const allowrevins: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "allowrevins"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "allowrevins", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "allowrevins"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "allowrevins"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "allowrevins", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "allowrevins"); - }, -}; +export const allowrevins: GlobalOption = new BooleanOption( + "allowrevins", +); /** * Only effective when 'encoding' is "utf-8" or another Unicode encoding. @@ -87,28 +61,7 @@ export const allowrevins: GlobalOption = { * * (default: "single") */ -export const ambiwidth: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ambiwidth"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "ambiwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ambiwidth"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ambiwidth"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "ambiwidth", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ambiwidth"); - }, -}; +export const ambiwidth: GlobalOption = new StringOption("ambiwidth"); /** * This option can be set to start editing Arabic text. @@ -132,42 +85,7 @@ export const ambiwidth: GlobalOption = { * * *only available when compiled with the `+arabic` feature* */ -export const arabic: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "arabic"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "arabic", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "arabic"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "arabic"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "arabic", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "arabic"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&arabic"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&arabic", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&arabic"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&arabic", value); - }, -}; +export const arabic: LocalOption = new BooleanOption("arabic"); /** * When on and 'termbidi' is off, the required visual character @@ -188,28 +106,9 @@ export const arabic: LocalOption = { * * *only available when compiled with the `+arabic` feature* */ -export const arabicshape: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "arabicshape"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "arabicshape", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "arabicshape"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "arabicshape"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "arabicshape", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "arabicshape"); - }, -}; +export const arabicshape: GlobalOption = new BooleanOption( + "arabicshape", +); /** * When on, Vim will change the current working directory whenever you @@ -223,28 +122,7 @@ export const arabicshape: GlobalOption = { * * *only available when compiled with it, use exists("+autochdir") to check* */ -export const autochdir: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "autochdir"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "autochdir", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "autochdir"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "autochdir"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "autochdir", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "autochdir"); - }, -}; +export const autochdir: GlobalOption = new BooleanOption("autochdir"); /** * Copy indent from current line when starting a new line (typing `` @@ -263,42 +141,7 @@ export const autochdir: GlobalOption = { * * (default off) */ -export const autoindent: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "autoindent"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "autoindent", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "autoindent"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "autoindent"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "autoindent", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "autoindent"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&autoindent"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&autoindent", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&autoindent"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&autoindent", value); - }, -}; +export const autoindent: LocalOption = new BooleanOption("autoindent"); /** * When a file has been detected to have been changed outside of Vim and @@ -313,52 +156,9 @@ export const autoindent: LocalOption = { * * (default off) */ -export const autoread: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "autoread"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "autoread", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "autoread"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "autoread"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "autoread", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "autoread"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "autoread"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "autoread", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "autoread"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&autoread"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&autoread", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&autoread"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&autoread", value); - }, -}; +export const autoread: GlobalOrLocalOption = new BooleanOption( + "autoread", +); /** * Write the contents of the file, if it has been modified, on each @@ -378,28 +178,7 @@ export const autoread: GlobalOrLocalOption = { * * (default off) */ -export const autowrite: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "autowrite"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "autowrite", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "autowrite"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "autowrite"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "autowrite", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "autowrite"); - }, -}; +export const autowrite: GlobalOption = new BooleanOption("autowrite"); /** * Like 'autowrite', but also used for commands ":edit", ":enew", ":quit", @@ -409,28 +188,9 @@ export const autowrite: GlobalOption = { * * (default off) */ -export const autowriteall: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "autowriteall"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "autowriteall", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "autowriteall"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "autowriteall"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "autowriteall", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "autowriteall"); - }, -}; +export const autowriteall: GlobalOption = new BooleanOption( + "autowriteall", +); /** * When set to "dark", Vim will try to use colors that look good on a @@ -502,28 +262,7 @@ export const autowriteall: GlobalOption = { * * (default "dark" or "light", see below) */ -export const background: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "background"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "background", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "background"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "background"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "background", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "background"); - }, -}; +export const background: GlobalOption = new StringOption("background"); /** * Influences the working of ``, ``, CTRL-W and CTRL-U in Insert @@ -553,28 +292,7 @@ export const background: GlobalOption = { * (default "", set to "indent,eol,start" * in `defaults.vim`) */ -export const backspace: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "backspace"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "backspace", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "backspace"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "backspace"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "backspace", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "backspace"); - }, -}; +export const backspace: GlobalOption = new StringOption("backspace"); /** * Make a backup before overwriting a file. Leave it around after the @@ -591,28 +309,7 @@ export const backspace: GlobalOption = { * * (default off) */ -export const backup: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "backup"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "backup", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "backup"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "backup"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "backup", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "backup"); - }, -}; +export const backup: GlobalOption = new BooleanOption("backup"); /** * When writing a file and a backup is made, this option tells how it's @@ -682,52 +379,9 @@ export const backup: GlobalOption = { * * (Vi default for Unix: "yes", otherwise: "auto") */ -export const backupcopy: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "backupcopy"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "backupcopy", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "backupcopy"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "backupcopy"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "backupcopy", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "backupcopy"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "backupcopy"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "backupcopy", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "backupcopy"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&backupcopy"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&backupcopy", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&backupcopy"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&backupcopy", value); - }, -}; +export const backupcopy: GlobalOrLocalOption = new StringOption( + "backupcopy", +); /** * List of directories for the backup file, separated with commas. @@ -780,28 +434,7 @@ export const backupcopy: GlobalOrLocalOption = { * for Win32: ".,$TEMP,c:/tmp,c:/temp" * for Unix: `".,~/tmp,~/"`) */ -export const backupdir: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "backupdir"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "backupdir", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "backupdir"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "backupdir"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "backupdir", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "backupdir"); - }, -}; +export const backupdir: GlobalOption = new StringOption("backupdir"); /** * String which is appended to a file name to make the name of the @@ -821,28 +454,7 @@ export const backupdir: GlobalOption = { * * (default `"~"`, for VMS: "_") */ -export const backupext: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "backupext"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "backupext", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "backupext"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "backupext"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "backupext", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "backupext"); - }, -}; +export const backupext: GlobalOption = new StringOption("backupext"); /** * A list of file patterns. When one of the patterns matches with the @@ -871,28 +483,7 @@ export const backupext: GlobalOption = { * Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*" * Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") */ -export const backupskip: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "backupskip"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "backupskip", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "backupskip"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "backupskip"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "backupskip", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "backupskip"); - }, -}; +export const backupskip: GlobalOption = new StringOption("backupskip"); /** * Specifies for which events the bell will not be rung. It is a comma @@ -936,28 +527,7 @@ export const backupskip: GlobalOption = { * * (default "") */ -export const belloff: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "belloff"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "belloff", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "belloff"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "belloff"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "belloff", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "belloff"); - }, -}; +export const belloff: GlobalOption = new StringOption("belloff"); /** * This option should be set before editing a binary file. You can also @@ -989,42 +559,7 @@ export const belloff: GlobalOption = { * * (default off) */ -export const binary: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "binary"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "binary", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "binary"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "binary"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "binary", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "binary"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&binary"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&binary", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&binary"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&binary", value); - }, -}; +export const binary: LocalOption = new BooleanOption("binary"); /** * When writing a file and the following conditions are met, a BOM (Byte @@ -1045,42 +580,7 @@ export const binary: LocalOption = { * * (default off) */ -export const bomb: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "bomb"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "bomb", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "bomb"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "bomb"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "bomb", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "bomb"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&bomb"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&bomb", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&bomb"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&bomb", value); - }, -}; +export const bomb: LocalOption = new BooleanOption("bomb"); /** * This option lets you choose which characters might cause a line @@ -1091,28 +591,7 @@ export const bomb: LocalOption = { * * *not available when compiled without the `+linebreak` feature* */ -export const breakat: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "breakat"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "breakat", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "breakat"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "breakat"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "breakat", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "breakat"); - }, -}; +export const breakat: GlobalOption = new StringOption("breakat"); /** * Every wrapped line will continue visually indented (same amount of @@ -1124,42 +603,9 @@ export const breakat: GlobalOption = { * * *not available when compiled without the `+linebreak` feature* */ -export const breakindent: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "breakindent"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "breakindent", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "breakindent"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "breakindent"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "breakindent", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "breakindent"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&breakindent"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&breakindent", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&breakindent"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&breakindent", value); - }, -}; +export const breakindent: LocalOption = new BooleanOption( + "breakindent", +); /** * Settings for 'breakindent'. It can consist of the following optional @@ -1194,42 +640,9 @@ export const breakindent: LocalOption = { * * *not available when compiled without the `+linebreak` feature* */ -export const breakindentopt: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "breakindentopt"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "breakindentopt", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "breakindentopt"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "breakindentopt"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "breakindentopt", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "breakindentopt"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&breakindentopt"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&breakindentopt", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&breakindentopt"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&breakindentopt", value); - }, -}; +export const breakindentopt: LocalOption = new StringOption( + "breakindentopt", +); /** * Which directory to use for the file browser: @@ -1243,28 +656,7 @@ export const breakindentopt: LocalOption = { * * *only for Motif, GTK, Mac and Win32 GUI* */ -export const browsedir: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "browsedir"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "browsedir", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "browsedir"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "browsedir"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "browsedir", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "browsedir"); - }, -}; +export const browsedir: GlobalOption = new StringOption("browsedir"); /** * This option specifies what happens when a buffer is no longer @@ -1289,42 +681,7 @@ export const browsedir: GlobalOption = { * * (default: "") */ -export const bufhidden: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "bufhidden"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "bufhidden", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "bufhidden"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "bufhidden"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "bufhidden", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "bufhidden"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&bufhidden"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&bufhidden", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&bufhidden"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&bufhidden", value); - }, -}; +export const bufhidden: LocalOption = new StringOption("bufhidden"); /** * When this option is set, the buffer shows up in the buffer list. If @@ -1335,42 +692,7 @@ export const bufhidden: LocalOption = { * * (default: on) */ -export const buflisted: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "buflisted"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "buflisted", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "buflisted"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "buflisted"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "buflisted", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "buflisted"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&buflisted"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&buflisted", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&buflisted"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&buflisted", value); - }, -}; +export const buflisted: LocalOption = new BooleanOption("buflisted"); /** * The value of this option specifies the type of a buffer: @@ -1428,42 +750,7 @@ export const buflisted: LocalOption = { * * (default: "") */ -export const buftype: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "buftype"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "buftype", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "buftype"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "buftype"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "buftype", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "buftype"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&buftype"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&buftype", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&buftype"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&buftype", value); - }, -}; +export const buftype: LocalOption = new StringOption("buftype"); /** * Specifies details about changing the case of letters. It may contain @@ -1480,28 +767,7 @@ export const buftype: LocalOption = { * * (default: "internal,keepascii") */ -export const casemap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "casemap"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "casemap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "casemap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "casemap"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "casemap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "casemap"); - }, -}; +export const casemap: GlobalOption = new StringOption("casemap"); /** * When on, `:cd`, `:tcd` and `:lcd` without an argument changes the @@ -1514,28 +780,7 @@ export const casemap: GlobalOption = { * * (default: off) */ -export const cdhome: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cdhome"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cdhome", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cdhome"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cdhome"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "cdhome", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cdhome"); - }, -}; +export const cdhome: GlobalOption = new BooleanOption("cdhome"); /** * This is a list of directories which will be searched when using the @@ -1558,28 +803,7 @@ export const cdhome: GlobalOption = { * * (default: equivalent to $CDPATH or ",,") */ -export const cdpath: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cdpath"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cdpath", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cdpath"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cdpath"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "cdpath", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cdpath"); - }, -}; +export const cdpath: GlobalOption = new StringOption("cdpath"); /** * The key used in Command-line Mode to open the command-line window. @@ -1598,28 +822,7 @@ export const cdpath: GlobalOption = { * * (Vi default: "", Vim default: CTRL-F) */ -export const cedit: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cedit"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cedit", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cedit"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cedit"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "cedit", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cedit"); - }, -}; +export const cedit: GlobalOption = new StringOption("cedit"); /** * An expression that is used for character encoding conversion. It is @@ -1681,28 +884,9 @@ export const cedit: GlobalOption = { * * *only available when compiled with the `+eval` feature* */ -export const charconvert: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "charconvert"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "charconvert", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "charconvert"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "charconvert"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "charconvert", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "charconvert"); - }, -}; +export const charconvert: GlobalOption = new StringOption( + "charconvert", +); /** * Enables automatic C program indenting. See 'cinkeys' to set the keys @@ -1720,42 +904,7 @@ export const charconvert: GlobalOption = { * * (default off) */ -export const cindent: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cindent"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cindent", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cindent"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cindent"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "cindent", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cindent"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cindent"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&cindent", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cindent"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&cindent", value); - }, -}; +export const cindent: LocalOption = new BooleanOption("cindent"); /** * A list of keys that, when typed in Insert mode, cause reindenting of @@ -1766,42 +915,7 @@ export const cindent: LocalOption = { * * (default "0**{,0}**,0),0],:,0#,!^F,o,O,e") */ -export const cinkeys: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cinkeys"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cinkeys", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cinkeys"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cinkeys"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "cinkeys", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cinkeys"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cinkeys"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&cinkeys", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cinkeys"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&cinkeys", value); - }, -}; +export const cinkeys: LocalOption = new StringOption("cinkeys"); /** * The 'cinoptions' affect the way 'cindent' reindents lines in a C @@ -1810,42 +924,7 @@ export const cinkeys: LocalOption = { * * (default "") */ -export const cinoptions: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cinoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cinoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cinoptions"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cinoptions"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "cinoptions", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cinoptions"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cinoptions"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&cinoptions", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cinoptions"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&cinoptions", value); - }, -}; +export const cinoptions: LocalOption = new StringOption("cinoptions"); /** * Keywords that are interpreted as a C++ scope declaration by `cino-g`. @@ -1856,42 +935,9 @@ export const cinoptions: LocalOption = { * * (default "public,protected,private") */ -export const cinscopedecls: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cinscopedecls"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cinscopedecls", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cinscopedecls"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cinscopedecls"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "cinscopedecls", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cinscopedecls"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cinscopedecls"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&cinscopedecls", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cinscopedecls"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&cinscopedecls", value); - }, -}; +export const cinscopedecls: LocalOption = new StringOption( + "cinscopedecls", +); /** * These keywords start an extra indent in the next line when @@ -1903,42 +949,7 @@ export const cinscopedecls: LocalOption = { * * (default "if,else,while,do,for,switch") */ -export const cinwords: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cinwords"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cinwords", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cinwords"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cinwords"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "cinwords", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cinwords"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cinwords"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&cinwords", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cinwords"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&cinwords", value); - }, -}; +export const cinwords: LocalOption = new StringOption("cinwords"); /** * This option is a list of comma-separated names. @@ -2028,28 +1039,7 @@ export const cinwords: LocalOption = { * * *only in GUI versions or when the `+xterm_clipboard` feature is included* */ -export const clipboard: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "clipboard"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "clipboard", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "clipboard"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "clipboard"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "clipboard", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "clipboard"); - }, -}; +export const clipboard: GlobalOption = new StringOption("clipboard"); /** * Number of screen lines to use for the command-line. A larger value @@ -2059,80 +1049,18 @@ export const clipboard: GlobalOption = { * * (default 1) */ -export const cmdheight: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cmdheight"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "cmdheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cmdheight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cmdheight"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "cmdheight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cmdheight"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cmdheight"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "cmdheight", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cmdheight"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cmdheight"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&cmdheight", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cmdheight"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&cmdheight", value); - }, -}; +export const cmdheight: GlobalOrLocalOption = new NumberOption( + "cmdheight", +); /** * Number of screen lines to use for the command-line window. `cmdwin` * * (default 7) */ -export const cmdwinheight: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cmdwinheight"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "cmdwinheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cmdwinheight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cmdwinheight"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "cmdwinheight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cmdwinheight"); - }, -}; +export const cmdwinheight: GlobalOption = new NumberOption( + "cmdwinheight", +); /** * 'colorcolumn' is a comma-separated list of screen columns that are @@ -2152,42 +1080,7 @@ export const cmdwinheight: GlobalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const colorcolumn: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "colorcolumn"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "colorcolumn", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "colorcolumn"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "colorcolumn"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "colorcolumn", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "colorcolumn"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&colorcolumn"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&colorcolumn", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&colorcolumn"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&colorcolumn", value); - }, -}; +export const colorcolumn: LocalOption = new StringOption("colorcolumn"); /** * Number of columns of the screen. Normally this is set by the terminal @@ -2208,28 +1101,7 @@ export const colorcolumn: LocalOption = { * * (default 80 or terminal width) */ -export const columns: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "columns"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "columns", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "columns"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "columns"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "columns", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "columns"); - }, -}; +export const columns: GlobalOption = new NumberOption("columns"); /** * A comma-separated list of strings that can start a comment line. See @@ -2239,42 +1111,7 @@ export const columns: GlobalOption = { * (default * "s1:/*,mb:*,ex:* /,://,b:#,:%,:XCOMM,n:>,fb:-") */ -export const comments: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "comments"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "comments", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "comments"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "comments"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "comments", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "comments"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&comments"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&comments", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&comments"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&comments", value); - }, -}; +export const comments: LocalOption = new StringOption("comments"); /** * A template for a comment. The "%s" in the value is replaced with the @@ -2285,42 +1122,9 @@ export const comments: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const commentstring: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "commentstring"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "commentstring", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "commentstring"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "commentstring"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "commentstring", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "commentstring"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&commentstring"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&commentstring", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&commentstring"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&commentstring", value); - }, -}; +export const commentstring: LocalOption = new StringOption( + "commentstring", +); /** * This option specifies how keyword completion `ins-completion` works @@ -2367,42 +1171,7 @@ export const commentstring: LocalOption = { * * (default: ".,w,b,u,t,i") */ -export const complete: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "complete"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "complete", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "complete"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "complete"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "complete", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "complete"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&complete"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&complete", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&complete"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&complete", value); - }, -}; +export const complete: LocalOption = new StringOption("complete"); /** * This option specifies a function to be used for Insert mode completion @@ -2418,42 +1187,9 @@ export const complete: LocalOption = { * * *not available when compiled without the `+eval` feature* */ -export const completefunc: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "completefunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "completefunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "completefunc"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "completefunc"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "completefunc", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "completefunc"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&completefunc"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&completefunc", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&completefunc"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&completefunc", value); - }, -}; +export const completefunc: LocalOption = new StringOption( + "completefunc", +); /** * A comma-separated list of options for Insert mode completion @@ -2500,28 +1236,9 @@ export const completefunc: LocalOption = { * * (default: "menu,preview") */ -export const completeopt: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "completeopt"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "completeopt", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "completeopt"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "completeopt"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "completeopt", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "completeopt"); - }, -}; +export const completeopt: GlobalOption = new StringOption( + "completeopt", +); /** * When this option is set it overrules 'shellslash' for completion: @@ -2539,42 +1256,9 @@ export const completeopt: GlobalOption = { * * *only for MS-Windows* */ -export const completeslash: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "completeslash"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "completeslash", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "completeslash"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "completeslash"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "completeslash", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "completeslash"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&completeslash"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&completeslash", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&completeslash"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&completeslash", value); - }, -}; +export const completeslash: LocalOption = new StringOption( + "completeslash", +); /** * Sets the modes in which text in the cursor line can also be concealed. @@ -2597,42 +1281,9 @@ export const completeslash: LocalOption = { * * *not available when compiled without the `+conceal` feature* */ -export const concealcursor: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "concealcursor"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "concealcursor", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "concealcursor"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "concealcursor"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "concealcursor", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "concealcursor"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&concealcursor"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&concealcursor", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&concealcursor"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&concealcursor", value); - }, -}; +export const concealcursor: LocalOption = new StringOption( + "concealcursor", +); /** * Determine how text with the "conceal" syntax attribute `:syn-conceal` @@ -2659,42 +1310,9 @@ export const concealcursor: LocalOption = { * * *not available when compiled without the `+conceal` feature* */ -export const conceallevel: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "conceallevel"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "conceallevel", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "conceallevel"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "conceallevel"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "conceallevel", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "conceallevel"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&conceallevel"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&conceallevel", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&conceallevel"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&conceallevel", value); - }, -}; +export const conceallevel: LocalOption = new NumberOption( + "conceallevel", +); /** * When 'confirm' is on, certain operations that would normally @@ -2708,28 +1326,7 @@ export const conceallevel: LocalOption = { * * (default off) */ -export const confirm: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "confirm"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "confirm", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "confirm"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "confirm"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "confirm", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "confirm"); - }, -}; +export const confirm: GlobalOption = new BooleanOption("confirm"); /** * Copy the structure of the existing lines indent when autoindenting a @@ -2745,42 +1342,7 @@ export const confirm: GlobalOption = { * * (default off) */ -export const copyindent: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "copyindent"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "copyindent", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "copyindent"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "copyindent"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "copyindent", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "copyindent"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "©indent"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "©indent", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "©indent"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "©indent", value); - }, -}; +export const copyindent: LocalOption = new BooleanOption("copyindent"); /** * A sequence of single character flags. When a character is present @@ -3103,28 +1665,7 @@ export const copyindent: LocalOption = { * (Vim default: "aABceFs", * Vi default: all flags) */ -export const cpoptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cpoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cpoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cpoptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cpoptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "cpoptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cpoptions"); - }, -}; +export const cpoptions: GlobalOption = new StringOption("cpoptions"); /** * When this option is set, as the cursor in the current @@ -3137,42 +1678,7 @@ export const cpoptions: GlobalOption = { * * (default off) */ -export const cursorbind: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cursorbind"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cursorbind", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cursorbind"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cursorbind"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "cursorbind", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cursorbind"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cursorbind"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&cursorbind", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cursorbind"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&cursorbind", value); - }, -}; +export const cursorbind: LocalOption = new BooleanOption("cursorbind"); /** * Highlight the screen column of the cursor with CursorColumn @@ -3188,42 +1694,9 @@ export const cursorbind: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const cursorcolumn: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cursorcolumn"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cursorcolumn", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cursorcolumn"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cursorcolumn"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "cursorcolumn", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cursorcolumn"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cursorcolumn"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&cursorcolumn", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cursorcolumn"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&cursorcolumn", value); - }, -}; +export const cursorcolumn: LocalOption = new BooleanOption( + "cursorcolumn", +); /** * Highlight the text line of the cursor with CursorLine `hl-CursorLine`. @@ -3235,42 +1708,7 @@ export const cursorcolumn: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const cursorline: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cursorline"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cursorline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cursorline"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cursorline"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "cursorline", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cursorline"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cursorline"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&cursorline", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cursorline"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&cursorline", value); - }, -}; +export const cursorline: LocalOption = new BooleanOption("cursorline"); /** * Comma-separated list of settings for how 'cursorline' is displayed. @@ -3291,42 +1729,9 @@ export const cursorline: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const cursorlineopt: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cursorlineopt"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cursorlineopt", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cursorlineopt"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cursorlineopt"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "cursorlineopt", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cursorlineopt"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cursorlineopt"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&cursorlineopt", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cursorlineopt"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&cursorlineopt", value); - }, -}; +export const cursorlineopt: LocalOption = new StringOption( + "cursorlineopt", +); /** * These values can be used: @@ -3342,28 +1747,7 @@ export const cursorlineopt: LocalOption = { * * (default "") */ -export const debug: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "debug"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "debug", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "debug"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "debug"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "debug", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "debug"); - }, -}; +export const debug: GlobalOption = new StringOption("debug"); /** * Pattern to be used to find a macro definition. It is a search @@ -3395,52 +1779,7 @@ export const debug: GlobalOption = { * * (default "^\s*#\s*define") */ -export const define: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "define"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "define", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "define"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "define"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "define", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "define"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "define"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "define", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "define"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&define"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&define", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&define"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&define", value); - }, -}; +export const define: GlobalOrLocalOption = new StringOption("define"); /** * If editing Unicode and this option is set, backspace and Normal mode @@ -3456,28 +1795,9 @@ export const define: GlobalOrLocalOption = { * * (default off) */ -export const delcombine: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "delcombine"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "delcombine", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "delcombine"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "delcombine"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "delcombine", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "delcombine"); - }, -}; +export const delcombine: GlobalOption = new BooleanOption( + "delcombine", +); /** * List of file names, separated by commas, that are used to lookup words @@ -3505,52 +1825,9 @@ export const delcombine: GlobalOption = { * * (default "") */ -export const dictionary: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "dictionary"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "dictionary", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "dictionary"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "dictionary"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "dictionary", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "dictionary"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "dictionary"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "dictionary", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "dictionary"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&dictionary"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&dictionary", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&dictionary"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&dictionary", value); - }, -}; +export const dictionary: GlobalOrLocalOption = new StringOption( + "dictionary", +); /** * Join the current window in the group of windows that shows differences @@ -3560,42 +1837,7 @@ export const dictionary: GlobalOrLocalOption = { * * *not available when compiled without the `+diff` feature* */ -export const diff: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "diff"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "diff", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "diff"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "diff"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "diff", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "diff"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&diff"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&diff", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&diff"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&diff", value); - }, -}; +export const diff: LocalOption = new BooleanOption("diff"); /** * Expression which is evaluated to obtain a diff file (either ed-style @@ -3607,28 +1849,7 @@ export const diff: LocalOption = { * * *not available when compiled without the `+diff` feature* */ -export const diffexpr: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "diffexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "diffexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "diffexpr"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "diffexpr"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "diffexpr", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "diffexpr"); - }, -}; +export const diffexpr: GlobalOption = new StringOption("diffexpr"); /** * Option settings for diff mode. It can consist of the following items. @@ -3732,28 +1953,7 @@ export const diffexpr: GlobalOption = { * * *not available when compiled without the `+diff` feature* */ -export const diffopt: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "diffopt"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "diffopt", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "diffopt"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "diffopt"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "diffopt", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "diffopt"); - }, -}; +export const diffopt: GlobalOption = new StringOption("diffopt"); /** * Enable the entering of digraphs in Insert mode with **{char1}** `` @@ -3764,28 +1964,7 @@ export const diffopt: GlobalOption = { * * *not available when compiled without the `+digraphs` feature* */ -export const digraph: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "digraph"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "digraph", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "digraph"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "digraph"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "digraph", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "digraph"); - }, -}; +export const digraph: GlobalOption = new BooleanOption("digraph"); /** * List of directory names for the swap file, separated with commas. @@ -3845,28 +2024,7 @@ export const digraph: GlobalOption = { * for Win32: ".,$TEMP,c:\tmp,c:\temp" * for Unix: `".,~/tmp,/var/tmp,/tmp"`) */ -export const directory: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "directory"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "directory", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "directory"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "directory"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "directory", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "directory"); - }, -}; +export const directory: GlobalOption = new StringOption("directory"); /** * Change the way text is displayed. This is a comma-separated list of @@ -3889,28 +2047,7 @@ export const directory: GlobalOption = { * (default "", set to "truncate" in * `defaults.vim`) */ -export const display: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "display"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "display", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "display"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "display"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "display", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "display"); - }, -}; +export const display: GlobalOption = new StringOption("display"); /** * Tells when the 'equalalways' option applies: @@ -3920,28 +2057,9 @@ export const display: GlobalOption = { * * (default "both") */ -export const eadirection: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "eadirection"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "eadirection", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "eadirection"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "eadirection"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "eadirection", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "eadirection"); - }, -}; +export const eadirection: GlobalOption = new StringOption( + "eadirection", +); /** * When on all Unicode emoji characters are considered to be full width. @@ -3952,28 +2070,7 @@ export const eadirection: GlobalOption = { * * (default: on) */ -export const emoji: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "emoji"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "emoji", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "emoji"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "emoji"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "emoji", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "emoji"); - }, -}; +export const emoji: GlobalOption = new BooleanOption("emoji"); /** * Sets the character encoding used inside Vim. It applies to text in @@ -4039,28 +2136,7 @@ export const emoji: GlobalOption = { * (default for MS-Windows: "utf-8", * otherwise: value from $LANG or "latin1") */ -export const encoding: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "encoding"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "encoding", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "encoding"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "encoding"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "encoding", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "encoding"); - }, -}; +export const encoding: GlobalOption = new StringOption("encoding"); /** * Indicates that a CTRL-Z character was found at the end of the file @@ -4072,42 +2148,7 @@ export const encoding: GlobalOption = { * * (default off) */ -export const endoffile: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "endoffile"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "endoffile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "endoffile"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "endoffile"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "endoffile", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "endoffile"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&endoffile"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&endoffile", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&endoffile"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&endoffile", value); - }, -}; +export const endoffile: LocalOption = new BooleanOption("endoffile"); /** * When writing a file and this option is off and the 'binary' option @@ -4125,42 +2166,7 @@ export const endoffile: LocalOption = { * * (default on) */ -export const endofline: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "endofline"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "endofline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "endofline"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "endofline"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "endofline", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "endofline"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&endofline"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&endofline", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&endofline"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&endofline", value); - }, -}; +export const endofline: LocalOption = new BooleanOption("endofline"); /** * When on, all the windows are automatically made the same size after @@ -4180,28 +2186,9 @@ export const endofline: LocalOption = { * * (default on) */ -export const equalalways: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "equalalways"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "equalalways", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "equalalways"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "equalalways"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "equalalways", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "equalalways"); - }, -}; +export const equalalways: GlobalOption = new BooleanOption( + "equalalways", +); /** * External program to use for "=" command. When this option is empty @@ -4215,52 +2202,9 @@ export const equalalways: GlobalOption = { * * (default "") */ -export const equalprg: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "equalprg"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "equalprg", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "equalprg"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "equalprg"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "equalprg", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "equalprg"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "equalprg"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "equalprg", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "equalprg"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&equalprg"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&equalprg", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&equalprg"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&equalprg", value); - }, -}; +export const equalprg: GlobalOrLocalOption = new StringOption( + "equalprg", +); /** * Ring the bell (beep or screen flash) for error messages. This only @@ -4272,28 +2216,9 @@ export const equalprg: GlobalOrLocalOption = { * * (default off) */ -export const errorbells: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "errorbells"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "errorbells", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "errorbells"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "errorbells"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "errorbells", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "errorbells"); - }, -}; +export const errorbells: GlobalOption = new BooleanOption( + "errorbells", +); /** * Name of the errorfile for the QuickFix mode (see `:cf`). @@ -4310,28 +2235,7 @@ export const errorbells: GlobalOption = { * * *not available when compiled without the `+quickfix` feature* */ -export const errorfile: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "errorfile"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "errorfile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "errorfile"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "errorfile"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "errorfile", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "errorfile"); - }, -}; +export const errorfile: GlobalOption = new StringOption("errorfile"); /** * Scanf-like description of the format for the lines in the error file @@ -4341,52 +2245,9 @@ export const errorfile: GlobalOption = { * * *not available when compiled without the `+quickfix` feature* */ -export const errorformat: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "errorformat"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "errorformat", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "errorformat"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "errorformat"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "errorformat", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "errorformat"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "errorformat"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "errorformat", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "errorformat"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&errorformat"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&errorformat", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&errorformat"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&errorformat", value); - }, -}; +export const errorformat: GlobalOrLocalOption = new StringOption( + "errorformat", +); /** * A list of autocommand event names, which are to be ignored. @@ -4398,28 +2259,9 @@ export const errorformat: GlobalOrLocalOption = { * * (default "") */ -export const eventignore: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "eventignore"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "eventignore", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "eventignore"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "eventignore"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "eventignore", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "eventignore"); - }, -}; +export const eventignore: GlobalOption = new StringOption( + "eventignore", +); /** * In Insert mode: Use the appropriate number of spaces to insert a @@ -4432,42 +2274,7 @@ export const eventignore: GlobalOption = { * * (default off) */ -export const expandtab: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "expandtab"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "expandtab", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "expandtab"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "expandtab"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "expandtab", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "expandtab"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&expandtab"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&expandtab", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&expandtab"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&expandtab", value); - }, -}; +export const expandtab: LocalOption = new BooleanOption("expandtab"); /** * Enables the reading of .vimrc, .exrc and .gvimrc in the current @@ -4487,28 +2294,7 @@ export const expandtab: LocalOption = { * * (default off) */ -export const exrc: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "exrc"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "exrc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "exrc"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "exrc"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "exrc", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "exrc"); - }, -}; +export const exrc: GlobalOption = new BooleanOption("exrc"); /** * Sets the character encoding for the file of this buffer. @@ -4561,42 +2347,9 @@ export const exrc: GlobalOption = { * * (default: "") */ -export const fileencoding: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fileencoding"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "fileencoding", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fileencoding"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "fileencoding"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "fileencoding", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "fileencoding"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&fileencoding"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&fileencoding", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&fileencoding"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&fileencoding", value); - }, -}; +export const fileencoding: LocalOption = new StringOption( + "fileencoding", +); /** * This is a list of character encodings considered when starting to edit @@ -4660,28 +2413,9 @@ export const fileencoding: LocalOption = { * "ucs-bom,utf-8,default,latin1" when * 'encoding' is set to a Unicode value) */ -export const fileencodings: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fileencodings"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "fileencodings", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fileencodings"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "fileencodings"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "fileencodings", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "fileencodings"); - }, -}; +export const fileencodings: GlobalOption = new StringOption( + "fileencodings", +); /** * This gives the `` of the current buffer, which is used for @@ -4705,42 +2439,7 @@ export const fileencodings: GlobalOption = { * (MS-Windows default: "dos", * Unix, macOS default: "unix") */ -export const fileformat: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fileformat"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "fileformat", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fileformat"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "fileformat"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "fileformat", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "fileformat"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&fileformat"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&fileformat", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&fileformat"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&fileformat", value); - }, -}; +export const fileformat: LocalOption = new StringOption("fileformat"); /** * This gives the end-of-line (``) formats that will be tried when @@ -4800,28 +2499,9 @@ export const fileformat: LocalOption = { * Vi Cygwin: "unix,dos", * Vi others: "") */ -export const fileformats: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fileformats"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "fileformats", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fileformats"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "fileformats"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "fileformats", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "fileformats"); - }, -}; +export const fileformats: GlobalOption = new StringOption( + "fileformats", +); /** * When set case is ignored when using file names and directories. @@ -4830,28 +2510,9 @@ export const fileformats: GlobalOption = { * (default on for systems where case in file * names is normally ignored) */ -export const fileignorecase: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fileignorecase"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "fileignorecase", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fileignorecase"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "fileignorecase"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "fileignorecase", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "fileignorecase"); - }, -}; +export const fileignorecase: GlobalOption = new BooleanOption( + "fileignorecase", +); /** * When this option is set, the FileType autocommand event is triggered. @@ -4878,42 +2539,7 @@ export const fileignorecase: GlobalOption = { * * (default: "") */ -export const filetype: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "filetype"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "filetype", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "filetype"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "filetype"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "filetype", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "filetype"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&filetype"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&filetype", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&filetype"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&filetype", value); - }, -}; +export const filetype: LocalOption = new StringOption("filetype"); /** * Characters to fill the statuslines, vertical separators and special @@ -4955,52 +2581,9 @@ export const filetype: LocalOption = { * * (default `"vert:|,fold:-,eob:~"`) */ -export const fillchars: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fillchars"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "fillchars", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fillchars"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "fillchars"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "fillchars", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "fillchars"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "fillchars"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "fillchars", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "fillchars"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&fillchars"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&fillchars", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&fillchars"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&fillchars", value); - }, -}; +export const fillchars: GlobalOrLocalOption = new StringOption( + "fillchars", +); /** * When writing a file and this option is on, `` at the end of file @@ -5013,42 +2596,9 @@ export const fillchars: GlobalOrLocalOption = { * * (default on) */ -export const fixendofline: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fixendofline"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "fixendofline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fixendofline"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "fixendofline"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "fixendofline", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "fixendofline"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&fixendofline"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&fixendofline", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&fixendofline"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&fixendofline", value); - }, -}; +export const fixendofline: LocalOption = new BooleanOption( + "fixendofline", +); /** * When set to "all", a fold is closed when the cursor isn't in it and @@ -5059,28 +2609,7 @@ export const fixendofline: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldclose: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldclose"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "foldclose", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldclose"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "foldclose"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "foldclose", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "foldclose"); - }, -}; +export const foldclose: GlobalOption = new StringOption("foldclose"); /** * When non-zero, a column with the specified width is shown at the side @@ -5092,42 +2621,7 @@ export const foldclose: GlobalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldcolumn: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldcolumn"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "foldcolumn", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldcolumn"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldcolumn"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "foldcolumn", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldcolumn"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldcolumn"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&foldcolumn", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldcolumn"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&foldcolumn", value); - }, -}; +export const foldcolumn: LocalOption = new NumberOption("foldcolumn"); /** * When off, all folds are open. This option can be used to quickly @@ -5142,42 +2636,7 @@ export const foldcolumn: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldenable: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldenable"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "foldenable", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldenable"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldenable"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "foldenable", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldenable"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldenable"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&foldenable", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldenable"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&foldenable", value); - }, -}; +export const foldenable: LocalOption = new BooleanOption("foldenable"); /** * The expression used for when 'foldmethod' is "expr". It is evaluated @@ -5197,42 +2656,7 @@ export const foldenable: LocalOption = { * * *not available when compiled without the `+folding` or `+eval` features* */ -export const foldexpr: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "foldexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldexpr"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldexpr"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "foldexpr", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldexpr"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldexpr"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&foldexpr", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldexpr"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&foldexpr", value); - }, -}; +export const foldexpr: LocalOption = new StringOption("foldexpr"); /** * Used only when 'foldmethod' is "indent". Lines starting with @@ -5244,42 +2668,7 @@ export const foldexpr: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldignore: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldignore"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "foldignore", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldignore"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldignore"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "foldignore", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldignore"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldignore"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&foldignore", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldignore"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&foldignore", value); - }, -}; +export const foldignore: LocalOption = new StringOption("foldignore"); /** * Sets the fold level: Folds with a higher level will be closed. @@ -5292,42 +2681,7 @@ export const foldignore: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldlevel: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldlevel"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "foldlevel", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldlevel"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldlevel"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "foldlevel", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldlevel"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldlevel"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&foldlevel", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldlevel"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&foldlevel", value); - }, -}; +export const foldlevel: LocalOption = new NumberOption("foldlevel"); /** * Sets 'foldlevel' when starting to edit another buffer in a window. @@ -5344,28 +2698,9 @@ export const foldlevel: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldlevelstart: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldlevelstart"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "foldlevelstart", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldlevelstart"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "foldlevelstart"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "foldlevelstart", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "foldlevelstart"); - }, -}; +export const foldlevelstart: GlobalOption = new NumberOption( + "foldlevelstart", +); /** * The start and end marker used when 'foldmethod' is "marker". There @@ -5377,42 +2712,7 @@ export const foldlevelstart: GlobalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldmarker: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldmarker"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "foldmarker", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldmarker"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldmarker"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "foldmarker", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldmarker"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldmarker"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&foldmarker", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldmarker"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&foldmarker", value); - }, -}; +export const foldmarker: LocalOption = new StringOption("foldmarker"); /** * The kind of folding used for the current window. Possible values: @@ -5427,42 +2727,7 @@ export const foldmarker: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldmethod: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldmethod"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "foldmethod", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldmethod"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldmethod"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "foldmethod", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldmethod"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldmethod"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&foldmethod", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldmethod"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&foldmethod", value); - }, -}; +export const foldmethod: LocalOption = new StringOption("foldmethod"); /** * Sets the number of screen lines above which a fold can be displayed @@ -5477,42 +2742,9 @@ export const foldmethod: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldminlines: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldminlines"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "foldminlines", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldminlines"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldminlines"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "foldminlines", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldminlines"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldminlines"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&foldminlines", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldminlines"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&foldminlines", value); - }, -}; +export const foldminlines: LocalOption = new NumberOption( + "foldminlines", +); /** * Sets the maximum nesting of folds for the "indent" and "syntax" @@ -5523,42 +2755,7 @@ export const foldminlines: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldnestmax: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldnestmax"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "foldnestmax", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldnestmax"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldnestmax"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "foldnestmax", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldnestmax"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldnestmax"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&foldnestmax", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldnestmax"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&foldnestmax", value); - }, -}; +export const foldnestmax: LocalOption = new NumberOption("foldnestmax"); /** * Specifies for which type of commands folds will be opened, if the @@ -5597,28 +2794,7 @@ export const foldnestmax: LocalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldopen: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldopen"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "foldopen", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldopen"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "foldopen"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "foldopen", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "foldopen"); - }, -}; +export const foldopen: GlobalOption = new StringOption("foldopen"); /** * An expression which is used to specify the text displayed for a closed @@ -5637,42 +2813,7 @@ export const foldopen: GlobalOption = { * * *not available when compiled without the `+folding` feature* */ -export const foldtext: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "foldtext"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "foldtext", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "foldtext"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "foldtext"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "foldtext", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "foldtext"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&foldtext"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&foldtext", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&foldtext"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&foldtext", value); - }, -}; +export const foldtext: LocalOption = new StringOption("foldtext"); /** * Expression which is evaluated to format a range of lines for the `gq` @@ -5724,42 +2865,7 @@ export const foldtext: LocalOption = { * * *not available when compiled without the `+eval` feature* */ -export const formatexpr: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "formatexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "formatexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "formatexpr"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "formatexpr"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "formatexpr", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "formatexpr"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&formatexpr"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&formatexpr", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&formatexpr"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&formatexpr", value); - }, -}; +export const formatexpr: LocalOption = new StringOption("formatexpr"); /** * A pattern that is used to recognize a list header. This is used for @@ -5774,42 +2880,9 @@ export const formatexpr: LocalOption = { * * (default: "^\s*\d\+[\]:.)}\t ]\s*") */ -export const formatlistpat: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "formatlistpat"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "formatlistpat", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "formatlistpat"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "formatlistpat"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "formatlistpat", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "formatlistpat"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&formatlistpat"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&formatlistpat", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&formatlistpat"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&formatlistpat", value); - }, -}; +export const formatlistpat: LocalOption = new StringOption( + "formatlistpat", +); /** * This is a sequence of letters which describes how automatic @@ -5824,42 +2897,9 @@ export const formatlistpat: LocalOption = { * * (Vim default: "tcq", Vi default: "vt") */ -export const formatoptions: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "formatoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "formatoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "formatoptions"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "formatoptions"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "formatoptions", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "formatoptions"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&formatoptions"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&formatoptions", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&formatoptions"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&formatoptions", value); - }, -}; +export const formatoptions: LocalOption = new StringOption( + "formatoptions", +); /** * The name of an external program that will be used to format the lines @@ -5876,52 +2916,9 @@ export const formatoptions: LocalOption = { * * (default "") */ -export const formatprg: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "formatprg"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "formatprg", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "formatprg"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "formatprg"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "formatprg", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "formatprg"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "formatprg"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "formatprg", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "formatprg"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&formatprg"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&formatprg", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&formatprg"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&formatprg", value); - }, -}; +export const formatprg: GlobalOrLocalOption = new StringOption( + "formatprg", +); /** * When on, the library function fsync() will be called after writing a @@ -5940,28 +2937,7 @@ export const formatprg: GlobalOrLocalOption = { * * (default on) */ -export const fsync: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fsync"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "fsync", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fsync"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "fsync"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "fsync", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "fsync"); - }, -}; +export const fsync: GlobalOption = new BooleanOption("fsync"); /** * When on, the ":substitute" flag 'g' is default on. This means that @@ -5982,28 +2958,7 @@ export const fsync: GlobalOption = { * * (default off) */ -export const gdefault: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "gdefault"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "gdefault", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "gdefault"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "gdefault"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "gdefault", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "gdefault"); - }, -}; +export const gdefault: GlobalOption = new BooleanOption("gdefault"); /** * Format to recognize for the ":grep" command output. @@ -6012,28 +2967,7 @@ export const gdefault: GlobalOption = { * * (default "%f:%l:%m,%f:%l%m,%f %l%m") */ -export const grepformat: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "grepformat"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "grepformat", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "grepformat"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "grepformat"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "grepformat", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "grepformat"); - }, -}; +export const grepformat: GlobalOption = new StringOption("grepformat"); /** * Program to use for the `:grep` command. This option may contain '%' @@ -6061,52 +2995,7 @@ export const grepformat: GlobalOption = { * Win32: "findstr /n" or "grep -n", * VMS: "SEARCH/NUMBERS ") */ -export const grepprg: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "grepprg"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "grepprg", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "grepprg"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "grepprg"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "grepprg", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "grepprg"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "grepprg"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "grepprg", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "grepprg"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&grepprg"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&grepprg", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&grepprg"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&grepprg", value); - }, -}; +export const grepprg: GlobalOrLocalOption = new StringOption("grepprg"); /** * This option tells Vim what the cursor should look like in different @@ -6194,28 +3083,7 @@ export const grepprg: GlobalOrLocalOption = { * * *only available when compiled with GUI enabled, and for Win32 console* */ -export const guicursor: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guicursor"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guicursor", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guicursor"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guicursor"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guicursor", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guicursor"); - }, -}; +export const guicursor: GlobalOption = new StringOption("guicursor"); /** * This is a list of fonts which will be used for the GUI version of Vim. @@ -6226,28 +3094,7 @@ export const guicursor: GlobalOption = { * * *only available when compiled with GUI enabled* */ -export const guifont: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guifont"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guifont", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guifont"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guifont"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guifont", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guifont"); - }, -}; +export const guifont: GlobalOption = new StringOption("guifont"); /** * When not empty, specifies a comma-separated list of fonts to be used @@ -6258,28 +3105,9 @@ export const guifont: GlobalOption = { * * *only available when compiled with GUI enabled* */ -export const guifontwide: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guifontwide"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guifontwide", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guifontwide"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guifontwide"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guifontwide", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guifontwide"); - }, -}; +export const guifontwide: GlobalOption = new StringOption( + "guifontwide", +); /** * This option only has an effect in the GUI version of Vim. It is a @@ -6413,28 +3241,7 @@ export const guifontwide: GlobalOption = { * * *only available when compiled with GUI enabled* */ -export const guioptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guioptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guioptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guioptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guioptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guioptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guioptions"); - }, -}; +export const guioptions: GlobalOption = new StringOption("guioptions"); /** * When non-empty describes the text to use in a label of the GUI tab @@ -6455,28 +3262,9 @@ export const guioptions: GlobalOption = { * * *only available when compiled with GUI enabled* */ -export const guitablabel: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guitablabel"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guitablabel", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guitablabel"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guitablabel"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guitablabel", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guitablabel"); - }, -}; +export const guitablabel: GlobalOption = new StringOption( + "guitablabel", +); /** * When non-empty describes the text to use in a tooltip for the GUI tab @@ -6490,28 +3278,9 @@ export const guitablabel: GlobalOption = { * * *only available when compiled with GUI enabled* */ -export const guitabtooltip: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guitabtooltip"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guitabtooltip", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guitabtooltip"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guitabtooltip"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guitabtooltip", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guitabtooltip"); - }, -}; +export const guitabtooltip: GlobalOption = new StringOption( + "guitabtooltip", +); /** * Name of the main help file. All distributed help files should be @@ -6527,28 +3296,7 @@ export const guitabtooltip: GlobalOption = { * (default (MS-Windows) "$VIMRUNTIME\doc\help.txt" * (others) "$VIMRUNTIME/doc/help.txt") */ -export const helpfile: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "helpfile"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "helpfile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "helpfile"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "helpfile"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "helpfile", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "helpfile"); - }, -}; +export const helpfile: GlobalOption = new StringOption("helpfile"); /** * Minimal initial height of the help window when it is opened with the @@ -6559,28 +3307,7 @@ export const helpfile: GlobalOption = { * * (default 20) */ -export const helpheight: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "helpheight"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "helpheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "helpheight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "helpheight"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "helpheight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "helpheight"); - }, -}; +export const helpheight: GlobalOption = new NumberOption("helpheight"); /** * Comma-separated list of languages. Vim will use the first language @@ -6602,28 +3329,7 @@ export const helpheight: GlobalOption = { * * *only available when compiled with the `+multi_lang` feature* */ -export const helplang: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "helplang"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "helplang", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "helplang"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "helplang"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "helplang", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "helplang"); - }, -}; +export const helplang: GlobalOption = new StringOption("helplang"); /** * When off a buffer is unloaded when it is `abandon`ed. When on a @@ -6644,28 +3350,7 @@ export const helplang: GlobalOption = { * * (default off) */ -export const hidden: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "hidden"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "hidden", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "hidden"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "hidden"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "hidden", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "hidden"); - }, -}; +export const hidden: GlobalOption = new BooleanOption("hidden"); /** * A history of ":" commands, and a history of previous search patterns @@ -6678,28 +3363,7 @@ export const hidden: GlobalOption = { * (Vim default: 50, Vi default: 0, * set to 200 in `defaults.vim`) */ -export const history: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "history"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "history", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "history"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "history"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "history", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "history"); - }, -}; +export const history: GlobalOption = new NumberOption("history"); /** * When there is a previous search pattern, highlight all its matches. @@ -6726,28 +3390,7 @@ export const history: GlobalOption = { * * *not available when compiled without the `+extra_search` feature* */ -export const hlsearch: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "hlsearch"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "hlsearch", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "hlsearch"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "hlsearch"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "hlsearch", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "hlsearch"); - }, -}; +export const hlsearch: GlobalOption = new BooleanOption("hlsearch"); /** * When on, the icon text of the window will be set to the value of @@ -6765,28 +3408,7 @@ export const hlsearch: GlobalOption = { * * (default off, on when title can be restored) */ -export const icon: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "icon"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "icon", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "icon"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "icon"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "icon", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "icon"); - }, -}; +export const icon: GlobalOption = new BooleanOption("icon"); /** * When this option is not empty, it will be used for the icon text of @@ -6804,28 +3426,7 @@ export const icon: GlobalOption = { * * (default "") */ -export const iconstring: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "iconstring"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "iconstring", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "iconstring"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "iconstring"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "iconstring", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "iconstring"); - }, -}; +export const iconstring: GlobalOption = new StringOption("iconstring"); /** * Ignore case in search patterns, `cmdline-completion`, when @@ -6836,28 +3437,9 @@ export const iconstring: GlobalOption = { * * (default off) */ -export const ignorecase: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ignorecase"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "ignorecase", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ignorecase"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ignorecase"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "ignorecase", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ignorecase"); - }, -}; +export const ignorecase: GlobalOption = new BooleanOption( + "ignorecase", +); /** * When set the Input Method is always on when starting to edit a command @@ -6868,28 +3450,7 @@ export const ignorecase: GlobalOption = { * * (default off) */ -export const imcmdline: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "imcmdline"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "imcmdline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "imcmdline"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "imcmdline"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "imcmdline", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "imcmdline"); - }, -}; +export const imcmdline: GlobalOption = new BooleanOption("imcmdline"); /** * When set the Input Method is never used. This is useful to disable @@ -6899,28 +3460,7 @@ export const imcmdline: GlobalOption = { * * (default off, on for some systems (SGI)) */ -export const imdisable: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "imdisable"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "imdisable", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "imdisable"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "imdisable"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "imdisable", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "imdisable"); - }, -}; +export const imdisable: GlobalOption = new BooleanOption("imdisable"); /** * Specifies whether :lmap or an Input Method (IM) is to be used in @@ -6948,42 +3488,7 @@ export const imdisable: GlobalOption = { * * (default 0) */ -export const iminsert: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "iminsert"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "iminsert", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "iminsert"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "iminsert"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "iminsert", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "iminsert"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&iminsert"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&iminsert", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&iminsert"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&iminsert", value); - }, -}; +export const iminsert: LocalOption = new NumberOption("iminsert"); /** * Specifies whether :lmap or an Input Method (IM) is to be used when @@ -7002,42 +3507,7 @@ export const iminsert: LocalOption = { * * (default -1) */ -export const imsearch: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "imsearch"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "imsearch", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "imsearch"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "imsearch"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "imsearch", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "imsearch"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&imsearch"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&imsearch", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&imsearch"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&imsearch", value); - }, -}; +export const imsearch: LocalOption = new NumberOption("imsearch"); /** * Pattern to be used to find an include command. It is a search @@ -7056,52 +3526,7 @@ export const imsearch: LocalOption = { * * *not available when compiled without the `+find_in_path` feature* */ -export const include: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "include"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "include", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "include"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "include"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "include", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "include"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "include"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "include", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "include"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&include"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&include", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&include"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&include", value); - }, -}; +export const include: GlobalOrLocalOption = new StringOption("include"); /** * Expression to be used to transform the string found with the 'include' @@ -7143,42 +3568,7 @@ export const include: GlobalOrLocalOption = { * * *not available when compiled without the `+find_in_path` or `+eval` features* */ -export const includeexpr: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "includeexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "includeexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "includeexpr"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "includeexpr"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "includeexpr", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "includeexpr"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&includeexpr"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&includeexpr", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&includeexpr"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&includeexpr", value); - }, -}; +export const includeexpr: LocalOption = new StringOption("includeexpr"); /** * While typing a search command, show where the pattern, as it was typed @@ -7234,28 +3624,7 @@ export const includeexpr: LocalOption = { * * *not available when compiled without the `+extra_search` features* */ -export const incsearch: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "incsearch"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "incsearch", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "incsearch"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "incsearch"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "incsearch", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "incsearch"); - }, -}; +export const incsearch: GlobalOption = new BooleanOption("incsearch"); /** * Expression which is evaluated to obtain the proper indent for a line. @@ -7309,42 +3678,7 @@ export const incsearch: GlobalOption = { * * *not available when compiled without the `+eval` feature* */ -export const indentexpr: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "indentexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "indentexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "indentexpr"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "indentexpr"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "indentexpr", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "indentexpr"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&indentexpr"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&indentexpr", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&indentexpr"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&indentexpr", value); - }, -}; +export const indentexpr: LocalOption = new StringOption("indentexpr"); /** * A list of keys that, when typed in Insert mode, cause reindenting of @@ -7354,42 +3688,7 @@ export const indentexpr: LocalOption = { * * (default "0**{,0}**,0),0],:,0#,!^F,o,O,e") */ -export const indentkeys: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "indentkeys"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "indentkeys", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "indentkeys"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "indentkeys"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "indentkeys", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "indentkeys"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&indentkeys"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&indentkeys", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&indentkeys"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&indentkeys", value); - }, -}; +export const indentkeys: LocalOption = new StringOption("indentkeys"); /** * When doing keyword completion in insert mode `ins-completion`, and @@ -7403,42 +3702,7 @@ export const indentkeys: LocalOption = { * * (default off) */ -export const infercase: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "infercase"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "infercase", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "infercase"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "infercase"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "infercase", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "infercase"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&infercase"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&infercase", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&infercase"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&infercase", value); - }, -}; +export const infercase: LocalOption = new BooleanOption("infercase"); /** * The characters specified by this option are included in file names and @@ -7494,28 +3758,7 @@ export const infercase: LocalOption = { * for OS/390: `"@,240-249,/,.,-,_,+,,,#,$,%,~,="` * otherwise: `"@,48-57,/,.,-,_,+,,,#,$,%,~,="`) */ -export const isfname: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "isfname"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "isfname", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "isfname"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "isfname"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "isfname", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "isfname"); - }, -}; +export const isfname: GlobalOption = new StringOption("isfname"); /** * The characters given by this option are included in identifiers. @@ -7531,28 +3774,7 @@ export const isfname: GlobalOption = { * "@,48-57,_,128-167,224-235" * otherwise: "@,48-57,_,192-255") */ -export const isident: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "isident"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "isident", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "isident"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "isident"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "isident", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "isident"); - }, -}; +export const isident: GlobalOption = new StringOption("isident"); /** * Keywords are used in searching and recognizing with many commands: @@ -7575,42 +3797,7 @@ export const isident: GlobalOption = { * otherwise: "@,48-57,_,192-255" * Vi default: "@,48-57,_") */ -export const iskeyword: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "iskeyword"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "iskeyword", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "iskeyword"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "iskeyword"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "iskeyword", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "iskeyword"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&iskeyword"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&iskeyword", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&iskeyword"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&iskeyword", value); - }, -}; +export const iskeyword: LocalOption = new StringOption("iskeyword"); /** * The characters given by this option are displayed directly on the @@ -7643,28 +3830,7 @@ export const iskeyword: LocalOption = { * (default for Win32 and macOS: * `"@,~-255"`; otherwise: "@,161-255") */ -export const isprint: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "isprint"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "isprint", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "isprint"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "isprint"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "isprint", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "isprint"); - }, -}; +export const isprint: GlobalOption = new StringOption("isprint"); /** * Insert two spaces after a '.', '?' and '!' with a join command. @@ -7674,28 +3840,9 @@ export const isprint: GlobalOption = { * * (default on) */ -export const joinspaces: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "joinspaces"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "joinspaces", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "joinspaces"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "joinspaces"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "joinspaces", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "joinspaces"); - }, -}; +export const joinspaces: GlobalOption = new BooleanOption( + "joinspaces", +); /** * List of words that change the behavior of the `jumplist`. @@ -7707,28 +3854,9 @@ export const joinspaces: GlobalOption = { * * (default "") */ -export const jumpoptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "jumpoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "jumpoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "jumpoptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "jumpoptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "jumpoptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "jumpoptions"); - }, -}; +export const jumpoptions: GlobalOption = new StringOption( + "jumpoptions", +); /** * Name of a keyboard mapping. See `mbyte-keymap`. @@ -7741,42 +3869,7 @@ export const jumpoptions: GlobalOption = { * * *only available when compiled with the `+keymap` feature* */ -export const keymap: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "keymap"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "keymap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "keymap"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "keymap"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "keymap", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "keymap"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&keymap"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&keymap", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&keymap"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&keymap", value); - }, -}; +export const keymap: LocalOption = new StringOption("keymap"); /** * List of comma-separated words, which enable special things that keys @@ -7791,28 +3884,7 @@ export const keymap: LocalOption = { * * (default "") */ -export const keymodel: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "keymodel"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "keymodel", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "keymodel"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "keymodel"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "keymodel", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "keymodel"); - }, -}; +export const keymodel: GlobalOption = new StringOption("keymodel"); /** * Program to use for the `K` command. Environment variables are @@ -7835,52 +3907,9 @@ export const keymodel: GlobalOption = { * (default "man" or "man -s", DOS: ":help", * VMS: "help") */ -export const keywordprg: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "keywordprg"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "keywordprg", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "keywordprg"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "keywordprg"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "keywordprg", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "keywordprg"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "keywordprg"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "keywordprg", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "keywordprg"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&keywordprg"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&keywordprg", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&keywordprg"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&keywordprg", value); - }, -}; +export const keywordprg: GlobalOrLocalOption = new StringOption( + "keywordprg", +); /** * This option allows switching your keyboard into a special language @@ -7930,28 +3959,7 @@ export const keywordprg: GlobalOrLocalOption = { * * *only available when compiled with the `+langmap` feature* */ -export const langmap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "langmap"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "langmap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "langmap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "langmap"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "langmap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "langmap"); - }, -}; +export const langmap: GlobalOption = new StringOption("langmap"); /** * Language to use for menu translation. Tells which file is loaded @@ -7985,28 +3993,7 @@ export const langmap: GlobalOption = { * * *only available when compiled with the `+menu` and `+multi_lang` features* */ -export const langmenu: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "langmenu"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "langmenu", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "langmenu"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "langmenu"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "langmenu", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "langmenu"); - }, -}; +export const langmenu: GlobalOption = new StringOption("langmenu"); /** * When off, setting 'langmap' does not apply to characters resulting from @@ -8019,28 +4006,7 @@ export const langmenu: GlobalOption = { * * *only available when compiled with the `+langmap` feature* */ -export const langremap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "langremap"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "langremap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "langremap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "langremap"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "langremap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "langremap"); - }, -}; +export const langremap: GlobalOption = new BooleanOption("langremap"); /** * The value of this option influences when the last window will have a @@ -8053,28 +4019,7 @@ export const langremap: GlobalOption = { * * (default 1) */ -export const laststatus: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "laststatus"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "laststatus", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "laststatus"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "laststatus"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "laststatus", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "laststatus"); - }, -}; +export const laststatus: GlobalOption = new NumberOption("laststatus"); /** * When this option is set, the screen will not be redrawn while @@ -8087,28 +4032,9 @@ export const laststatus: GlobalOption = { * * (default off) */ -export const lazyredraw: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "lazyredraw"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "lazyredraw", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "lazyredraw"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "lazyredraw"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "lazyredraw", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "lazyredraw"); - }, -}; +export const lazyredraw: GlobalOption = new BooleanOption( + "lazyredraw", +); /** * If on, Vim will wrap long lines at a character in 'breakat' rather @@ -8125,42 +4051,7 @@ export const lazyredraw: GlobalOption = { * * *not available when compiled without the `+linebreak` feature* */ -export const linebreak: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "linebreak"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "linebreak", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "linebreak"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "linebreak"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "linebreak", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "linebreak"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&linebreak"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&linebreak", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&linebreak"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&linebreak", value); - }, -}; +export const linebreak: LocalOption = new BooleanOption("linebreak"); /** * Number of lines of the Vim window. @@ -8181,28 +4072,7 @@ export const linebreak: LocalOption = { * * (default 24 or terminal height) */ -export const lines: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "lines"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "lines", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "lines"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "lines"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "lines", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "lines"); - }, -}; +export const lines: GlobalOption = new NumberOption("lines"); /** * Number of pixel lines inserted between characters. Useful if the font @@ -8217,28 +4087,7 @@ export const lines: GlobalOption = { * * *only in the GUI* */ -export const linespace: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "linespace"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "linespace", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "linespace"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "linespace"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "linespace", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "linespace"); - }, -}; +export const linespace: GlobalOption = new NumberOption("linespace"); /** * Lisp mode: When `` is typed in insert mode set the indent for @@ -8253,42 +4102,7 @@ export const linespace: GlobalOption = { * * (default off) */ -export const lisp: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "lisp"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "lisp", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "lisp"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "lisp"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "lisp", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "lisp"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&lisp"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&lisp", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&lisp"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&lisp", value); - }, -}; +export const lisp: LocalOption = new BooleanOption("lisp"); /** * Comma-separated list of items that influence the Lisp indenting when @@ -8301,42 +4115,7 @@ export const lisp: LocalOption = { * * (default "") */ -export const lispoptions: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "lispoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "lispoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "lispoptions"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "lispoptions"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "lispoptions", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "lispoptions"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&lispoptions"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&lispoptions", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&lispoptions"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&lispoptions", value); - }, -}; +export const lispoptions: LocalOption = new StringOption("lispoptions"); /** * Comma-separated list of words that influence the Lisp indenting when @@ -8344,52 +4123,9 @@ export const lispoptions: LocalOption = { * * (default is very long) */ -export const lispwords: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "lispwords"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "lispwords", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "lispwords"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "lispwords"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "lispwords", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "lispwords"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "lispwords"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "lispwords", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "lispwords"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&lispwords"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&lispwords", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&lispwords"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&lispwords", value); - }, -}; +export const lispwords: GlobalOrLocalOption = new StringOption( + "lispwords", +); /** * List mode: By default show tabs as CTRL-I is displayed, display $ @@ -8409,42 +4145,7 @@ export const lispwords: GlobalOrLocalOption = { * * (default off) */ -export const list: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "list"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "list", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "list"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "list"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "list", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "list"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&list"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&list", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&list"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&list", value); - }, -}; +export const list: LocalOption = new BooleanOption("list"); /** * Strings to use in 'list' mode and for the `:list` command. It is a @@ -8548,52 +4249,9 @@ export const list: LocalOption = { * * (default "eol:$") */ -export const listchars: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "listchars"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "listchars", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "listchars"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "listchars"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "listchars", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "listchars"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "listchars"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "listchars", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "listchars"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&listchars"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&listchars", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&listchars"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&listchars", value); - }, -}; +export const listchars: GlobalOrLocalOption = new StringOption( + "listchars", +); /** * When on the plugin scripts are loaded when starting up `load-plugins`. @@ -8604,28 +4262,9 @@ export const listchars: GlobalOrLocalOption = { * * (default on) */ -export const loadplugins: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "loadplugins"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "loadplugins", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "loadplugins"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "loadplugins"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "loadplugins", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "loadplugins"); - }, -}; +export const loadplugins: GlobalOption = new BooleanOption( + "loadplugins", +); /** * Changes the special characters that can be used in search patterns. @@ -8640,28 +4279,7 @@ export const loadplugins: GlobalOption = { * * (default on) */ -export const magic: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "magic"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "magic", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "magic"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "magic"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "magic", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "magic"); - }, -}; +export const magic: GlobalOption = new BooleanOption("magic"); /** * Name of the errorfile for the `:make` command (see `:make_makeprg`) @@ -8680,28 +4298,7 @@ export const magic: GlobalOption = { * * *not available when compiled without the `+quickfix` feature* */ -export const makeef: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "makeef"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "makeef", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "makeef"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "makeef"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "makeef", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "makeef"); - }, -}; +export const makeef: GlobalOption = new StringOption("makeef"); /** * Encoding used for reading the output of external commands. When empty, @@ -8720,52 +4317,9 @@ export const makeef: GlobalOption = { * * (default "") */ -export const makeencoding: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "makeencoding"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "makeencoding", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "makeencoding"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "makeencoding"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "makeencoding", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "makeencoding"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "makeencoding"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "makeencoding", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "makeencoding"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&makeencoding"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&makeencoding", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&makeencoding"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&makeencoding", value); - }, -}; +export const makeencoding: GlobalOrLocalOption = new StringOption( + "makeencoding", +); /** * Program to use for the ":make" command. See `:make_makeprg`. @@ -8790,52 +4344,7 @@ export const makeencoding: GlobalOrLocalOption = { * * (default "make", VMS: "MMS") */ -export const makeprg: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "makeprg"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "makeprg", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "makeprg"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "makeprg"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "makeprg", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "makeprg"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "makeprg"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "makeprg", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "makeprg"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&makeprg"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&makeprg", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&makeprg"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&makeprg", value); - }, -}; +export const makeprg: GlobalOrLocalOption = new StringOption("makeprg"); /** * Characters that form pairs. The `%` command jumps from one to the @@ -8858,42 +4367,7 @@ export const makeprg: GlobalOrLocalOption = { * * (default "(:),**{:}**,[:]") */ -export const matchpairs: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "matchpairs"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "matchpairs", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "matchpairs"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "matchpairs"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "matchpairs", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "matchpairs"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&matchpairs"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&matchpairs", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&matchpairs"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&matchpairs", value); - }, -}; +export const matchpairs: LocalOption = new StringOption("matchpairs"); /** * Tenths of a second to show the matching paren, when 'showmatch' is @@ -8902,28 +4376,7 @@ export const matchpairs: LocalOption = { * * (default 5) */ -export const matchtime: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "matchtime"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "matchtime", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "matchtime"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "matchtime"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "matchtime", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "matchtime"); - }, -}; +export const matchtime: GlobalOption = new NumberOption("matchtime"); /** * Maximum depth of function calls for user functions. This normally @@ -8939,28 +4392,9 @@ export const matchtime: GlobalOption = { * * *not available when compiled without the `+eval` feature* */ -export const maxfuncdepth: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "maxfuncdepth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "maxfuncdepth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "maxfuncdepth"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "maxfuncdepth"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "maxfuncdepth", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "maxfuncdepth"); - }, -}; +export const maxfuncdepth: GlobalOption = new NumberOption( + "maxfuncdepth", +); /** * Maximum number of times a mapping is done without resulting in a @@ -8971,28 +4405,9 @@ export const maxfuncdepth: GlobalOption = { * * (default 1000) */ -export const maxmapdepth: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "maxmapdepth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "maxmapdepth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "maxmapdepth"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "maxmapdepth"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "maxmapdepth", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "maxmapdepth"); - }, -}; +export const maxmapdepth: GlobalOption = new NumberOption( + "maxmapdepth", +); /** * Maximum amount of memory (in Kbyte) to use for pattern matching. @@ -9010,28 +4425,9 @@ export const maxmapdepth: GlobalOption = { * * (default 1000) */ -export const maxmempattern: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "maxmempattern"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "maxmempattern", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "maxmempattern"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "maxmempattern"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "maxmempattern", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "maxmempattern"); - }, -}; +export const maxmempattern: GlobalOption = new NumberOption( + "maxmempattern", +); /** * Maximum number of items to use in a menu. Used for menus that are @@ -9042,28 +4438,7 @@ export const maxmempattern: GlobalOption = { * * *not available when compiled without the `+menu` feature* */ -export const menuitems: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "menuitems"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "menuitems", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "menuitems"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "menuitems"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "menuitems", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "menuitems"); - }, -}; +export const menuitems: GlobalOption = new NumberOption("menuitems"); /** * Parameters for `:mkspell`. This tunes when to start compressing the @@ -9108,28 +4483,7 @@ export const menuitems: GlobalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const mkspellmem: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mkspellmem"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "mkspellmem", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mkspellmem"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mkspellmem"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "mkspellmem", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mkspellmem"); - }, -}; +export const mkspellmem: GlobalOption = new StringOption("mkspellmem"); /** * If 'modeline' is on 'modelines' gives the number of lines that is @@ -9139,42 +4493,7 @@ export const mkspellmem: GlobalOption = { * (Vim default: on (off for root), * Vi default: off) */ -export const modeline: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "modeline"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "modeline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "modeline"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "modeline"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "modeline", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "modeline"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&modeline"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&modeline", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&modeline"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&modeline", value); - }, -}; +export const modeline: LocalOption = new BooleanOption("modeline"); /** * When on allow some options that are an expression to be set in the @@ -9185,28 +4504,9 @@ export const modeline: LocalOption = { * * (default: off) */ -export const modelineexpr: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "modelineexpr"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "modelineexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "modelineexpr"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "modelineexpr"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "modelineexpr", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "modelineexpr"); - }, -}; +export const modelineexpr: GlobalOption = new BooleanOption( + "modelineexpr", +); /** * If 'modeline' is on 'modelines' gives the number of lines that is @@ -9217,28 +4517,7 @@ export const modelineexpr: GlobalOption = { * * (default 5) */ -export const modelines: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "modelines"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "modelines", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "modelines"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "modelines"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "modelines", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "modelines"); - }, -}; +export const modelines: GlobalOption = new NumberOption("modelines"); /** * When off the buffer contents cannot be changed. The 'fileformat' and @@ -9247,42 +4526,7 @@ export const modelines: GlobalOption = { * * (default on) */ -export const modifiable: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "modifiable"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "modifiable", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "modifiable"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "modifiable"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "modifiable", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "modifiable"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&modifiable"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&modifiable", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&modifiable"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&modifiable", value); - }, -}; +export const modifiable: LocalOption = new BooleanOption("modifiable"); /** * When on, the buffer is considered to be modified. This option is set @@ -9309,42 +4553,7 @@ export const modifiable: LocalOption = { * * (default off) */ -export const modified: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "modified"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "modified", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "modified"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "modified"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "modified", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "modified"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&modified"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&modified", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&modified"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&modified", value); - }, -}; +export const modified: LocalOption = new BooleanOption("modified"); /** * When on, listings pause when the whole screen is filled. You will get @@ -9355,28 +4564,7 @@ export const modified: LocalOption = { * * (Vim default: on, Vi default: off) */ -export const more: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "more"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "more", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "more"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "more"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "more", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "more"); - }, -}; +export const more: GlobalOption = new BooleanOption("more"); /** * Enable the use of the mouse. Works for most terminals (xterm, Win32 @@ -9417,28 +4605,7 @@ export const more: GlobalOption = { * (default "", "a" for GUI and Win32, * set to "a" or "nvi" in `defaults.vim`) */ -export const mouse: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mouse"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "mouse", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mouse"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mouse"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "mouse", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mouse"); - }, -}; +export const mouse: GlobalOption = new StringOption("mouse"); /** * The window that the mouse pointer is on is automatically activated. @@ -9453,28 +4620,9 @@ export const mouse: GlobalOption = { * * *only works in the GUI* */ -export const mousefocus: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mousefocus"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "mousefocus", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mousefocus"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mousefocus"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "mousefocus", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mousefocus"); - }, -}; +export const mousefocus: GlobalOption = new BooleanOption( + "mousefocus", +); /** * When on, the mouse pointer is hidden when characters are typed. @@ -9484,28 +4632,7 @@ export const mousefocus: GlobalOption = { * * *only works in the GUI* */ -export const mousehide: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mousehide"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "mousehide", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mousehide"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mousehide"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "mousehide", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mousehide"); - }, -}; +export const mousehide: GlobalOption = new BooleanOption("mousehide"); /** * Sets the model to use for the mouse. The name mostly specifies what @@ -9542,28 +4669,7 @@ export const mousehide: GlobalOption = { * * (default "extend", "popup" for Win32) */ -export const mousemodel: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mousemodel"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "mousemodel", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mousemodel"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mousemodel"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "mousemodel", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mousemodel"); - }, -}; +export const mousemodel: GlobalOption = new StringOption("mousemodel"); /** * When on, mouse move events are delivered to the input queue and are @@ -9578,28 +4684,9 @@ export const mousemodel: GlobalOption = { * * *only works in the GUI* */ -export const mousemoveevent: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mousemoveevent"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "mousemoveevent", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mousemoveevent"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mousemoveevent"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "mousemoveevent", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mousemoveevent"); - }, -}; +export const mousemoveevent: GlobalOption = new BooleanOption( + "mousemoveevent", +); /** * This option tells Vim what the mouse pointer should look like in @@ -9669,28 +4756,7 @@ export const mousemoveevent: GlobalOption = { * * *only available when compiled with the `+mouseshape` feature* */ -export const mouseshape: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mouseshape"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "mouseshape", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mouseshape"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mouseshape"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "mouseshape", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mouseshape"); - }, -}; +export const mouseshape: GlobalOption = new StringOption("mouseshape"); /** * Only for GUI, Win32 and Unix with xterm. Defines the maximum @@ -9699,28 +4765,7 @@ export const mouseshape: GlobalOption = { * * (default 500) */ -export const mousetime: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mousetime"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "mousetime", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mousetime"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mousetime"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "mousetime", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mousetime"); - }, -}; +export const mousetime: GlobalOption = new NumberOption("mousetime"); /** * This defines what bases Vim will consider for numbers when using the @@ -9753,42 +4798,7 @@ export const mousetime: GlobalOption = { * (default "bin,octal,hex", * set to "bin,hex" in `defaults.vim`) */ -export const nrformats: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "nrformats"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "nrformats", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "nrformats"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "nrformats"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "nrformats", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "nrformats"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&nrformats"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&nrformats", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&nrformats"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&nrformats", value); - }, -}; +export const nrformats: LocalOption = new StringOption("nrformats"); /** * Print the line number in front of each line. When the 'n' option is @@ -9815,42 +4825,7 @@ export const nrformats: LocalOption = { * * (default off) */ -export const number: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "number"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "number", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "number"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "number"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "number", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "number"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&number"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&number", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&number"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&number", value); - }, -}; +export const number: LocalOption = new BooleanOption("number"); /** * Minimal number of columns to use for the line number. Only relevant @@ -9870,42 +4845,7 @@ export const number: LocalOption = { * * *only available when compiled with the `+linebreak` feature* */ -export const numberwidth: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "numberwidth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "numberwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "numberwidth"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "numberwidth"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "numberwidth", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "numberwidth"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&numberwidth"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&numberwidth", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&numberwidth"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&numberwidth", value); - }, -}; +export const numberwidth: LocalOption = new NumberOption("numberwidth"); /** * This option specifies a function to be used for Insert mode omni @@ -9923,42 +4863,7 @@ export const numberwidth: LocalOption = { * * *not available when compiled without the `+eval` feature* */ -export const omnifunc: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "omnifunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "omnifunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "omnifunc"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "omnifunc"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "omnifunc", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "omnifunc"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&omnifunc"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&omnifunc", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&omnifunc"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&omnifunc", value); - }, -}; +export const omnifunc: LocalOption = new StringOption("omnifunc"); /** * *only for MS-Windows* @@ -9970,28 +4875,9 @@ export const omnifunc: LocalOption = { * * (default off) */ -export const opendevice: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "opendevice"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "opendevice", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "opendevice"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "opendevice"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "opendevice", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "opendevice"); - }, -}; +export const opendevice: GlobalOption = new BooleanOption( + "opendevice", +); /** * This option specifies a function to be called by the `g@` operator. @@ -10004,28 +4890,9 @@ export const opendevice: GlobalOption = { * * (default: empty) */ -export const operatorfunc: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "operatorfunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "operatorfunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "operatorfunc"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "operatorfunc"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "operatorfunc", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "operatorfunc"); - }, -}; +export const operatorfunc: GlobalOption = new StringOption( + "operatorfunc", +); /** * Directories used to find packages. See `packages`. @@ -10034,28 +4901,7 @@ export const operatorfunc: GlobalOption = { * * (default: see 'runtimepath') */ -export const packpath: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "packpath"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "packpath", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "packpath"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "packpath"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "packpath", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "packpath"); - }, -}; +export const packpath: GlobalOption = new StringOption("packpath"); /** * Specifies the nroff macros that separate paragraphs. These are pairs @@ -10063,28 +4909,7 @@ export const packpath: GlobalOption = { * * (default "IPLPPPQPP TPHPLIPpLpItpplpipbp") */ -export const paragraphs: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "paragraphs"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "paragraphs", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "paragraphs"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "paragraphs"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "paragraphs", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "paragraphs"); - }, -}; +export const paragraphs: GlobalOption = new StringOption("paragraphs"); /** * Expression which is evaluated to apply a patch to a file and generate @@ -10096,28 +4921,7 @@ export const paragraphs: GlobalOption = { * * *not available when compiled without the `+diff` feature* */ -export const patchexpr: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "patchexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "patchexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "patchexpr"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "patchexpr"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "patchexpr", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "patchexpr"); - }, -}; +export const patchexpr: GlobalOption = new StringOption("patchexpr"); /** * When non-empty the oldest version of a file is kept. This can be used @@ -10139,28 +4943,7 @@ export const patchexpr: GlobalOption = { * * (default "") */ -export const patchmode: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "patchmode"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "patchmode", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "patchmode"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "patchmode"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "patchmode", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "patchmode"); - }, -}; +export const patchmode: GlobalOption = new StringOption("patchmode"); /** * This is a list of directories which will be searched when using the @@ -10234,52 +5017,7 @@ export const patchmode: GlobalOption = { * (default on Unix: ".,/usr/include,," * other systems: ".,,") */ -export const path: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "path"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "path", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "path"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "path"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "path", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "path"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "path"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "path", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "path"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&path"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&path", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&path"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&path", value); - }, -}; +export const path: GlobalOrLocalOption = new StringOption("path"); /** * When changing the indent of the current line, preserve as much of the @@ -10298,42 +5036,9 @@ export const path: GlobalOrLocalOption = { * * (default off) */ -export const preserveindent: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "preserveindent"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "preserveindent", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "preserveindent"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "preserveindent"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "preserveindent", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "preserveindent"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&preserveindent"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&preserveindent", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&preserveindent"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&preserveindent", value); - }, -}; +export const preserveindent: LocalOption = new BooleanOption( + "preserveindent", +); /** * Default height for a preview window. Used for `:ptag` and associated @@ -10344,28 +5049,9 @@ export const preserveindent: LocalOption = { * * *not available when compiled without the `+quickfix` feature* */ -export const previewheight: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "previewheight"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "previewheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "previewheight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "previewheight"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "previewheight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "previewheight"); - }, -}; +export const previewheight: GlobalOption = new NumberOption( + "previewheight", +); /** * Identifies the preview window. Only one window can have this option @@ -10376,42 +5062,9 @@ export const previewheight: GlobalOption = { * * *not available when compiled without the `+quickfix` feature* */ -export const previewwindow: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "previewwindow"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "previewwindow", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "previewwindow"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "previewwindow"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "previewwindow", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "previewwindow"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&previewwindow"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&previewwindow", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&previewwindow"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&previewwindow", value); - }, -}; +export const previewwindow: LocalOption = new BooleanOption( + "previewwindow", +); /** * Determines the maximum number of items to show in the popup menu for @@ -10420,28 +5073,7 @@ export const previewwindow: LocalOption = { * * (default 0) */ -export const pumheight: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pumheight"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "pumheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pumheight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pumheight"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "pumheight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pumheight"); - }, -}; +export const pumheight: GlobalOption = new NumberOption("pumheight"); /** * Determines the minimum width to use for the popup menu for Insert mode @@ -10449,28 +5081,7 @@ export const pumheight: GlobalOption = { * * (default 15) */ -export const pumwidth: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pumwidth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "pumwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pumwidth"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pumwidth"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "pumwidth", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pumwidth"); - }, -}; +export const pumwidth: GlobalOption = new NumberOption("pumwidth"); /** * Specifies the python version used for pyx* functions and commands @@ -10499,28 +5110,7 @@ export const pumwidth: GlobalOption = { * * *only available when compiled with the `+python` or the `+python3` feature* */ -export const pyxversion: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pyxversion"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "pyxversion", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pyxversion"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pyxversion"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "pyxversion", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pyxversion"); - }, -}; +export const pyxversion: GlobalOption = new NumberOption("pyxversion"); /** * This option specifies a function to be used to get the text to display @@ -10539,28 +5129,9 @@ export const pyxversion: GlobalOption = { * * *only available when compiled with the `+quickfix` feature* */ -export const quickfixtextfunc: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "quickfixtextfunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "quickfixtextfunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "quickfixtextfunc"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "quickfixtextfunc"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "quickfixtextfunc", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "quickfixtextfunc"); - }, -}; +export const quickfixtextfunc: GlobalOption = new StringOption( + "quickfixtextfunc", +); /** * The characters that are used to escape quotes in a string. Used for @@ -10571,42 +5142,7 @@ export const quickfixtextfunc: GlobalOption = { * * (default "\") */ -export const quoteescape: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "quoteescape"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "quoteescape", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "quoteescape"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "quoteescape"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "quoteescape", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "quoteescape"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, ""eescape"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, ""eescape", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, ""eescape"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, ""eescape", value); - }, -}; +export const quoteescape: LocalOption = new StringOption("quoteescape"); /** * If on, writes fail unless you use a '!'. Protects you from @@ -10620,42 +5156,7 @@ export const quoteescape: LocalOption = { * * (default off) */ -export const readonly: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "readonly"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "readonly", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "readonly"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "readonly"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "readonly", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "readonly"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&readonly"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&readonly", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&readonly"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&readonly", value); - }, -}; +export const readonly: LocalOption = new BooleanOption("readonly"); /** * The time in milliseconds for redrawing the display. This applies to @@ -10672,28 +5173,7 @@ export const readonly: LocalOption = { * * *only available when compiled with the `+reltime` feature* */ -export const redrawtime: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "redrawtime"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "redrawtime", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "redrawtime"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "redrawtime"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "redrawtime", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "redrawtime"); - }, -}; +export const redrawtime: GlobalOption = new NumberOption("redrawtime"); /** * This selects the default regexp engine. `two-engines` @@ -10711,28 +5191,9 @@ export const redrawtime: GlobalOption = { * * (default 0) */ -export const regexpengine: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "regexpengine"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "regexpengine", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "regexpengine"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "regexpengine"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "regexpengine", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "regexpengine"); - }, -}; +export const regexpengine: GlobalOption = new NumberOption( + "regexpengine", +); /** * Show the line number relative to the line with the cursor in front of @@ -10756,42 +5217,9 @@ export const regexpengine: GlobalOption = { * * (default off) */ -export const relativenumber: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "relativenumber"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "relativenumber", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "relativenumber"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "relativenumber"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "relativenumber", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "relativenumber"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&relativenumber"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&relativenumber", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&relativenumber"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&relativenumber", value); - }, -}; +export const relativenumber: LocalOption = new BooleanOption( + "relativenumber", +); /** * Threshold for reporting number of lines changed. When the number of @@ -10802,28 +5230,7 @@ export const relativenumber: LocalOption = { * * (default 2) */ -export const report: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "report"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "report", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "report"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "report"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "report", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "report"); - }, -}; +export const report: GlobalOption = new NumberOption("report"); /** * Inserting characters in Insert mode will work backwards. See "typing @@ -10837,28 +5244,7 @@ export const report: GlobalOption = { * * *only available when compiled with the `+rightleft` feature* */ -export const revins: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "revins"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "revins", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "revins"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "revins"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "revins", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "revins"); - }, -}; +export const revins: GlobalOption = new BooleanOption("revins"); /** * When on, display orientation becomes right-to-left, i.e., characters @@ -10875,42 +5261,7 @@ export const revins: GlobalOption = { * * *only available when compiled with the `+rightleft` feature* */ -export const rightleft: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "rightleft"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "rightleft", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "rightleft"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "rightleft"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "rightleft", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "rightleft"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&rightleft"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&rightleft", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&rightleft"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&rightleft", value); - }, -}; +export const rightleft: LocalOption = new BooleanOption("rightleft"); /** * Each word in this option enables the command line editing to work in @@ -10925,42 +5276,9 @@ export const rightleft: LocalOption = { * * *only available when compiled with the `+rightleft` feature* */ -export const rightleftcmd: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "rightleftcmd"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "rightleftcmd", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "rightleftcmd"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "rightleftcmd"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "rightleftcmd", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "rightleftcmd"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&rightleftcmd"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&rightleftcmd", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&rightleftcmd"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&rightleftcmd", value); - }, -}; +export const rightleftcmd: LocalOption = new StringOption( + "rightleftcmd", +); /** * Show the line and column number of the cursor position, separated by a @@ -10989,28 +5307,7 @@ export const rightleftcmd: LocalOption = { * * (default off, set in `defaults.vim`) */ -export const ruler: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ruler"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "ruler", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ruler"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ruler"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "ruler", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ruler"); - }, -}; +export const ruler: GlobalOption = new BooleanOption("ruler"); /** * When this option is not empty, it determines the content of the ruler @@ -11028,28 +5325,9 @@ export const ruler: GlobalOption = { * * *not available when compiled without the `+statusline` feature* */ -export const rulerformat: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "rulerformat"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "rulerformat", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "rulerformat"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "rulerformat"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "rulerformat", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "rulerformat"); - }, -}; +export const rulerformat: GlobalOption = new StringOption( + "rulerformat", +); /** * This is a list of directories which will be searched for runtime @@ -11148,28 +5426,9 @@ export const rulerformat: GlobalOption = { * $VIM/vimfiles/after, * sys$login:vimfiles/after") */ -export const runtimepath: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "runtimepath"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "runtimepath", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "runtimepath"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "runtimepath"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "runtimepath", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "runtimepath"); - }, -}; +export const runtimepath: GlobalOption = new StringOption( + "runtimepath", +); /** * Number of lines to scroll with CTRL-U and CTRL-D commands. Will be @@ -11182,42 +5441,7 @@ export const runtimepath: GlobalOption = { * * (default: half the window height) */ -export const scroll: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "scroll"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "scroll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "scroll"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "scroll"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "scroll", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "scroll"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&scroll"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&scroll", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&scroll"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&scroll", value); - }, -}; +export const scroll: LocalOption = new NumberOption("scroll"); /** * See also `scroll-binding`. When this option is set, scrolling the @@ -11232,42 +5456,7 @@ export const scroll: LocalOption = { * * (default off) */ -export const scrollbind: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "scrollbind"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "scrollbind", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "scrollbind"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "scrollbind"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "scrollbind", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "scrollbind"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&scrollbind"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&scrollbind", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&scrollbind"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&scrollbind", value); - }, -}; +export const scrollbind: LocalOption = new BooleanOption("scrollbind"); /** * Minimal number of lines to scroll when the cursor gets off the @@ -11280,28 +5469,7 @@ export const scrollbind: LocalOption = { * * (default 1) */ -export const scrolljump: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "scrolljump"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "scrolljump", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "scrolljump"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "scrolljump"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "scrolljump", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "scrolljump"); - }, -}; +export const scrolljump: GlobalOption = new NumberOption("scrolljump"); /** * Minimal number of screen lines to keep above and below the cursor. @@ -11320,52 +5488,9 @@ export const scrolljump: GlobalOption = { * * (default 0, set to 5 in `defaults.vim`) */ -export const scrolloff: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "scrolloff"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "scrolloff", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "scrolloff"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "scrolloff"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "scrolloff", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "scrolloff"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "scrolloff"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "scrolloff", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "scrolloff"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&scrolloff"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&scrolloff", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&scrolloff"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&scrolloff", value); - }, -}; +export const scrolloff: GlobalOrLocalOption = new NumberOption( + "scrolloff", +); /** * This is a comma-separated list of words that specifies how @@ -11398,28 +5523,7 @@ export const scrolloff: GlobalOrLocalOption = { * * (default "ver,jump") */ -export const scrollopt: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "scrollopt"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "scrollopt", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "scrollopt"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "scrollopt"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "scrollopt", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "scrollopt"); - }, -}; +export const scrollopt: GlobalOption = new StringOption("scrollopt"); /** * Specifies the nroff macros that separate sections. These are pairs of @@ -11428,28 +5532,7 @@ export const scrollopt: GlobalOption = { * * (default "SHNHH HUnhsh") */ -export const sections: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "sections"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "sections", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "sections"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "sections"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "sections", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "sections"); - }, -}; +export const sections: GlobalOption = new StringOption("sections"); /** * This option defines the behavior of the selection. It is only used @@ -11474,28 +5557,7 @@ export const sections: GlobalOption = { * * (default "inclusive") */ -export const selection: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "selection"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "selection", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "selection"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "selection"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "selection", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "selection"); - }, -}; +export const selection: GlobalOption = new StringOption("selection"); /** * This is a comma-separated list of words, which specifies when to start @@ -11509,28 +5571,7 @@ export const selection: GlobalOption = { * * (default "") */ -export const selectmode: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "selectmode"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "selectmode", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "selectmode"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "selectmode"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "selectmode", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "selectmode"); - }, -}; +export const selectmode: GlobalOption = new StringOption("selectmode"); /** * Changes the effect of the `:mksession` command. It is a comma @@ -11582,28 +5623,9 @@ export const selectmode: GlobalOption = { * * *not available when compiled without the `+mksession` feature* */ -export const sessionoptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "sessionoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "sessionoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "sessionoptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "sessionoptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "sessionoptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "sessionoptions"); - }, -}; +export const sessionoptions: GlobalOption = new StringOption( + "sessionoptions", +); /** * Name of the shell to use for ! and :! commands. When changing the @@ -11648,28 +5670,7 @@ export const sessionoptions: GlobalOption = { * * (default $SHELL or "sh", Win32: "cmd.exe") */ -export const shell: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shell"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shell", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shell"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shell"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shell", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shell"); - }, -}; +export const shell: GlobalOption = new StringOption("shell"); /** * Flag passed to the shell to execute "!" and ":!" commands; e.g., @@ -11688,28 +5689,9 @@ export const shell: GlobalOption = { * "-Command", or when it does not contain "sh" * somewhere: "/c") */ -export const shellcmdflag: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shellcmdflag"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shellcmdflag", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shellcmdflag"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shellcmdflag"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shellcmdflag", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shellcmdflag"); - }, -}; +export const shellcmdflag: GlobalOption = new StringOption( + "shellcmdflag", +); /** * String to be used to put the output of the ":make" command in the @@ -11751,28 +5733,7 @@ export const shellcmdflag: GlobalOption = { * * *not available when compiled without the `+quickfix` feature* */ -export const shellpipe: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shellpipe"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shellpipe", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shellpipe"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shellpipe"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shellpipe", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shellpipe"); - }, -}; +export const shellpipe: GlobalOption = new StringOption("shellpipe"); /** * Quoting character(s), put around the command passed to the shell, for @@ -11787,28 +5748,7 @@ export const shellpipe: GlobalOption = { * * (default: "") */ -export const shellquote: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shellquote"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shellquote", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shellquote"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shellquote"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shellquote", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shellquote"); - }, -}; +export const shellquote: GlobalOption = new StringOption("shellquote"); /** * String to be used to put the output of a filter command in a temporary @@ -11838,28 +5778,7 @@ export const shellquote: GlobalOption = { * (default ">", ">&", ">%s 2>&1", or * "2>&1 | Out-File -Encoding default") */ -export const shellredir: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shellredir"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shellredir", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shellredir"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shellredir"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shellredir", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shellredir"); - }, -}; +export const shellredir: GlobalOption = new StringOption("shellredir"); /** * When set, a forward slash is used when expanding file names. This is @@ -11880,28 +5799,9 @@ export const shellredir: GlobalOption = { * * *only for MS-Windows* */ -export const shellslash: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shellslash"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "shellslash", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shellslash"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shellslash"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "shellslash", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shellslash"); - }, -}; +export const shellslash: GlobalOption = new BooleanOption( + "shellslash", +); /** * When on, use temp files for shell commands. When off use a pipe. @@ -11925,28 +5825,7 @@ export const shellslash: GlobalOption = { * * (Vi default off, Vim default on) */ -export const shelltemp: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shelltemp"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "shelltemp", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shelltemp"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shelltemp"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "shelltemp", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shelltemp"); - }, -}; +export const shelltemp: GlobalOption = new BooleanOption("shelltemp"); /** * When 'shellxquote' is set to "(" then the characters listed in this @@ -11958,28 +5837,9 @@ export const shelltemp: GlobalOption = { * (default: ""; * for MS-Windows: `"\"&|<>()@^"`) */ -export const shellxescape: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shellxescape"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shellxescape", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shellxescape"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shellxescape"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shellxescape", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shellxescape"); - }, -}; +export const shellxescape: GlobalOption = new StringOption( + "shellxescape", +); /** * Quoting character(s), put around the command passed to the shell, for @@ -12007,28 +5867,9 @@ export const shellxescape: GlobalOption = { * somewhere: "\"" * for Unix, when using system(): "\"") */ -export const shellxquote: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shellxquote"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shellxquote", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shellxquote"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shellxquote"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shellxquote", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shellxquote"); - }, -}; +export const shellxquote: GlobalOption = new StringOption( + "shellxquote", +); /** * Round indent to multiple of 'shiftwidth'. Applies to > and < @@ -12038,28 +5879,9 @@ export const shellxquote: GlobalOption = { * * (default off) */ -export const shiftround: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shiftround"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "shiftround", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shiftround"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shiftround"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "shiftround", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shiftround"); - }, -}; +export const shiftround: GlobalOption = new BooleanOption( + "shiftround", +); /** * Number of spaces to use for each step of (auto)indent. Used for @@ -12069,42 +5891,7 @@ export const shiftround: GlobalOption = { * * (default 8) */ -export const shiftwidth: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shiftwidth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "shiftwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shiftwidth"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "shiftwidth"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "shiftwidth", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "shiftwidth"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&shiftwidth"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&shiftwidth", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&shiftwidth"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&shiftwidth", value); - }, -}; +export const shiftwidth: LocalOption = new NumberOption("shiftwidth"); /** * This option helps to avoid all the `hit-enter` prompts caused by file @@ -12171,28 +5958,7 @@ export const shiftwidth: LocalOption = { * (Vim default "filnxtToOS", Vi default: "S", * POSIX default: "AS") */ -export const shortmess: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shortmess"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shortmess", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shortmess"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shortmess"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shortmess", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shortmess"); - }, -}; +export const shortmess: GlobalOption = new StringOption("shortmess"); /** * String to put at the start of lines that have been wrapped. Useful @@ -12222,52 +5988,9 @@ export const shortmess: GlobalOption = { * * *not available when compiled without the `+linebreak` feature* */ -export const showbreak: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "showbreak"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "showbreak", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "showbreak"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "showbreak"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "showbreak", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "showbreak"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "showbreak"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "showbreak", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "showbreak"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&showbreak"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&showbreak", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&showbreak"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&showbreak", value); - }, -}; +export const showbreak: GlobalOrLocalOption = new StringOption( + "showbreak", +); /** * Show (partial) command in the last line of the screen. Set this @@ -12287,28 +6010,7 @@ export const showbreak: GlobalOrLocalOption = { * (Vim default: on, off for Unix, * Vi default: off, set in `defaults.vim`) */ -export const showcmd: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "showcmd"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "showcmd", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "showcmd"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "showcmd"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "showcmd", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "showcmd"); - }, -}; +export const showcmd: GlobalOption = new BooleanOption("showcmd"); /** * This option can be used to display the (partially) entered command in @@ -12325,28 +6027,7 @@ export const showcmd: GlobalOption = { * * (default "last") */ -export const showcmdloc: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "showcmdloc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "showcmdloc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "showcmdloc"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "showcmdloc"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "showcmdloc", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "showcmdloc"); - }, -}; +export const showcmdloc: GlobalOption = new StringOption("showcmdloc"); /** * When completing a word in insert mode (see `ins-completion`) from the @@ -12360,28 +6041,9 @@ export const showcmdloc: GlobalOption = { * * (default off) */ -export const showfulltag: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "showfulltag"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "showfulltag", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "showfulltag"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "showfulltag"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "showfulltag", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "showfulltag"); - }, -}; +export const showfulltag: GlobalOption = new BooleanOption( + "showfulltag", +); /** * When a bracket is inserted, briefly jump to the matching one. The @@ -12404,28 +6066,7 @@ export const showfulltag: GlobalOption = { * * (default off) */ -export const showmatch: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "showmatch"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "showmatch", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "showmatch"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "showmatch"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "showmatch", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "showmatch"); - }, -}; +export const showmatch: GlobalOption = new BooleanOption("showmatch"); /** * If in Insert, Replace or Visual mode put a message on the last line. @@ -12439,28 +6080,7 @@ export const showmatch: GlobalOption = { * * (Vim default: on, Vi default: off) */ -export const showmode: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "showmode"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "showmode", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "showmode"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "showmode"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "showmode", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "showmode"); - }, -}; +export const showmode: GlobalOption = new BooleanOption("showmode"); /** * The value of this option specifies when the line with tab page labels @@ -12474,28 +6094,9 @@ export const showmode: GlobalOption = { * * (default 1) */ -export const showtabline: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "showtabline"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "showtabline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "showtabline"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "showtabline"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "showtabline", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "showtabline"); - }, -}; +export const showtabline: GlobalOption = new NumberOption( + "showtabline", +); /** * The minimal number of columns to scroll horizontally. Used only when @@ -12507,28 +6108,7 @@ export const showtabline: GlobalOption = { * * (default 0) */ -export const sidescroll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "sidescroll"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "sidescroll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "sidescroll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "sidescroll"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "sidescroll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "sidescroll"); - }, -}; +export const sidescroll: GlobalOption = new NumberOption("sidescroll"); /** * The minimal number of screen columns to keep to the left and to the @@ -12556,52 +6136,9 @@ export const sidescroll: GlobalOption = { * * (default 0) */ -export const sidescrolloff: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "sidescrolloff"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "sidescrolloff", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "sidescrolloff"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "sidescrolloff"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "sidescrolloff", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "sidescrolloff"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "sidescrolloff"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "sidescrolloff", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "sidescrolloff"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&sidescrolloff"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&sidescrolloff", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&sidescrolloff"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&sidescrolloff", value); - }, -}; +export const sidescrolloff: GlobalOrLocalOption = new NumberOption( + "sidescrolloff", +); /** * Whether or not to draw the signcolumn. Valid values are: @@ -12615,42 +6152,7 @@ export const sidescrolloff: GlobalOrLocalOption = { * * *not available when compiled without the `+signs` feature* */ -export const signcolumn: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "signcolumn"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "signcolumn", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "signcolumn"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "signcolumn"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "signcolumn", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "signcolumn"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&signcolumn"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&signcolumn", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&signcolumn"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&signcolumn", value); - }, -}; +export const signcolumn: LocalOption = new StringOption("signcolumn"); /** * Override the 'ignorecase' option if the search pattern contains upper @@ -12663,28 +6165,7 @@ export const signcolumn: LocalOption = { * * (default off) */ -export const smartcase: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "smartcase"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "smartcase", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "smartcase"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "smartcase"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "smartcase", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "smartcase"); - }, -}; +export const smartcase: GlobalOption = new BooleanOption("smartcase"); /** * Do smart autoindenting when starting a new line. Works for C-like @@ -12712,42 +6193,9 @@ export const smartcase: GlobalOption = { * * (default off) */ -export const smartindent: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "smartindent"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "smartindent", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "smartindent"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "smartindent"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "smartindent", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "smartindent"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&smartindent"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&smartindent", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&smartindent"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&smartindent", value); - }, -}; +export const smartindent: LocalOption = new BooleanOption( + "smartindent", +); /** * When on, a `` in front of a line inserts blanks according to @@ -12766,28 +6214,7 @@ export const smartindent: LocalOption = { * * (default off) */ -export const smarttab: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "smarttab"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "smarttab", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "smarttab"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "smarttab"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "smarttab", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "smarttab"); - }, -}; +export const smarttab: GlobalOption = new BooleanOption("smarttab"); /** * Scrolling works with screen lines. When 'wrap' is set and the first @@ -12800,42 +6227,9 @@ export const smarttab: GlobalOption = { * * (default off) */ -export const smoothscroll: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "smoothscroll"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "smoothscroll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "smoothscroll"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "smoothscroll"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "smoothscroll", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "smoothscroll"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&smoothscroll"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&smoothscroll", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&smoothscroll"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&smoothscroll", value); - }, -}; +export const smoothscroll: LocalOption = new BooleanOption( + "smoothscroll", +); /** * Number of spaces that a `` counts for while performing editing @@ -12860,42 +6254,7 @@ export const smoothscroll: LocalOption = { * * (default 0) */ -export const softtabstop: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "softtabstop"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "softtabstop", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "softtabstop"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "softtabstop"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "softtabstop", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "softtabstop"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&softtabstop"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&softtabstop", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&softtabstop"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&softtabstop", value); - }, -}; +export const softtabstop: LocalOption = new NumberOption("softtabstop"); /** * When on spell checking will be done. See `spell`. @@ -12905,42 +6264,7 @@ export const softtabstop: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const spell: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "spell"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "spell", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "spell"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "spell"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "spell", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "spell"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&spell"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&spell", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&spell"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&spell", value); - }, -}; +export const spell: LocalOption = new BooleanOption("spell"); /** * Pattern to locate the end of a sentence. The following word will be @@ -12957,42 +6281,9 @@ export const spell: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const spellcapcheck: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "spellcapcheck"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "spellcapcheck", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "spellcapcheck"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "spellcapcheck"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "spellcapcheck", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "spellcapcheck"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&spellcapcheck"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&spellcapcheck", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&spellcapcheck"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&spellcapcheck", value); - }, -}; +export const spellcapcheck: LocalOption = new StringOption( + "spellcapcheck", +); /** * Name of the word list file where words are added for the `zg` and `zw` @@ -13021,42 +6312,7 @@ export const spellcapcheck: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const spellfile: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "spellfile"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "spellfile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "spellfile"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "spellfile"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "spellfile", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "spellfile"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&spellfile"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&spellfile", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&spellfile"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&spellfile", value); - }, -}; +export const spellfile: LocalOption = new StringOption("spellfile"); /** * A comma-separated list of word list names. When the 'spell' option is @@ -13105,42 +6361,7 @@ export const spellfile: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const spelllang: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "spelllang"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "spelllang", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "spelllang"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "spelllang"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "spelllang", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "spelllang"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&spelllang"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&spelllang", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&spelllang"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&spelllang", value); - }, -}; +export const spelllang: LocalOption = new StringOption("spelllang"); /** * A comma-separated list of options for spell checking: @@ -13153,42 +6374,9 @@ export const spelllang: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const spelloptions: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "spelloptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "spelloptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "spelloptions"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "spelloptions"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "spelloptions", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "spelloptions"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&spelloptions"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&spelloptions", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&spelloptions"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&spelloptions", value); - }, -}; +export const spelloptions: LocalOption = new StringOption( + "spelloptions", +); /** * Methods used for spelling suggestions. Both for the `z=` command and @@ -13263,28 +6451,9 @@ export const spelloptions: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const spellsuggest: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "spellsuggest"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "spellsuggest", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "spellsuggest"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "spellsuggest"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "spellsuggest", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "spellsuggest"); - }, -}; +export const spellsuggest: GlobalOption = new StringOption( + "spellsuggest", +); /** * When on, splitting a window will put the new window below the current @@ -13292,28 +6461,9 @@ export const spellsuggest: GlobalOption = { * * (default off) */ -export const splitbelow: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "splitbelow"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "splitbelow", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "splitbelow"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "splitbelow"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "splitbelow", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "splitbelow"); - }, -}; +export const splitbelow: GlobalOption = new BooleanOption( + "splitbelow", +); /** * The value of this option determines the scroll behavior when opening, @@ -13331,28 +6481,7 @@ export const splitbelow: GlobalOption = { * * (default "cursor") */ -export const splitkeep: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "splitkeep"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "splitkeep", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "splitkeep"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "splitkeep"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "splitkeep", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "splitkeep"); - }, -}; +export const splitkeep: GlobalOption = new StringOption("splitkeep"); /** * When on, splitting a window will put the new window right of the @@ -13360,28 +6489,9 @@ export const splitkeep: GlobalOption = { * * (default off) */ -export const splitright: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "splitright"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "splitright", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "splitright"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "splitright"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "splitright", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "splitright"); - }, -}; +export const splitright: GlobalOption = new BooleanOption( + "splitright", +); /** * When "on" the commands listed below move the cursor to the first @@ -13398,28 +6508,9 @@ export const splitright: GlobalOption = { * * (default on) */ -export const startofline: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "startofline"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "startofline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "startofline"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "startofline"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "startofline", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "startofline"); - }, -}; +export const startofline: GlobalOption = new BooleanOption( + "startofline", +); /** * When non-empty, this option determines the content of the status line. @@ -13628,52 +6719,9 @@ export const startofline: GlobalOption = { * * *not available when compiled without the `+statusline` feature* */ -export const statusline: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "statusline"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "statusline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "statusline"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "statusline"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "statusline", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "statusline"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "statusline"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "statusline", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "statusline"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&statusline"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&statusline", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&statusline"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&statusline", value); - }, -}; +export const statusline: GlobalOrLocalOption = new StringOption( + "statusline", +); /** * Files with these suffixes get a lower priority when multiple files @@ -13689,28 +6737,7 @@ export const statusline: GlobalOrLocalOption = { * * (default `".bak,~,.o,.h,.info,.swp,.obj"`) */ -export const suffixes: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "suffixes"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "suffixes", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "suffixes"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "suffixes"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "suffixes", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "suffixes"); - }, -}; +export const suffixes: GlobalOption = new StringOption("suffixes"); /** * Comma-separated list of suffixes, which are used when searching for a @@ -13720,42 +6747,7 @@ export const suffixes: GlobalOption = { * * (default "") */ -export const suffixesadd: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "suffixesadd"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "suffixesadd", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "suffixesadd"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "suffixesadd"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "suffixesadd", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "suffixesadd"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&suffixesadd"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&suffixesadd", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&suffixesadd"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&suffixesadd", value); - }, -}; +export const suffixesadd: LocalOption = new StringOption("suffixesadd"); /** * Use a swapfile for the buffer. This option can be reset when a @@ -13779,42 +6771,7 @@ export const suffixesadd: LocalOption = { * * (default on) */ -export const swapfile: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "swapfile"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "swapfile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "swapfile"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "swapfile"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "swapfile", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "swapfile"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&swapfile"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&swapfile", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&swapfile"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&swapfile", value); - }, -}; +export const swapfile: LocalOption = new BooleanOption("swapfile"); /** * This option controls the behavior when switching between buffers. @@ -13847,28 +6804,7 @@ export const swapfile: LocalOption = { * * (default "") */ -export const switchbuf: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "switchbuf"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "switchbuf", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "switchbuf"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "switchbuf"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "switchbuf", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "switchbuf"); - }, -}; +export const switchbuf: GlobalOption = new StringOption("switchbuf"); /** * Maximum column in which to search for syntax items. In long lines the @@ -13882,42 +6818,7 @@ export const switchbuf: GlobalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const synmaxcol: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "synmaxcol"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "synmaxcol", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "synmaxcol"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "synmaxcol"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "synmaxcol", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "synmaxcol"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&synmaxcol"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&synmaxcol", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&synmaxcol"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&synmaxcol", value); - }, -}; +export const synmaxcol: LocalOption = new NumberOption("synmaxcol"); /** * When this option is set, the syntax with this name is loaded, unless @@ -13952,42 +6853,7 @@ export const synmaxcol: LocalOption = { * * *not available when compiled without the `+syntax` feature* */ -export const syntax: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "syntax"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "syntax", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "syntax"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "syntax"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "syntax", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "syntax"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&syntax"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&syntax", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&syntax"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&syntax", value); - }, -}; +export const syntax: LocalOption = new StringOption("syntax"); /** * When non-empty, this option determines the content of the tab pages @@ -14013,28 +6879,7 @@ export const syntax: LocalOption = { * * (default empty) */ -export const tabline: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tabline"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "tabline", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tabline"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tabline"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "tabline", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tabline"); - }, -}; +export const tabline: GlobalOption = new StringOption("tabline"); /** * Maximum number of tab pages to be opened by the `-p` command line @@ -14042,28 +6887,7 @@ export const tabline: GlobalOption = { * * (default 10) */ -export const tabpagemax: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tabpagemax"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "tabpagemax", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tabpagemax"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tabpagemax"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "tabpagemax", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tabpagemax"); - }, -}; +export const tabpagemax: GlobalOption = new NumberOption("tabpagemax"); /** * Number of spaces that a `` in the file counts for. Also see @@ -14109,42 +6933,7 @@ export const tabpagemax: GlobalOption = { * * (default 8) */ -export const tabstop: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tabstop"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "tabstop", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tabstop"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "tabstop"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "tabstop", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "tabstop"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&tabstop"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&tabstop", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&tabstop"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&tabstop", value); - }, -}; +export const tabstop: LocalOption = new NumberOption("tabstop"); /** * When searching for a tag (e.g., for the `:ta` command), Vim can either @@ -14200,28 +6989,9 @@ export const tabstop: LocalOption = { * * (default on) */ -export const tagbsearch: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tagbsearch"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "tagbsearch", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tagbsearch"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tagbsearch"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "tagbsearch", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tagbsearch"); - }, -}; +export const tagbsearch: GlobalOption = new BooleanOption( + "tagbsearch", +); /** * This option specifies how case is handled when searching the tags @@ -14236,52 +7006,7 @@ export const tagbsearch: GlobalOption = { * * (default "followic") */ -export const tagcase: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tagcase"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "tagcase", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tagcase"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tagcase"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "tagcase", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tagcase"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "tagcase"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "tagcase", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "tagcase"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&tagcase"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&tagcase", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&tagcase"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&tagcase", value); - }, -}; +export const tagcase: GlobalOrLocalOption = new StringOption("tagcase"); /** * This option specifies a function to be used to perform tag searches. @@ -14297,70 +7022,14 @@ export const tagcase: GlobalOrLocalOption = { * * *not available when compiled without the `+eval` feature* */ -export const tagfunc: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tagfunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "tagfunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tagfunc"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "tagfunc"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "tagfunc", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "tagfunc"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&tagfunc"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&tagfunc", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&tagfunc"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&tagfunc", value); - }, -}; +export const tagfunc: LocalOption = new StringOption("tagfunc"); /** * If non-zero, tags are significant up to this number of characters. * * (default 0) */ -export const taglength: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "taglength"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "taglength", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "taglength"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "taglength"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "taglength", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "taglength"); - }, -}; +export const taglength: GlobalOption = new NumberOption("taglength"); /** * If on and using a tags file in another directory, file names in that @@ -14370,28 +7039,9 @@ export const taglength: GlobalOption = { * * (Vim default: on, Vi default: off) */ -export const tagrelative: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tagrelative"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "tagrelative", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tagrelative"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tagrelative"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "tagrelative", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tagrelative"); - }, -}; +export const tagrelative: GlobalOption = new BooleanOption( + "tagrelative", +); /** * Filenames for the tag command, separated by spaces or commas. To @@ -14419,52 +7069,7 @@ export const tagrelative: GlobalOption = { * (default "./tags,tags", when compiled with * `+emacs_tags`: "./tags,./TAGS,tags,TAGS") */ -export const tags: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tags"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "tags", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tags"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tags"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "tags", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tags"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "tags"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "tags", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "tags"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&tags"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&tags", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&tags"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&tags", value); - }, -}; +export const tags: GlobalOrLocalOption = new StringOption("tags"); /** * When on, the `tagstack` is used normally. When off, a ":tag" or @@ -14477,28 +7082,7 @@ export const tags: GlobalOrLocalOption = { * * (default on) */ -export const tagstack: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tagstack"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "tagstack", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tagstack"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tagstack"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "tagstack", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tagstack"); - }, -}; +export const tagstack: GlobalOption = new BooleanOption("tagstack"); /** * The terminal is in charge of Bi-directionality of text (as specified @@ -14515,28 +7099,7 @@ export const tagstack: GlobalOption = { * * *only available when compiled with the `+arabic` feature* */ -export const termbidi: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termbidi"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "termbidi", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termbidi"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "termbidi"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "termbidi", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "termbidi"); - }, -}; +export const termbidi: GlobalOption = new BooleanOption("termbidi"); /** * When on, uses `highlight-guifg` and `highlight-guibg` attributes in @@ -14568,28 +7131,9 @@ export const termbidi: GlobalOption = { * * *not available when compiled without the `+termguicolors` feature* */ -export const termguicolors: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termguicolors"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "termguicolors", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termguicolors"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "termguicolors"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "termguicolors", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "termguicolors"); - }, -}; +export const termguicolors: GlobalOption = new BooleanOption( + "termguicolors", +); /** * Maximum width of text that is being inserted. A longer line will be @@ -14604,42 +7148,7 @@ export const termguicolors: GlobalOption = { * * (default 0) */ -export const textwidth: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "textwidth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "textwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "textwidth"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "textwidth"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "textwidth", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "textwidth"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&textwidth"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&textwidth", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&textwidth"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&textwidth", value); - }, -}; +export const textwidth: LocalOption = new NumberOption("textwidth"); /** * List of file names, separated by commas, that are used to lookup words @@ -14659,52 +7168,9 @@ export const textwidth: LocalOption = { * * (default "") */ -export const thesaurus: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "thesaurus"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "thesaurus", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "thesaurus"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "thesaurus"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "thesaurus", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "thesaurus"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "thesaurus"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "thesaurus", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "thesaurus"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&thesaurus"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&thesaurus", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&thesaurus"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&thesaurus", value); - }, -}; +export const thesaurus: GlobalOrLocalOption = new StringOption( + "thesaurus", +); /** * This option specifies a function to be used for thesaurus completion @@ -14719,52 +7185,9 @@ export const thesaurus: GlobalOrLocalOption = { * * *not available when compiled without the `+eval` feature* */ -export const thesaurusfunc: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "thesaurusfunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "thesaurusfunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "thesaurusfunc"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "thesaurusfunc"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "thesaurusfunc", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "thesaurusfunc"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "thesaurusfunc"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "thesaurusfunc", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "thesaurusfunc"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&thesaurusfunc"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&thesaurusfunc", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&thesaurusfunc"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&thesaurusfunc", value); - }, -}; +export const thesaurusfunc: GlobalOrLocalOption = new StringOption( + "thesaurusfunc", +); /** * When on: The tilde command `"~"` behaves like an operator. @@ -14772,54 +7195,12 @@ export const thesaurusfunc: GlobalOrLocalOption = { * * (default off) */ -export const tildeop: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tildeop"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "tildeop", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tildeop"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tildeop"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "tildeop", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tildeop"); - }, -}; +export const tildeop: GlobalOption = new BooleanOption("tildeop"); /** * (default on) */ -export const timeout: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "timeout"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "timeout", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "timeout"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "timeout"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "timeout", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "timeout"); - }, -}; +export const timeout: GlobalOption = new BooleanOption("timeout"); /** * These two options together determine the behavior when part of a @@ -14851,54 +7232,12 @@ export const timeout: GlobalOption = { * * (default off, set in `defaults.vim`) */ -export const ttimeout: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ttimeout"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "ttimeout", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ttimeout"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ttimeout"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "ttimeout", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ttimeout"); - }, -}; +export const ttimeout: GlobalOption = new BooleanOption("ttimeout"); /** * (default 1000) */ -export const timeoutlen: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "timeoutlen"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "timeoutlen", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "timeoutlen"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "timeoutlen"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "timeoutlen", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "timeoutlen"); - }, -}; +export const timeoutlen: GlobalOption = new NumberOption("timeoutlen"); /** * The time in milliseconds that is waited for a key code or mapped key @@ -14922,28 +7261,9 @@ export const timeoutlen: GlobalOption = { * * (default -1, set to 100 in `defaults.vim`) */ -export const ttimeoutlen: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ttimeoutlen"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "ttimeoutlen", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ttimeoutlen"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ttimeoutlen"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "ttimeoutlen", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ttimeoutlen"); - }, -}; +export const ttimeoutlen: GlobalOption = new NumberOption( + "ttimeoutlen", +); /** * When on, the title of the window will be set to the value of @@ -14981,28 +7301,7 @@ export const ttimeoutlen: GlobalOption = { * * (default off, on when title can be restored) */ -export const title: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "title"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "title", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "title"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "title"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "title", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "title"); - }, -}; +export const title: GlobalOption = new BooleanOption("title"); /** * Gives the percentage of 'columns' to use for the length of the window @@ -15017,28 +7316,7 @@ export const title: GlobalOption = { * * (default 85) */ -export const titlelen: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "titlelen"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "titlelen", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "titlelen"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "titlelen"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "titlelen", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "titlelen"); - }, -}; +export const titlelen: GlobalOption = new NumberOption("titlelen"); /** * This option will be used for the window title when exiting Vim if the @@ -15049,28 +7327,7 @@ export const titlelen: GlobalOption = { * * (default "Thanks for flying Vim") */ -export const titleold: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "titleold"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "titleold", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "titleold"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "titleold"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "titleold", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "titleold"); - }, -}; +export const titleold: GlobalOption = new StringOption("titleold"); /** * When this option is not empty, it will be used for the title of the @@ -15105,28 +7362,9 @@ export const titleold: GlobalOption = { * * (default "") */ -export const titlestring: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "titlestring"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "titlestring", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "titlestring"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "titlestring"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "titlestring", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "titlestring"); - }, -}; +export const titlestring: GlobalOption = new StringOption( + "titlestring", +); /** * List of directory names for undo files, separated with commas. @@ -15148,28 +7386,7 @@ export const titlestring: GlobalOption = { * * *only when compiled with the `+persistent_undo` feature* */ -export const undodir: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "undodir"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "undodir", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "undodir"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "undodir"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "undodir", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "undodir"); - }, -}; +export const undodir: GlobalOption = new StringOption("undodir"); /** * When on, Vim automatically saves undo history to an undo file when @@ -15186,42 +7403,7 @@ export const undodir: GlobalOption = { * * *only when compiled with the `+persistent_undo` feature* */ -export const undofile: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "undofile"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "undofile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "undofile"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "undofile"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "undofile", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "undofile"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&undofile"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&undofile", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&undofile"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&undofile", value); - }, -}; +export const undofile: LocalOption = new BooleanOption("undofile"); /** * Maximum number of changes that can be undone. Since undo information @@ -15248,52 +7430,9 @@ export const undofile: LocalOption = { * * (default 100, 1000 for Unix, VMS and Win32) */ -export const undolevels: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "undolevels"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "undolevels", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "undolevels"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "undolevels"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "undolevels", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "undolevels"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "undolevels"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "undolevels", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "undolevels"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&undolevels"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&undolevels", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&undolevels"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&undolevels", value); - }, -}; +export const undolevels: GlobalOrLocalOption = new NumberOption( + "undolevels", +); /** * Save the whole buffer for undo when reloading it. This applies to the @@ -15310,28 +7449,7 @@ export const undolevels: GlobalOrLocalOption = { * * (default 10000) */ -export const undoreload: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "undoreload"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "undoreload", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "undoreload"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "undoreload"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "undoreload", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "undoreload"); - }, -}; +export const undoreload: GlobalOption = new NumberOption("undoreload"); /** * After typing this many characters the swap file will be written to @@ -15349,28 +7467,9 @@ export const undoreload: GlobalOption = { * * (default: 200) */ -export const updatecount: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "updatecount"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "updatecount", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "updatecount"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "updatecount"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "updatecount", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "updatecount"); - }, -}; +export const updatecount: GlobalOption = new NumberOption( + "updatecount", +); /** * If this many milliseconds nothing is typed the swap file will be @@ -15379,28 +7478,7 @@ export const updatecount: GlobalOption = { * * (default 4000) */ -export const updatetime: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "updatetime"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "updatetime", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "updatetime"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "updatetime"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "updatetime", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "updatetime"); - }, -}; +export const updatetime: GlobalOption = new NumberOption("updatetime"); /** * A list of the number of spaces that a `` counts for while editing, @@ -15425,42 +7503,9 @@ export const updatetime: GlobalOption = { * * *only available when compiled with the `+vartabs` feature* */ -export const varsofttabstop: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "varsofttabstop"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "varsofttabstop", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "varsofttabstop"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "varsofttabstop"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "varsofttabstop", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "varsofttabstop"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&varsofttabstop"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&varsofttabstop", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&varsofttabstop"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&varsofttabstop", value); - }, -}; +export const varsofttabstop: LocalOption = new StringOption( + "varsofttabstop", +); /** * A list of the number of spaces that a `` in the file counts for, @@ -15479,42 +7524,7 @@ export const varsofttabstop: LocalOption = { * * *only available when compiled with the `+vartabs` feature* */ -export const vartabstop: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "vartabstop"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "vartabstop", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "vartabstop"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "vartabstop"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "vartabstop", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "vartabstop"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&vartabstop"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&vartabstop", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&vartabstop"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&vartabstop", value); - }, -}; +export const vartabstop: LocalOption = new StringOption("vartabstop"); /** * When bigger than zero, Vim will give messages about what it is doing. @@ -15541,28 +7551,7 @@ export const vartabstop: LocalOption = { * * (default 0) */ -export const verbose: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "verbose"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "verbose", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "verbose"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "verbose"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "verbose", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "verbose"); - }, -}; +export const verbose: GlobalOption = new NumberOption("verbose"); /** * When not empty all messages are written in a file with this name. @@ -15577,28 +7566,9 @@ export const verbose: GlobalOption = { * * (default empty) */ -export const verbosefile: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "verbosefile"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "verbosefile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "verbosefile"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "verbosefile"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "verbosefile", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "verbosefile"); - }, -}; +export const verbosefile: GlobalOption = new StringOption( + "verbosefile", +); /** * Name of the directory where to store files for `:mkview`. @@ -15615,28 +7585,7 @@ export const verbosefile: GlobalOption = { * * *not available when compiled without the `+mksession` feature* */ -export const viewdir: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "viewdir"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "viewdir", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "viewdir"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "viewdir"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "viewdir", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "viewdir"); - }, -}; +export const viewdir: GlobalOption = new StringOption("viewdir"); /** * Changes the effect of the `:mkview` command. It is a comma-separated @@ -15662,28 +7611,9 @@ export const viewdir: GlobalOption = { * * *not available when compiled without the `+mksession` feature* */ -export const viewoptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "viewoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "viewoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "viewoptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "viewoptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "viewoptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "viewoptions"); - }, -}; +export const viewoptions: GlobalOption = new StringOption( + "viewoptions", +); /** * A comma-separated list of these words: @@ -15716,52 +7646,9 @@ export const viewoptions: GlobalOption = { * * (default "") */ -export const virtualedit: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "virtualedit"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "virtualedit", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "virtualedit"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "virtualedit"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "virtualedit", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "virtualedit"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "virtualedit"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "virtualedit", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "virtualedit"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&virtualedit"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&virtualedit", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&virtualedit"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&virtualedit", value); - }, -}; +export const virtualedit: GlobalOrLocalOption = new StringOption( + "virtualedit", +); /** * Use a visual bell instead of beeping. The terminal code to display the @@ -15794,28 +7681,9 @@ export const virtualedit: GlobalOrLocalOption = { * * (default off) */ -export const visualbell: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "visualbell"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "visualbell", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "visualbell"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "visualbell"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "visualbell", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "visualbell"); - }, -}; +export const visualbell: GlobalOption = new BooleanOption( + "visualbell", +); /** * Give a warning message when a shell command is used while the buffer @@ -15823,28 +7691,7 @@ export const visualbell: GlobalOption = { * * (default on) */ -export const warn: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "warn"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "warn", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "warn"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "warn"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "warn", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "warn"); - }, -}; +export const warn: GlobalOption = new BooleanOption("warn"); /** * Allow specified keys that move the cursor left/right to move to the @@ -15880,28 +7727,7 @@ export const warn: GlobalOption = { * * (Vim default: "b,s", Vi default: "") */ -export const whichwrap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "whichwrap"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "whichwrap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "whichwrap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "whichwrap"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "whichwrap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "whichwrap"); - }, -}; +export const whichwrap: GlobalOption = new StringOption("whichwrap"); /** * Character you have to type to start wildcard expansion in the @@ -15921,28 +7747,7 @@ export const whichwrap: GlobalOption = { * * (Vim default: ``, Vi default: CTRL-E) */ -export const wildchar: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wildchar"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "wildchar", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wildchar"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wildchar"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "wildchar", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wildchar"); - }, -}; +export const wildchar: GlobalOption = new NumberOption("wildchar"); /** * 'wildcharm' works exactly like 'wildchar', except that it is @@ -15958,28 +7763,7 @@ export const wildchar: GlobalOption = { * * (default: none (0)) */ -export const wildcharm: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wildcharm"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "wildcharm", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wildcharm"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wildcharm"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "wildcharm", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wildcharm"); - }, -}; +export const wildcharm: GlobalOption = new NumberOption("wildcharm"); /** * A list of file patterns. A file that matches with one of these @@ -15998,28 +7782,7 @@ export const wildcharm: GlobalOption = { * * (default "") */ -export const wildignore: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wildignore"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "wildignore", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wildignore"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wildignore"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "wildignore", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wildignore"); - }, -}; +export const wildignore: GlobalOption = new StringOption("wildignore"); /** * When set case is ignored when completing file names and directories. @@ -16029,28 +7792,9 @@ export const wildignore: GlobalOption = { * * (default off) */ -export const wildignorecase: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wildignorecase"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "wildignorecase", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wildignorecase"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wildignorecase"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "wildignorecase", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wildignorecase"); - }, -}; +export const wildignorecase: GlobalOption = new BooleanOption( + "wildignorecase", +); /** * When 'wildmenu' is on, command-line completion operates in an enhanced @@ -16112,28 +7856,7 @@ export const wildignorecase: GlobalOption = { * * (default off, set in `defaults.vim`) */ -export const wildmenu: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wildmenu"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "wildmenu", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wildmenu"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wildmenu"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "wildmenu", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wildmenu"); - }, -}; +export const wildmenu: GlobalOption = new BooleanOption("wildmenu"); /** * Completion mode that is used for the character specified with @@ -16192,28 +7915,7 @@ export const wildmenu: GlobalOption = { * * (Vim default: "full") */ -export const wildmode: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wildmode"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "wildmode", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wildmode"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wildmode"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "wildmode", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wildmode"); - }, -}; +export const wildmode: GlobalOption = new StringOption("wildmode"); /** * A list of words that change how `cmdline-completion` is done. @@ -16236,28 +7938,9 @@ export const wildmode: GlobalOption = { * * (default "") */ -export const wildoptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wildoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "wildoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wildoptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wildoptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "wildoptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wildoptions"); - }, -}; +export const wildoptions: GlobalOption = new StringOption( + "wildoptions", +); /** * Some GUI versions allow the access to menu entries by using the ALT @@ -16281,28 +7964,7 @@ export const wildoptions: GlobalOption = { * * *only used in Win32, Motif, GTK and Photon GUI* */ -export const winaltkeys: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winaltkeys"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "winaltkeys", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winaltkeys"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "winaltkeys"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "winaltkeys", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "winaltkeys"); - }, -}; +export const winaltkeys: GlobalOption = new StringOption("winaltkeys"); /** * Window height used for `CTRL-F` and `CTRL-B` when there is only one @@ -16317,28 +7979,7 @@ export const winaltkeys: GlobalOption = { * * (default screen height - 1) */ -export const window: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "window"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "window", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "window"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "window"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "window", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "window"); - }, -}; +export const window: GlobalOption = new NumberOption("window"); /** * If enabled, the window and the buffer it is displaying are paired. @@ -16349,42 +7990,7 @@ export const window: GlobalOption = { * * (default off) */ -export const winfixbuf: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winfixbuf"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "winfixbuf", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winfixbuf"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "winfixbuf"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "winfixbuf", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "winfixbuf"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&winfixbuf"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&winfixbuf", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&winfixbuf"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&winfixbuf", value); - }, -}; +export const winfixbuf: LocalOption = new BooleanOption("winfixbuf"); /** * Keep the window height when windows are opened or closed and @@ -16394,42 +8000,9 @@ export const winfixbuf: LocalOption = { * * (default off) */ -export const winfixheight: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winfixheight"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "winfixheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winfixheight"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "winfixheight"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "winfixheight", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "winfixheight"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&winfixheight"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&winfixheight", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&winfixheight"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&winfixheight", value); - }, -}; +export const winfixheight: LocalOption = new BooleanOption( + "winfixheight", +); /** * Keep the window width when windows are opened or closed and @@ -16438,42 +8011,9 @@ export const winfixheight: LocalOption = { * * (default off) */ -export const winfixwidth: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winfixwidth"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "winfixwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winfixwidth"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "winfixwidth"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "winfixwidth", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "winfixwidth"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&winfixwidth"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&winfixwidth", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&winfixwidth"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&winfixwidth", value); - }, -}; +export const winfixwidth: LocalOption = new BooleanOption( + "winfixwidth", +); /** * Minimal number of lines for the current window. This is not a hard @@ -16497,28 +8037,7 @@ export const winfixwidth: LocalOption = { * * (default 1) */ -export const winheight: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winheight"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "winheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winheight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "winheight"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "winheight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "winheight"); - }, -}; +export const winheight: GlobalOption = new NumberOption("winheight"); /** * The minimal height of a window, when it's not the current window. @@ -16533,28 +8052,9 @@ export const winheight: GlobalOption = { * * (default 1) */ -export const winminheight: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winminheight"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "winminheight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winminheight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "winminheight"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "winminheight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "winminheight"); - }, -}; +export const winminheight: GlobalOption = new NumberOption( + "winminheight", +); /** * The minimal width of a window, when it's not the current window. @@ -16570,28 +8070,9 @@ export const winminheight: GlobalOption = { * * (default 1) */ -export const winminwidth: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winminwidth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "winminwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winminwidth"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "winminwidth"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "winminwidth", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "winminwidth"); - }, -}; +export const winminwidth: GlobalOption = new NumberOption( + "winminwidth", +); /** * Minimal number of columns for the current window. This is not a hard @@ -16606,28 +8087,7 @@ export const winminwidth: GlobalOption = { * * (default 20) */ -export const winwidth: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winwidth"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "winwidth", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winwidth"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "winwidth"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "winwidth", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "winwidth"); - }, -}; +export const winwidth: GlobalOption = new NumberOption("winwidth"); /** * This option changes how text is displayed. It doesn't change the text @@ -16650,42 +8110,7 @@ export const winwidth: GlobalOption = { * * (default on) */ -export const wrap: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wrap"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "wrap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wrap"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "wrap"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "wrap", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "wrap"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&wrap"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&wrap", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&wrap"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&wrap", value); - }, -}; +export const wrap: LocalOption = new BooleanOption("wrap"); /** * Number of characters from the right window border where wrapping @@ -16700,42 +8125,7 @@ export const wrap: LocalOption = { * * (default 0) */ -export const wrapmargin: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wrapmargin"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "wrapmargin", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wrapmargin"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "wrapmargin"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "wrapmargin", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "wrapmargin"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&wrapmargin"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&wrapmargin", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&wrapmargin"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&wrapmargin", value); - }, -}; +export const wrapmargin: LocalOption = new NumberOption("wrapmargin"); /** * Searches wrap around the end of the file. Also applies to `]s` and @@ -16743,28 +8133,7 @@ export const wrapmargin: LocalOption = { * * (default on) */ -export const wrapscan: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wrapscan"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "wrapscan", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wrapscan"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "wrapscan"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "wrapscan", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "wrapscan"); - }, -}; +export const wrapscan: GlobalOption = new BooleanOption("wrapscan"); /** * Allows writing files. When not set, writing a file is not allowed. @@ -16775,56 +8144,14 @@ export const wrapscan: GlobalOption = { * * (default on) */ -export const write: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "write"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "write", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "write"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "write"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "write", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "write"); - }, -}; +export const write: GlobalOption = new BooleanOption("write"); /** * Allows writing to any file with no need for "!" override. * * (default off) */ -export const writeany: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "writeany"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "writeany", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "writeany"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "writeany"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "writeany", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "writeany"); - }, -}; +export const writeany: GlobalOption = new BooleanOption("writeany"); /** * Make a backup before overwriting a file. The backup is removed after @@ -16845,28 +8172,9 @@ export const writeany: GlobalOption = { * (default on with `+writebackup` feature, off * otherwise) */ -export const writebackup: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "writebackup"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "writebackup", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "writebackup"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "writebackup"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "writebackup", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "writebackup"); - }, -}; +export const writebackup: GlobalOption = new BooleanOption( + "writebackup", +); /** * The number of milliseconds to wait for each character sent to the @@ -16875,25 +8183,4 @@ export const writebackup: GlobalOption = { * * (default 0) */ -export const writedelay: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "writedelay"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "writedelay", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "writedelay"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "writedelay"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "writedelay", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "writedelay"); - }, -}; +export const writedelay: GlobalOption = new NumberOption("writedelay"); diff --git a/option/_utils.ts b/option/_utils.ts new file mode 100644 index 00000000..2142aa6c --- /dev/null +++ b/option/_utils.ts @@ -0,0 +1,111 @@ +import type { Denops } from "@denops/core"; +import { getbufvar, getwinvar, setbufvar, setwinvar } from "../function/mod.ts"; +import { globalOptions, localOptions, options } from "../variable/option.ts"; +import type { GlobalOrLocalOption } from "./types.ts"; + +type Coerce = (value: unknown) => T; + +class OptionImpl implements GlobalOrLocalOption { + readonly #name: string; + readonly #defaultValue: T; + readonly #coerce: Coerce; + + constructor(name: string, defaultValue: T, coerce: Coerce) { + this.#name = name; + this.#defaultValue = defaultValue; + this.#coerce = coerce; + } + + async get(denops: Denops): Promise { + const result = await options.get(denops, this.#name, this.#defaultValue); + return this.#coerce(result); + } + + set(denops: Denops, value: T): Promise { + return options.set(denops, this.#name, value); + } + + reset(denops: Denops): Promise { + return options.remove(denops, this.#name); + } + + async getGlobal(denops: Denops): Promise { + const result = await globalOptions.get( + denops, + this.#name, + this.#defaultValue, + ); + return this.#coerce(result); + } + + setGlobal(denops: Denops, value: T): Promise { + return globalOptions.set(denops, this.#name, value); + } + + resetGlobal(denops: Denops): Promise { + return globalOptions.remove(denops, this.#name); + } + + async getLocal(denops: Denops): Promise { + const result = await localOptions.get( + denops, + this.#name, + this.#defaultValue, + ); + return this.#coerce(result); + } + + setLocal(denops: Denops, value: T): Promise { + return localOptions.set(denops, this.#name, value); + } + + resetLocal(denops: Denops): Promise { + return localOptions.remove(denops, this.#name); + } + + async getBuffer(denops: Denops, bufnr: number): Promise { + const result = await getbufvar( + denops, + bufnr, + `&${this.#name}`, + this.#defaultValue, + ); + return this.#coerce(result); + } + + setBuffer(denops: Denops, bufnr: number, value: T): Promise { + return setbufvar(denops, bufnr, `&${this.#name}`, value); + } + + async getWindow(denops: Denops, winnr: number): Promise { + const result = await getwinvar( + denops, + winnr, + `&${this.#name}`, + this.#defaultValue, + ); + return this.#coerce(result); + } + + setWindow(denops: Denops, winnr: number, value: T): Promise { + return setwinvar(denops, winnr, `&${this.#name}`, value); + } +} + +export class BooleanOption extends OptionImpl { + constructor(name: string) { + super(name, false, Boolean); + } +} + +export class NumberOption extends OptionImpl { + constructor(name: string) { + super(name, 0, Number); + } +} + +export class StringOption extends OptionImpl { + constructor(name: string) { + super(name, "", String); + } +} diff --git a/option/nvim/_generated.ts b/option/nvim/_generated.ts index b544a462..9e1385f4 100644 --- a/option/nvim/_generated.ts +++ b/option/nvim/_generated.ts @@ -1,17 +1,10 @@ // NOTE: This file is generated. Do NOT modify it manually. -import type { Denops } from "@denops/core"; -import { - getbufvar, - getwinvar, - setbufvar, - setwinvar, -} from "../../function/mod.ts"; -import { globalOptions, localOptions, options } from "../../variable/mod.ts"; import type { GlobalOption, GlobalOrLocalOption, LocalOption, } from "../types.ts"; +import { BooleanOption, NumberOption, StringOption } from "../_utils.ts"; /** * `channel` connected to the buffer, or 0 if no channel is connected. @@ -20,42 +13,7 @@ import type { * * (default 0) */ -export const channel: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "channel"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "channel", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "channel"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "channel"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "channel", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "channel"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&channel"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&channel", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&channel"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&channel", value); - }, -}; +export const channel: LocalOption = new NumberOption("channel"); /** * When nonempty, shows the effects of `:substitute`, `:smagic`, @@ -74,28 +32,7 @@ export const channel: LocalOption = { * * (default "nosplit") */ -export const inccommand: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "inccommand"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "inccommand", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "inccommand"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "inccommand"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "inccommand", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "inccommand"); - }, -}; +export const inccommand: GlobalOption = new StringOption("inccommand"); /** * This option controls the number of lines / columns to scroll by when @@ -120,28 +57,9 @@ export const inccommand: GlobalOption = { * * (default "ver:3,hor:6") */ -export const mousescroll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mousescroll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "mousescroll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mousescroll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mousescroll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "mousescroll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mousescroll"); - }, -}; +export const mousescroll: GlobalOption = new StringOption( + "mousescroll", +); /** * Enables pseudo-transparency for the `popup-menu`. Valid values are in @@ -159,28 +77,7 @@ export const mousescroll: GlobalOption = { * * (default 0) */ -export const pumblend: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pumblend"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "pumblend", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pumblend"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pumblend"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "pumblend", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pumblend"); - }, -}; +export const pumblend: GlobalOption = new NumberOption("pumblend"); /** * Flags to change the way redrawing works, for debugging purposes. @@ -216,28 +113,9 @@ export const pumblend: GlobalOption = { * * (default "") */ -export const redrawdebug: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "redrawdebug"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "redrawdebug", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "redrawdebug"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "redrawdebug"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "redrawdebug", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "redrawdebug"); - }, -}; +export const redrawdebug: GlobalOption = new StringOption( + "redrawdebug", +); /** * Maximum number of lines kept beyond the visible screen. Lines at the @@ -247,42 +125,7 @@ export const redrawdebug: GlobalOption = { * * (default 10000) */ -export const scrollback: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "scrollback"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "scrollback", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "scrollback"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "scrollback"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "scrollback", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "scrollback"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&scrollback"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&scrollback", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&scrollback"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&scrollback", value); - }, -}; +export const scrollback: LocalOption = new NumberOption("scrollback"); /** * When non-empty, the shada file is read upon startup and written @@ -401,28 +244,7 @@ export const scrollback: LocalOption = { * Win32: !,'100,<50,s10,h,rA:,rB: * others: !,'100,<50,s10,h) */ -export const shada: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shada"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shada", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shada"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shada"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shada", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shada"); - }, -}; +export const shada: GlobalOption = new StringOption("shada"); /** * When non-empty, overrides the file name used for `shada` (viminfo). @@ -434,28 +256,7 @@ export const shada: GlobalOption = { * * (default "") */ -export const shadafile: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shadafile"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "shadafile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shadafile"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shadafile"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "shadafile", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shadafile"); - }, -}; +export const shadafile: GlobalOption = new StringOption("shadafile"); /** * EXPERIMENTAL @@ -519,42 +320,9 @@ export const shadafile: GlobalOption = { * * (default "") */ -export const statuscolumn: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "statuscolumn"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "statuscolumn", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "statuscolumn"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "statuscolumn"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "statuscolumn", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "statuscolumn"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&statuscolumn"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&statuscolumn", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&statuscolumn"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&statuscolumn", value); - }, -}; +export const statuscolumn: LocalOption = new StringOption( + "statuscolumn", +); /** * A comma-separated list of options for specifying control characters @@ -578,28 +346,9 @@ export const statuscolumn: LocalOption = { * * (default "BS,HT,ESC,DEL") */ -export const termpastefilter: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termpastefilter"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "termpastefilter", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termpastefilter"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "termpastefilter"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "termpastefilter", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "termpastefilter"); - }, -}; +export const termpastefilter: GlobalOption = new StringOption( + "termpastefilter", +); /** * If the host terminal supports it, buffer all screen updates @@ -609,28 +358,7 @@ export const termpastefilter: GlobalOption = { * * (default on) */ -export const termsync: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termsync"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "termsync", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termsync"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "termsync"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "termsync", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "termsync"); - }, -}; +export const termsync: GlobalOption = new BooleanOption("termsync"); /** * When non-empty, this option enables the window bar and determines its @@ -649,52 +377,7 @@ export const termsync: GlobalOption = { * * (default "") */ -export const winbar: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winbar"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "winbar", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winbar"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "winbar"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "winbar", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "winbar"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "winbar"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "winbar", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "winbar"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&winbar"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&winbar", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&winbar"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&winbar", value); - }, -}; +export const winbar: GlobalOrLocalOption = new StringOption("winbar"); /** * Enables pseudo-transparency for a floating window. Valid values are in @@ -705,42 +388,7 @@ export const winbar: GlobalOrLocalOption = { * * (default 0) */ -export const winblend: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winblend"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "winblend", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winblend"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "winblend"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "winblend", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "winblend"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&winblend"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&winblend", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&winblend"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&winblend", value); - }, -}; +export const winblend: LocalOption = new NumberOption("winblend"); /** * Window-local highlights. Comma-delimited list of highlight @@ -763,39 +411,6 @@ export const winblend: LocalOption = { * * (default "") */ -export const winhighlight: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winhighlight"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "winhighlight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winhighlight"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "winhighlight"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "winhighlight", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "winhighlight"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&winhighlight"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&winhighlight", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&winhighlight"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&winhighlight", value); - }, -}; +export const winhighlight: LocalOption = new StringOption( + "winhighlight", +); diff --git a/option/vim/_generated.ts b/option/vim/_generated.ts index f2eb4e10..3ac42680 100644 --- a/option/vim/_generated.ts +++ b/option/vim/_generated.ts @@ -1,17 +1,10 @@ // NOTE: This file is generated. Do NOT modify it manually. -import type { Denops } from "@denops/core"; -import { - getbufvar, - getwinvar, - setbufvar, - setwinvar, -} from "../../function/mod.ts"; -import { globalOptions, localOptions, options } from "../../variable/mod.ts"; import type { GlobalOption, GlobalOrLocalOption, LocalOption, } from "../types.ts"; +import { BooleanOption, NumberOption, StringOption } from "../_utils.ts"; /** * The ASCII code for the first letter of the Hebrew alphabet. The @@ -25,28 +18,7 @@ import type { * * *only available when compiled with the `+rightleft` feature* */ -export const aleph: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "aleph"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "aleph", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "aleph"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "aleph"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "aleph", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "aleph"); - }, -}; +export const aleph: GlobalOption = new NumberOption("aleph"); /** * This option was for using Farsi, which has been removed. See @@ -56,28 +28,7 @@ export const aleph: GlobalOption = { * * *only available when compiled with the `+farsi` feature* */ -export const altkeymap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "altkeymap"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "altkeymap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "altkeymap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "altkeymap"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "altkeymap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "altkeymap"); - }, -}; +export const altkeymap: GlobalOption = new BooleanOption("altkeymap"); /** * This option only has an effect in the GUI version of Vim on macOS @@ -91,28 +42,7 @@ export const altkeymap: GlobalOption = { * * *only available when compiled with GUI enabled on macOS* */ -export const antialias: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "antialias"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "antialias", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "antialias"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "antialias"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "antialias", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "antialias"); - }, -}; +export const antialias: GlobalOption = new BooleanOption("antialias"); /** * When on, Vim will change the current working directory whenever you @@ -152,28 +82,9 @@ export const antialias: GlobalOption = { * * (default off) */ -export const autoshelldir: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "autoshelldir"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "autoshelldir", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "autoshelldir"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "autoshelldir"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "autoshelldir", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "autoshelldir"); - }, -}; +export const autoshelldir: GlobalOption = new BooleanOption( + "autoshelldir", +); /** * Delay in milliseconds before a balloon may pop up. See `balloon-eval`. @@ -182,28 +93,9 @@ export const autoshelldir: GlobalOption = { * * *only available when compiled with the `+balloon_eval` feature* */ -export const balloondelay: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "balloondelay"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "balloondelay", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "balloondelay"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "balloondelay"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "balloondelay", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "balloondelay"); - }, -}; +export const balloondelay: GlobalOption = new NumberOption( + "balloondelay", +); /** * Switch on the `balloon-eval` functionality for the GUI. @@ -212,28 +104,9 @@ export const balloondelay: GlobalOption = { * * *only available when compiled with the `+balloon_eval` feature* */ -export const ballooneval: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ballooneval"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "ballooneval", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ballooneval"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ballooneval"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "ballooneval", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ballooneval"); - }, -}; +export const ballooneval: GlobalOption = new BooleanOption( + "ballooneval", +); /** * Switch on the `balloon-eval` functionality for the terminal. @@ -242,28 +115,9 @@ export const ballooneval: GlobalOption = { * * *only available when compiled with the `+balloon_eval_term` feature* */ -export const balloonevalterm: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "balloonevalterm"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "balloonevalterm", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "balloonevalterm"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "balloonevalterm"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "balloonevalterm", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "balloonevalterm"); - }, -}; +export const balloonevalterm: GlobalOption = new BooleanOption( + "balloonevalterm", +); /** * Expression for text to show in evaluation balloon. It is only used @@ -332,52 +186,9 @@ export const balloonevalterm: GlobalOption = { * * *only available when compiled with the `+balloon_eval` feature* */ -export const balloonexpr: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "balloonexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "balloonexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "balloonexpr"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "balloonexpr"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "balloonexpr", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "balloonexpr"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "balloonexpr"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "balloonexpr", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "balloonexpr"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&balloonexpr"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&balloonexpr", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&balloonexpr"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&balloonexpr", value); - }, -}; +export const balloonexpr: GlobalOrLocalOption = new StringOption( + "balloonexpr", +); /** * This was for MS-DOS and is no longer supported. @@ -386,28 +197,7 @@ export const balloonexpr: GlobalOrLocalOption = { * * *only for MS-DOS* */ -export const bioskey: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "bioskey"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "bioskey", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "bioskey"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "bioskey"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "bioskey", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "bioskey"); - }, -}; +export const bioskey: GlobalOption = new BooleanOption("bioskey"); /** * This option has the effect of making Vim either more Vi-compatible, or @@ -533,28 +323,9 @@ export const bioskey: GlobalOption = { * (default on, off when a `vimrc` or `gvimrc` * file is found, reset in `defaults.vim`) */ -export const compatible: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "compatible"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "compatible", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "compatible"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "compatible"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "compatible", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "compatible"); - }, -}; +export const compatible: GlobalOption = new BooleanOption( + "compatible", +); /** * When 'completeopt' contains "popup" then this option is used for the @@ -568,56 +339,16 @@ export const compatible: GlobalOption = { * * *not available when compiled without the `+textprop` or `+quickfix` feature* */ -export const completepopup: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "completepopup"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "completepopup", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "completepopup"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "completepopup"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "completepopup", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "completepopup"); - }, -}; +export const completepopup: GlobalOption = new StringOption( + "completepopup", +); /** * This was for MS-DOS and is no longer supported. * * (default off) */ -export const conskey: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "conskey"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "conskey", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "conskey"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "conskey"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "conskey", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "conskey"); - }, -}; +export const conskey: GlobalOption = new BooleanOption("conskey"); /** * Method used for encryption when the buffer is written to a file: @@ -685,52 +416,9 @@ export const conskey: GlobalOption = { * * (default "blowfish2") */ -export const cryptmethod: GlobalOrLocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cryptmethod"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cryptmethod", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cryptmethod"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cryptmethod"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "cryptmethod", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cryptmethod"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "cryptmethod"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "cryptmethod", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "cryptmethod"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&cryptmethod"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&cryptmethod", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&cryptmethod"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&cryptmethod", value); - }, -}; +export const cryptmethod: GlobalOrLocalOption = new StringOption( + "cryptmethod", +); /** * Determines how many components of the path to show in a list of tags. @@ -741,28 +429,9 @@ export const cryptmethod: GlobalOrLocalOption = { * * *not available when compiled without the `+cscope` feature* */ -export const cscopepathcomp: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cscopepathcomp"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "cscopepathcomp", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cscopepathcomp"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cscopepathcomp"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "cscopepathcomp", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cscopepathcomp"); - }, -}; +export const cscopepathcomp: GlobalOption = new NumberOption( + "cscopepathcomp", +); /** * Specifies the command to execute cscope. See `cscopeprg`. @@ -773,28 +442,7 @@ export const cscopepathcomp: GlobalOption = { * * *not available when compiled without the `+cscope` feature* */ -export const cscopeprg: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cscopeprg"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cscopeprg", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cscopeprg"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cscopeprg"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "cscopeprg", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cscopeprg"); - }, -}; +export const cscopeprg: GlobalOption = new StringOption("cscopeprg"); /** * Specifies whether to use quickfix window to show cscope results. @@ -804,28 +452,9 @@ export const cscopeprg: GlobalOption = { * * *not available when compiled without the `+cscope` or `+quickfix` features* */ -export const cscopequickfix: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cscopequickfix"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "cscopequickfix", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cscopequickfix"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cscopequickfix"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "cscopequickfix", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cscopequickfix"); - }, -}; +export const cscopequickfix: GlobalOption = new StringOption( + "cscopequickfix", +); /** * In the absence of a prefix (-P) for cscope. setting this option enables @@ -837,28 +466,9 @@ export const cscopequickfix: GlobalOption = { * * *not available when compiled without the `+cscope` feature* */ -export const cscoperelative: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cscoperelative"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cscoperelative", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cscoperelative"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cscoperelative"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "cscoperelative", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cscoperelative"); - }, -}; +export const cscoperelative: GlobalOption = new BooleanOption( + "cscoperelative", +); /** * Use cscope for tag commands. See `cscope-options`. @@ -868,28 +478,7 @@ export const cscoperelative: GlobalOption = { * * *not available when compiled without the `+cscope` feature* */ -export const cscopetag: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cscopetag"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cscopetag", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cscopetag"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cscopetag"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "cscopetag", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cscopetag"); - }, -}; +export const cscopetag: GlobalOption = new BooleanOption("cscopetag"); /** * Determines the order in which ":cstag" performs a search. See @@ -900,28 +489,9 @@ export const cscopetag: GlobalOption = { * * *not available when compiled without the `+cscope` feature* */ -export const cscopetagorder: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cscopetagorder"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "cscopetagorder", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cscopetagorder"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cscopetagorder"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "cscopetagorder", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cscopetagorder"); - }, -}; +export const cscopetagorder: GlobalOption = new NumberOption( + "cscopetagorder", +); /** * Give messages when adding a cscope database. See `cscopeverbose`. @@ -931,28 +501,9 @@ export const cscopetagorder: GlobalOption = { * * *not available when compiled without the `+cscope` feature* */ -export const cscopeverbose: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "cscopeverbose"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "cscopeverbose", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "cscopeverbose"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "cscopeverbose"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "cscopeverbose", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "cscopeverbose"); - }, -}; +export const cscopeverbose: GlobalOption = new BooleanOption( + "cscopeverbose", +); /** * Makes the 'g' and 'c' flags of the ":substitute" command to be @@ -963,28 +514,9 @@ export const cscopeverbose: GlobalOption = { * * (default off) */ -export const edcompatible: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "edcompatible"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "edcompatible", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "edcompatible"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "edcompatible"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "edcompatible", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "edcompatible"); - }, -}; +export const edcompatible: GlobalOption = new BooleanOption( + "edcompatible", +); /** * Function keys that start with an `` are recognized in Insert @@ -1003,28 +535,7 @@ export const edcompatible: GlobalOption = { * * (Vim default: on, Vi default: off) */ -export const esckeys: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "esckeys"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "esckeys", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "esckeys"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "esckeys"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "esckeys", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "esckeys"); - }, -}; +export const esckeys: GlobalOption = new BooleanOption("esckeys"); /** * This option was for using Farsi, which has been removed. See @@ -1034,28 +545,7 @@ export const esckeys: GlobalOption = { * * *only available when compiled with the `+rightleft` feature* */ -export const fkmap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "fkmap"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "fkmap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "fkmap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "fkmap"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "fkmap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "fkmap"); - }, -}; +export const fkmap: GlobalOption = new BooleanOption("fkmap"); /** * *not available in the GTK+ GUI* @@ -1067,28 +557,7 @@ export const fkmap: GlobalOption = { * * *only available when compiled with GUI enabled and with the `+xfontset` feature* */ -export const guifontset: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guifontset"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guifontset", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guifontset"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guifontset"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guifontset", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guifontset"); - }, -}; +export const guifontset: GlobalOption = new StringOption("guifontset"); /** * The number of pixels subtracted from the screen height when fitting @@ -1103,28 +572,9 @@ export const guifontset: GlobalOption = { * * *only for GTK and X11 GUI* */ -export const guiheadroom: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guiheadroom"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "guiheadroom", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guiheadroom"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guiheadroom"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "guiheadroom", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guiheadroom"); - }, -}; +export const guiheadroom: GlobalOption = new NumberOption( + "guiheadroom", +); /** * List of ASCII characters that, when combined together, can create more @@ -1141,28 +591,9 @@ export const guiheadroom: GlobalOption = { * * *only for GTK and Win32 GUI* */ -export const guiligatures: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guiligatures"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "guiligatures", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guiligatures"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guiligatures"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "guiligatures", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guiligatures"); - }, -}; +export const guiligatures: GlobalOption = new StringOption( + "guiligatures", +); /** * Only in the GUI: If on, an attempt is made to open a pseudo-tty for @@ -1172,28 +603,7 @@ export const guiligatures: GlobalOption = { * * *only available when compiled with GUI enabled* */ -export const guipty: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "guipty"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "guipty", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "guipty"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "guipty"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "guipty", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "guipty"); - }, -}; +export const guipty: GlobalOption = new BooleanOption("guipty"); /** * This option can be used to set highlighting mode for various @@ -1299,28 +709,7 @@ export const guipty: GlobalOption = { * z:StatusLineTerm,Z:StatusLineTermNC, * g:MsgArea"`) */ -export const highlight: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "highlight"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "highlight", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "highlight"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "highlight"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "highlight", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "highlight"); - }, -}; +export const highlight: GlobalOption = new StringOption("highlight"); /** * When on, the keyboard is mapped for the Hebrew character set. @@ -1332,28 +721,7 @@ export const highlight: GlobalOption = { * * *only available when compiled with the `+rightleft` feature* */ -export const hkmap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "hkmap"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "hkmap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "hkmap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "hkmap"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "hkmap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "hkmap"); - }, -}; +export const hkmap: GlobalOption = new BooleanOption("hkmap"); /** * When on, phonetic keyboard mapping is used. 'hkmap' must also be on. @@ -1365,28 +733,7 @@ export const hkmap: GlobalOption = { * * *only available when compiled with the `+rightleft` feature* */ -export const hkmapp: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "hkmapp"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "hkmapp", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "hkmapp"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "hkmapp"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "hkmapp", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "hkmapp"); - }, -}; +export const hkmapp: GlobalOption = new BooleanOption("hkmapp"); /** * This option specifies a function that will be called to @@ -1411,28 +758,9 @@ export const hkmapp: GlobalOption = { * * (default "") */ -export const imactivatefunc: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "imactivatefunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "imactivatefunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "imactivatefunc"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "imactivatefunc"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "imactivatefunc", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "imactivatefunc"); - }, -}; +export const imactivatefunc: GlobalOption = new StringOption( + "imactivatefunc", +); /** * *only available when compiled with `+xim` and @@ -1467,28 +795,9 @@ export const imactivatefunc: GlobalOption = { * * (default "") */ -export const imactivatekey: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "imactivatekey"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "imactivatekey", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "imactivatekey"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "imactivatekey"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "imactivatekey", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "imactivatekey"); - }, -}; +export const imactivatekey: GlobalOption = new StringOption( + "imactivatekey", +); /** * This option specifies a function that is called to obtain the status @@ -1511,28 +820,9 @@ export const imactivatekey: GlobalOption = { * * (default "") */ -export const imstatusfunc: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "imstatusfunc"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "imstatusfunc", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "imstatusfunc"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "imstatusfunc"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "imstatusfunc", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "imstatusfunc"); - }, -}; +export const imstatusfunc: GlobalOption = new StringOption( + "imstatusfunc", +); /** * This option specifies the input style of Input Method: @@ -1552,28 +842,7 @@ export const imstatusfunc: GlobalOption = { * * *only available when compiled with `+xim` and `+GUI_GTK`* */ -export const imstyle: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "imstyle"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "imstyle", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "imstyle"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "imstyle"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "imstyle", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "imstyle"); - }, -}; +export const imstyle: GlobalOption = new NumberOption("imstyle"); /** * Makes Vim work in a way that Insert mode is the default mode. Useful @@ -1602,28 +871,9 @@ export const imstyle: GlobalOption = { * * (default off) */ -export const insertmode: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "insertmode"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "insertmode", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "insertmode"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "insertmode"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "insertmode", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "insertmode"); - }, -}; +export const insertmode: GlobalOption = new BooleanOption( + "insertmode", +); /** * The key that is used for encrypting and decrypting the current buffer. @@ -1646,42 +896,7 @@ export const insertmode: GlobalOption = { * * *only available when compiled with the `+cryptv` feature* */ -export const key: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "key"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "key", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "key"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "key"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "key", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "key"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&key"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&key", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&key"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&key", value); - }, -}; +export const key: LocalOption = new StringOption("key"); /** * Specifies what keyboard protocol to use depending on the value of @@ -1736,28 +951,9 @@ export const key: LocalOption = { * * (default: see below) */ -export const keyprotocol: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "keyprotocol"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "keyprotocol", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "keyprotocol"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "keyprotocol"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "keyprotocol", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "keyprotocol"); - }, -}; +export const keyprotocol: GlobalOption = new StringOption( + "keyprotocol", +); /** * This is just like 'langremap' but with the value inverted. It only @@ -1768,28 +964,9 @@ export const keyprotocol: GlobalOption = { * * *only available when compiled with the `+langmap` feature* */ -export const langnoremap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "langnoremap"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "langnoremap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "langnoremap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "langnoremap"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "langnoremap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "langnoremap"); - }, -}; +export const langnoremap: GlobalOption = new BooleanOption( + "langnoremap", +); /** * Specifies the name of the Lua shared library. The default is @@ -1802,28 +979,7 @@ export const langnoremap: GlobalOption = { * * *only available when compiled with the `+lua/dyn` feature* */ -export const luadll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "luadll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "luadll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "luadll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "luadll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "luadll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "luadll"); - }, -}; +export const luadll: GlobalOption = new StringOption("luadll"); /** * No longer supported, as the Mac OS X GUI code was removed. @@ -1832,28 +988,7 @@ export const luadll: GlobalOption = { * * *not supported* */ -export const macatsui: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "macatsui"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "macatsui", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "macatsui"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "macatsui"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "macatsui", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "macatsui"); - }, -}; +export const macatsui: GlobalOption = new BooleanOption("macatsui"); /** * The maximum number of combining characters supported for displaying. @@ -1866,28 +1001,7 @@ export const macatsui: GlobalOption = { * * (default 2) */ -export const maxcombine: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "maxcombine"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "maxcombine", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "maxcombine"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "maxcombine"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "maxcombine", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "maxcombine"); - }, -}; +export const maxcombine: GlobalOption = new NumberOption("maxcombine"); /** * Maximum amount of memory (in Kbyte) to use for one buffer. When this @@ -1902,28 +1016,7 @@ export const maxcombine: GlobalOption = { * dependent) or half the amount of memory * available) */ -export const maxmem: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "maxmem"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "maxmem", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "maxmem"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "maxmem"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "maxmem", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "maxmem"); - }, -}; +export const maxmem: GlobalOption = new NumberOption("maxmem"); /** * Maximum amount of memory in Kbyte to use for all buffers together. @@ -1941,28 +1034,7 @@ export const maxmem: GlobalOption = { * dependent) or half the amount of memory * available) */ -export const maxmemtot: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "maxmemtot"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "maxmemtot", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "maxmemtot"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "maxmemtot"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "maxmemtot", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "maxmemtot"); - }, -}; +export const maxmemtot: GlobalOption = new NumberOption("maxmemtot"); /** * The number of milliseconds between polls for MzScheme threads. @@ -1974,28 +1046,7 @@ export const maxmemtot: GlobalOption = { * * *not available when compiled without the `+mzscheme` feature* */ -export const mzquantum: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mzquantum"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "mzquantum", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mzquantum"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mzquantum"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "mzquantum", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mzquantum"); - }, -}; +export const mzquantum: GlobalOption = new NumberOption("mzquantum"); /** * Specifies the name of the MzScheme shared library. The default is @@ -2010,28 +1061,9 @@ export const mzquantum: GlobalOption = { * * *only available when compiled with the `+mzscheme/dyn` feature* */ -export const mzschemedll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mzschemedll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "mzschemedll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mzschemedll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mzschemedll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "mzschemedll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mzschemedll"); - }, -}; +export const mzschemedll: GlobalOption = new StringOption( + "mzschemedll", +); /** * Specifies the name of the MzScheme GC shared library. The default is @@ -2045,70 +1077,16 @@ export const mzschemedll: GlobalOption = { * * *only available when compiled with the `+mzscheme/dyn` feature* */ -export const mzschemegcdll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "mzschemegcdll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "mzschemegcdll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "mzschemegcdll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "mzschemegcdll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "mzschemegcdll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "mzschemegcdll"); - }, -}; +export const mzschemegcdll: GlobalOption = new StringOption( + "mzschemegcdll", +); /** * This option was supported on RISC OS, which has been removed. * * (default: "") */ -export const osfiletype: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "osfiletype"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "osfiletype", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "osfiletype"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "osfiletype"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "osfiletype", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "osfiletype"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&osfiletype"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&osfiletype", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&osfiletype"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&osfiletype", value); - }, -}; +export const osfiletype: LocalOption = new StringOption("osfiletype"); /** * Put Vim in Paste mode. This is useful if you want to cut or copy @@ -2155,28 +1133,7 @@ export const osfiletype: LocalOption = { * * (default off) */ -export const paste: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "paste"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "paste", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "paste"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "paste"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "paste", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "paste"); - }, -}; +export const paste: GlobalOption = new BooleanOption("paste"); /** * When non-empty, specifies the key sequence that toggles the 'paste' @@ -2206,28 +1163,9 @@ export const paste: GlobalOption = { * * (default "") */ -export const pastetoggle: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pastetoggle"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "pastetoggle", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pastetoggle"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pastetoggle"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "pastetoggle", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pastetoggle"); - }, -}; +export const pastetoggle: GlobalOption = new StringOption( + "pastetoggle", +); /** * Specifies the name of the Perl shared library. The default is @@ -2240,28 +1178,7 @@ export const pastetoggle: GlobalOption = { * * *only available when compiled with the `+perl/dyn` feature* */ -export const perldll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "perldll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "perldll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "perldll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "perldll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "perldll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "perldll"); - }, -}; +export const perldll: GlobalOption = new StringOption("perldll"); /** * When not empty a popup window is used for commands that would open a @@ -2273,28 +1190,9 @@ export const perldll: GlobalOption = { * * *not available when compiled without the `+textprop` or `+quickfix` feature* */ -export const previewpopup: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "previewpopup"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "previewpopup", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "previewpopup"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "previewpopup"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "previewpopup", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "previewpopup"); - }, -}; +export const previewpopup: GlobalOption = new StringOption( + "previewpopup", +); /** * The name of the printer to be used for `:hardcopy`. @@ -2306,28 +1204,9 @@ export const previewpopup: GlobalOption = { * * *only available when compiled with the `+printer` feature* */ -export const printdevice: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printdevice"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printdevice", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printdevice"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printdevice"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printdevice", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printdevice"); - }, -}; +export const printdevice: GlobalOption = new StringOption( + "printdevice", +); /** * Sets the character encoding used when printing. @@ -2337,28 +1216,9 @@ export const printdevice: GlobalOption = { * * *only available when compiled with the `+printer` and `+postscript` features* */ -export const printencoding: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printencoding"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printencoding", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printencoding"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printencoding"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printencoding", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printencoding"); - }, -}; +export const printencoding: GlobalOption = new StringOption( + "printencoding", +); /** * Expression used to print the PostScript produced with `:hardcopy`. @@ -2370,28 +1230,7 @@ export const printencoding: GlobalOption = { * * *only available when compiled with the `+printer` and `+postscript` features* */ -export const printexpr: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printexpr"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printexpr", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printexpr"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printexpr"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printexpr", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printexpr"); - }, -}; +export const printexpr: GlobalOption = new StringOption("printexpr"); /** * The name of the font that will be used for `:hardcopy`. @@ -2401,28 +1240,7 @@ export const printexpr: GlobalOption = { * * *only available when compiled with the `+printer` feature* */ -export const printfont: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printfont"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printfont", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printfont"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printfont"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printfont", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printfont"); - }, -}; +export const printfont: GlobalOption = new StringOption("printfont"); /** * The format of the header produced in `:hardcopy` output. @@ -2432,28 +1250,9 @@ export const printfont: GlobalOption = { * * *only available when compiled with the `+printer` feature* */ -export const printheader: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printheader"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printheader", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printheader"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printheader"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printheader", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printheader"); - }, -}; +export const printheader: GlobalOption = new StringOption( + "printheader", +); /** * The CJK character set to be used for CJK output from `:hardcopy`. @@ -2463,28 +1262,9 @@ export const printheader: GlobalOption = { * * *only available when compiled with the `+printer` and `+postscript` features* */ -export const printmbcharset: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printmbcharset"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printmbcharset", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printmbcharset"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printmbcharset"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printmbcharset", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printmbcharset"); - }, -}; +export const printmbcharset: GlobalOption = new StringOption( + "printmbcharset", +); /** * List of font names to be used for CJK output from `:hardcopy`. @@ -2494,28 +1274,9 @@ export const printmbcharset: GlobalOption = { * * *only available when compiled with the `+printer` and `+postscript` features* */ -export const printmbfont: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printmbfont"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printmbfont", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printmbfont"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printmbfont"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printmbfont", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printmbfont"); - }, -}; +export const printmbfont: GlobalOption = new StringOption( + "printmbfont", +); /** * List of items that control the format of the output of `:hardcopy`. @@ -2525,56 +1286,16 @@ export const printmbfont: GlobalOption = { * * *only available when compiled with `+printer` feature* */ -export const printoptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "printoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "printoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "printoptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "printoptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "printoptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "printoptions"); - }, -}; +export const printoptions: GlobalOption = new StringOption( + "printoptions", +); /** * When on a ":" prompt is used in Ex mode. * * (default on) */ -export const prompt: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "prompt"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "prompt", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "prompt"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "prompt"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "prompt", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "prompt"); - }, -}; +export const prompt: GlobalOption = new BooleanOption("prompt"); /** * Specifies the name of the Python 2.x shared library. The default is @@ -2587,28 +1308,7 @@ export const prompt: GlobalOption = { * * *only available when compiled with the `+python/dyn` feature* */ -export const pythondll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pythondll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "pythondll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pythondll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pythondll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "pythondll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pythondll"); - }, -}; +export const pythondll: GlobalOption = new StringOption("pythondll"); /** * Specifies the name of the Python 2.x home directory. When 'pythonhome' @@ -2623,28 +1323,7 @@ export const pythondll: GlobalOption = { * * *only available when compiled with the `+python/dyn` feature* */ -export const pythonhome: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pythonhome"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "pythonhome", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pythonhome"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pythonhome"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "pythonhome", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pythonhome"); - }, -}; +export const pythonhome: GlobalOption = new StringOption("pythonhome"); /** * Specifies the name of the Python 3 shared library. The default is @@ -2657,28 +1336,9 @@ export const pythonhome: GlobalOption = { * * *only available when compiled with the `+python3/dyn` feature* */ -export const pythonthreedll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pythonthreedll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "pythonthreedll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pythonthreedll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pythonthreedll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "pythonthreedll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pythonthreedll"); - }, -}; +export const pythonthreedll: GlobalOption = new StringOption( + "pythonthreedll", +); /** * Specifies the name of the Python 3 home directory. When @@ -2693,28 +1353,9 @@ export const pythonthreedll: GlobalOption = { * * *only available when compiled with the `+python3/dyn` feature* */ -export const pythonthreehome: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "pythonthreehome"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "pythonthreehome", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "pythonthreehome"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "pythonthreehome"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "pythonthreehome", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "pythonthreehome"); - }, -}; +export const pythonthreehome: GlobalOption = new StringOption( + "pythonthreehome", +); /** * Allows for mappings to work recursively. If you do not want this for @@ -2725,28 +1366,7 @@ export const pythonthreehome: GlobalOption = { * * (default on) */ -export const remap: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "remap"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "remap", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "remap"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "remap"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "remap", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "remap"); - }, -}; +export const remap: GlobalOption = new BooleanOption("remap"); /** * Select a text renderer and set its options. The options depend on the @@ -2847,28 +1467,9 @@ export const remap: GlobalOption = { * * *only available when compiled with GUI and DIRECTX on MS-Windows* */ -export const renderoptions: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "renderoptions"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "renderoptions", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "renderoptions"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "renderoptions"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "renderoptions", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "renderoptions"); - }, -}; +export const renderoptions: GlobalOption = new StringOption( + "renderoptions", +); /** * When set, the screen contents is restored when exiting Vim. This also @@ -2885,28 +1486,9 @@ export const renderoptions: GlobalOption = { * * *only in MS-Windows console version* */ -export const restorescreen: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "restorescreen"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "restorescreen", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "restorescreen"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "restorescreen"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "restorescreen", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "restorescreen"); - }, -}; +export const restorescreen: GlobalOption = new BooleanOption( + "restorescreen", +); /** * Specifies the name of the Ruby shared library. The default is @@ -2919,28 +1501,7 @@ export const restorescreen: GlobalOption = { * * *only available when compiled with the `+ruby/dyn` feature* */ -export const rubydll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "rubydll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "rubydll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "rubydll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "rubydll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "rubydll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "rubydll"); - }, -}; +export const rubydll: GlobalOption = new StringOption("rubydll"); /** * When using the scroll wheel and this option is set, the window under @@ -2952,28 +1513,9 @@ export const rubydll: GlobalOption = { * * *only for MS-Windows GUI* */ -export const scrollfocus: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "scrollfocus"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "scrollfocus", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "scrollfocus"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "scrollfocus"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "scrollfocus", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "scrollfocus"); - }, -}; +export const scrollfocus: GlobalOption = new BooleanOption( + "scrollfocus", +); /** * When on, ":autocmd", shell and write commands are not allowed in @@ -2988,28 +1530,7 @@ export const scrollfocus: GlobalOption = { * * (default off) */ -export const secure: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "secure"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "secure", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "secure"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "secure"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "secure", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "secure"); - }, -}; +export const secure: GlobalOption = new BooleanOption("secure"); /** * On the Amiga this option influences the way how the commands work @@ -3026,28 +1547,7 @@ export const secure: GlobalOption = { * * *only for the Amiga* */ -export const shelltype: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shelltype"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "shelltype", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shelltype"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "shelltype"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "shelltype", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "shelltype"); - }, -}; +export const shelltype: GlobalOption = new NumberOption("shelltype"); /** * Filenames are assumed to be 8 characters plus one extension of 3 @@ -3059,42 +1559,7 @@ export const shelltype: GlobalOption = { * * (default off) */ -export const shortname: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "shortname"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "shortname", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "shortname"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "shortname"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "shortname", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "shortname"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&shortname"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&shortname", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&shortname"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&shortname", value); - }, -}; +export const shortname: LocalOption = new BooleanOption("shortname"); /** * When this option is not empty a swap file is synced to disk after @@ -3110,28 +1575,7 @@ export const shortname: LocalOption = { * * (default "fsync") */ -export const swapsync: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "swapsync"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "swapsync", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "swapsync"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "swapsync"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "swapsync", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "swapsync"); - }, -}; +export const swapsync: GlobalOption = new StringOption("swapsync"); /** * Specifies the name of the Tcl shared library. The default is @@ -3144,28 +1588,7 @@ export const swapsync: GlobalOption = { * * *only available when compiled with the `+tcl/dyn` feature* */ -export const tcldll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "tcldll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "tcldll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "tcldll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "tcldll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "tcldll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "tcldll"); - }, -}; +export const tcldll: GlobalOption = new StringOption("tcldll"); /** * Name of the terminal. Used for choosing the terminal control @@ -3185,28 +1608,7 @@ export const tcldll: GlobalOption = { * on VMS: "ansi" * on Win 32: "win32") */ -export const term: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "term"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "term", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "term"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "term"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "term", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "term"); - }, -}; +export const term: GlobalOption = new StringOption("term"); /** * Encoding used for the terminal. This specifies what character @@ -3237,28 +1639,9 @@ export const term: GlobalOption = { * * (default ""; with GTK+ GUI: "utf-8") */ -export const termencoding: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termencoding"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "termencoding", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termencoding"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "termencoding"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "termencoding", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "termencoding"); - }, -}; +export const termencoding: GlobalOption = new StringOption( + "termencoding", +); /** * The key that starts a CTRL-W command in a terminal window. Other keys @@ -3274,42 +1657,7 @@ export const termencoding: GlobalOption = { * * (default "") */ -export const termwinkey: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termwinkey"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "termwinkey", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termwinkey"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "termwinkey"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "termwinkey", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "termwinkey"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&termwinkey"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&termwinkey", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&termwinkey"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&termwinkey", value); - }, -}; +export const termwinkey: LocalOption = new StringOption("termwinkey"); /** * Number of scrollback lines to keep. When going over this limit the @@ -3323,42 +1671,9 @@ export const termwinkey: LocalOption = { * * *not available when compiled without the `+terminal` feature* */ -export const termwinscroll: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termwinscroll"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "termwinscroll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termwinscroll"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "termwinscroll"); - return (result ?? 0) as number; - }, - setLocal(denops: Denops, value: number): Promise { - return localOptions.set(denops, "termwinscroll", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "termwinscroll"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&termwinscroll"); - return (result ?? 0) as number; - }, - setBuffer(denops: Denops, bufnr: number, value: number): Promise { - return setbufvar(denops, bufnr, "&termwinscroll", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&termwinscroll"); - return (result ?? 0) as number; - }, - setWindow(denops: Denops, winnr: number, value: number): Promise { - return setwinvar(denops, winnr, "&termwinscroll", value); - }, -}; +export const termwinscroll: LocalOption = new NumberOption( + "termwinscroll", +); /** * Size used when opening the `terminal` window. Format: @@ -3386,42 +1701,7 @@ export const termwinscroll: LocalOption = { * * (default "") */ -export const termwinsize: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termwinsize"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "termwinsize", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termwinsize"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "termwinsize"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "termwinsize", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "termwinsize"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&termwinsize"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&termwinsize", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&termwinsize"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&termwinsize", value); - }, -}; +export const termwinsize: LocalOption = new StringOption("termwinsize"); /** * Specify the virtual console (pty) used when opening the terminal @@ -3442,28 +1722,9 @@ export const termwinsize: LocalOption = { * * *only available when compiled with the `terminal` feature on MS-Windows* */ -export const termwintype: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "termwintype"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "termwintype", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "termwintype"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "termwintype"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "termwintype", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "termwintype"); - }, -}; +export const termwintype: GlobalOption = new StringOption( + "termwintype", +); /** * When set: Add 's' flag to 'shortmess' option (this makes the message @@ -3473,28 +1734,7 @@ export const termwintype: GlobalOption = { * * (default off) */ -export const terse: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "terse"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "terse", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "terse"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "terse"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "terse", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "terse"); - }, -}; +export const terse: GlobalOption = new BooleanOption("terse"); /** * This option is obsolete. Use 'fileformats'. @@ -3506,28 +1746,7 @@ export const terse: GlobalOption = { * * (Vim default: on, Vi default: off) */ -export const textauto: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "textauto"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "textauto", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "textauto"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "textauto"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "textauto", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "textauto"); - }, -}; +export const textauto: GlobalOption = new BooleanOption("textauto"); /** * This option is obsolete. Use 'fileformat'. @@ -3538,42 +1757,7 @@ export const textauto: GlobalOption = { * (Win32: default on, * others: default off) */ -export const textmode: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "textmode"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "textmode", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "textmode"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "textmode"); - return Boolean(result ?? false); - }, - setLocal(denops: Denops, value: boolean): Promise { - return localOptions.set(denops, "textmode", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "textmode"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&textmode"); - return Boolean(result ?? false); - }, - setBuffer(denops: Denops, bufnr: number, value: boolean): Promise { - return setbufvar(denops, bufnr, "&textmode", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&textmode"); - return Boolean(result ?? false); - }, - setWindow(denops: Denops, winnr: number, value: boolean): Promise { - return setwinvar(denops, winnr, "&textmode", value); - }, -}; +export const textmode: LocalOption = new BooleanOption("textmode"); /** * The contents of this option controls various toolbar settings. The @@ -3606,28 +1790,7 @@ export const textmode: LocalOption = { * * *only for `+GUI_GTK`, `+GUI_Motif` and `+GUI_Photon`* */ -export const toolbar: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "toolbar"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "toolbar", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "toolbar"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "toolbar"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "toolbar", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "toolbar"); - }, -}; +export const toolbar: GlobalOption = new StringOption("toolbar"); /** * Controls the size of toolbar icons. The possible values are: @@ -3648,28 +1811,9 @@ export const toolbar: GlobalOption = { * * *only in the GTK+ GUI* */ -export const toolbariconsize: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "toolbariconsize"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "toolbariconsize", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "toolbariconsize"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "toolbariconsize"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "toolbariconsize", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "toolbariconsize"); - }, -}; +export const toolbariconsize: GlobalOption = new StringOption( + "toolbariconsize", +); /** * When on, the builtin termcaps are searched before the external ones. @@ -3686,28 +1830,9 @@ export const toolbariconsize: GlobalOption = { * * (default on) */ -export const ttybuiltin: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ttybuiltin"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "ttybuiltin", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ttybuiltin"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ttybuiltin"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "ttybuiltin", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ttybuiltin"); - }, -}; +export const ttybuiltin: GlobalOption = new BooleanOption( + "ttybuiltin", +); /** * Indicates a fast terminal connection. More characters will be sent to @@ -3729,28 +1854,7 @@ export const ttybuiltin: GlobalOption = { * * (default on) */ -export const ttyfast: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ttyfast"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "ttyfast", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ttyfast"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ttyfast"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "ttyfast", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ttyfast"); - }, -}; +export const ttyfast: GlobalOption = new BooleanOption("ttyfast"); /** * Name of the terminal type for which mouse codes are to be recognized. @@ -3826,28 +1930,7 @@ export const ttyfast: GlobalOption = { * * *only in Unix and VMS, doesn't work in the GUI; not available when compiled without `+mouse`* */ -export const ttymouse: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ttymouse"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "ttymouse", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ttymouse"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ttymouse"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "ttymouse", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ttymouse"); - }, -}; +export const ttymouse: GlobalOption = new StringOption("ttymouse"); /** * Maximum number of lines to scroll the screen. If there are more lines @@ -3857,56 +1940,14 @@ export const ttymouse: GlobalOption = { * * (default 999) */ -export const ttyscroll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ttyscroll"); - return (result ?? 0) as number; - }, - set(denops: Denops, value: number): Promise { - return options.set(denops, "ttyscroll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ttyscroll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ttyscroll"); - return (result ?? 0) as number; - }, - setGlobal(denops: Denops, value: number): Promise { - return globalOptions.set(denops, "ttyscroll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ttyscroll"); - }, -}; +export const ttyscroll: GlobalOption = new NumberOption("ttyscroll"); /** * Alias for 'term', see above. * * (default from $TERM) */ -export const ttytype: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "ttytype"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "ttytype", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "ttytype"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "ttytype"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "ttytype", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "ttytype"); - }, -}; +export const ttytype: GlobalOption = new StringOption("ttytype"); /** * When non-empty, the viminfo file is read upon startup and written @@ -4028,28 +2069,7 @@ export const ttytype: GlobalOption = { * * *not available when compiled without the `+viminfo` feature* */ -export const viminfo: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "viminfo"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "viminfo", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "viminfo"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "viminfo"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "viminfo", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "viminfo"); - }, -}; +export const viminfo: GlobalOption = new StringOption("viminfo"); /** * When non-empty, overrides the file name used for viminfo. @@ -4063,28 +2083,9 @@ export const viminfo: GlobalOption = { * * *not available when compiled without the `+viminfo` feature* */ -export const viminfofile: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "viminfofile"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "viminfofile", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "viminfofile"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "viminfofile"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "viminfofile", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "viminfofile"); - }, -}; +export const viminfofile: GlobalOption = new StringOption( + "viminfofile", +); /** * This option has the same effect as the 't_xs' terminal option. @@ -4094,28 +2095,9 @@ export const viminfofile: GlobalOption = { * * (default off) */ -export const weirdinvert: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "weirdinvert"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "weirdinvert", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "weirdinvert"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "weirdinvert"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "weirdinvert", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "weirdinvert"); - }, -}; +export const weirdinvert: GlobalOption = new BooleanOption( + "weirdinvert", +); /** * Highlight group name to use for this window instead of the Normal @@ -4123,42 +2105,7 @@ export const weirdinvert: GlobalOption = { * * (default empty) */ -export const wincolor: LocalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "wincolor"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "wincolor", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "wincolor"); - }, - async getLocal(denops: Denops): Promise { - const result = await localOptions.get(denops, "wincolor"); - return (result ?? "") as string; - }, - setLocal(denops: Denops, value: string): Promise { - return localOptions.set(denops, "wincolor", value); - }, - resetLocal(denops: Denops): Promise { - return localOptions.remove(denops, "wincolor"); - }, - async getBuffer(denops: Denops, bufnr: number): Promise { - const result = await getbufvar(denops, bufnr, "&wincolor"); - return (result ?? "") as string; - }, - setBuffer(denops: Denops, bufnr: number, value: string): Promise { - return setbufvar(denops, bufnr, "&wincolor", value); - }, - async getWindow(denops: Denops, winnr: number): Promise { - const result = await getwinvar(denops, winnr, "&wincolor"); - return (result ?? "") as string; - }, - setWindow(denops: Denops, winnr: number, value: string): Promise { - return setwinvar(denops, winnr, "&wincolor", value); - }, -}; +export const wincolor: LocalOption = new StringOption("wincolor"); /** * Specifies the name of the winpty shared library, used for the @@ -4173,28 +2120,7 @@ export const wincolor: LocalOption = { * * *only available when compiled with the `terminal` feature on MS-Windows* */ -export const winptydll: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "winptydll"); - return (result ?? "") as string; - }, - set(denops: Denops, value: string): Promise { - return options.set(denops, "winptydll", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "winptydll"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "winptydll"); - return (result ?? "") as string; - }, - setGlobal(denops: Denops, value: string): Promise { - return globalOptions.set(denops, "winptydll", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "winptydll"); - }, -}; +export const winptydll: GlobalOption = new StringOption("winptydll"); /** * When detecting xterm patchlevel 141 or higher with the termresponse @@ -4207,25 +2133,6 @@ export const winptydll: GlobalOption = { * * (default on) */ -export const xtermcodes: GlobalOption = { - async get(denops: Denops): Promise { - const result = await options.get(denops, "xtermcodes"); - return Boolean(result ?? false); - }, - set(denops: Denops, value: boolean): Promise { - return options.set(denops, "xtermcodes", value); - }, - reset(denops: Denops): Promise { - return options.remove(denops, "xtermcodes"); - }, - async getGlobal(denops: Denops): Promise { - const result = await globalOptions.get(denops, "xtermcodes"); - return Boolean(result ?? false); - }, - setGlobal(denops: Denops, value: boolean): Promise { - return globalOptions.set(denops, "xtermcodes", value); - }, - resetGlobal(denops: Denops): Promise { - return globalOptions.remove(denops, "xtermcodes"); - }, -}; +export const xtermcodes: GlobalOption = new BooleanOption( + "xtermcodes", +);