From d9a9ac09552b1bf50f1264594994e8f1a5f1eb3e Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 28 Jun 2024 01:35:19 +0400 Subject: [PATCH] add version ex command --- package.json | 2 +- src/types.d.ts | 2 +- src/vim.js | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8df2d82..1d6b3d3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "cm-runtests", "static": "tsc --noEmit", "testAll": "yarn run static && yarn run test && cd dev/cm5 && yarn run buildAndTest", - "build": "cm-buildhelper src/index.ts", + "build": "cm-buildhelper src/index.ts && node scripts/addVersion.cjs", "publish": "yarn run build && npm publish", "prepare": "yarn run build" }, diff --git a/src/types.d.ts b/src/types.d.ts index 289957b..f271162 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -184,7 +184,7 @@ export type vimOption = { } -export type ExFn = ()=> void; +export type ExFn = (cm: CodeMirrorV, params: ExParams)=> void; type allCommands = { keys: string, diff --git a/src/vim.js b/src/vim.js index 31e5f61..d0e299f 100644 --- a/src/vim.js +++ b/src/vim.js @@ -6216,6 +6216,10 @@ export function initVim(CodeMirror) { var exCommandDispatcher = new ExCommandDispatcher(); + vimApi.defineEx("version", "ve", (cm) => { + showConfirm(cm, "Codemirror-vim version: "); + }); + /** * @arg {CodeMirrorV} cm CodeMirror instance we are in. * @arg {boolean} confirm Whether to confirm each replace.