diff --git a/README.md b/README.md index 2a2770f..375c330 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ In addition to that: - `surround` - surround your selected text in visual mode or word in normal mode with text. - `pasteinto` - paste your current clipboard into your selected text in visual mode or word in normal mode. Useful for creating hyperlinks. - `jscommand` and `jsfile` - extend Vim mode using JavaScript snippets. +- `source` - loads Vim commands from a file (relative to the vault root). Commands that fail don't generate any visible error for now. @@ -219,8 +220,6 @@ nmap gT :tabprev ## Fixed Keyboard Layout in Normal Mode -**Note:** this is currently unsupported for the new (CM6-based) editor. - In many languages and keyboard layouts it becomes problematic or plain impossible to use Vim keys. The Vim keys are located in different positions on some keyboard layouts, which could be confusing when switching layouts, and on some layouts (e.g. non-Western languages) the keys for Vim movements just don't exist. @@ -287,6 +286,14 @@ See [here](JsSnippets.md) for the full example, and please contribute your own! ## Changelog +### 0.9.0 + +Multiple fixes and improvements, all contributed by @jiyee - thank you! + +- Fixed chord and Vim mode display issues (https://github.com/esm7/obsidian-vimrc-support/issues/149). +- Added `source` command (https://github.com/esm7/obsidian-vimrc-support/issues/157) +- Fixed Normal Mode Layout is back! + ### 0.8.0 - The plugin is now marked as supporting mobile; thanks @Geniucker for taking this step, testing and documenting it! diff --git a/main.ts b/main.ts index 8677ef6..e0c8a93 100644 --- a/main.ts +++ b/main.ts @@ -650,9 +650,9 @@ export default class VimrcPlugin extends Plugin { defineSource(vimObject: any) { vimObject.defineEx('source', '', async (cm: any, params: any) => { - console.log(params); + if (params?.args?.length > 1) + throw new Error("Expected format: source [fileName]"); const fileName = params.argString.trim(); - let vimrcContent = ''; try { this.app.vault.adapter.read(fileName).then(vimrcContent => { this.loadVimCommands(vimrcContent); diff --git a/manifest.json b/manifest.json index b440388..42b5ed0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-vimrc-support", "name": "Vimrc Support", - "version": "0.8.0", + "version": "0.9.0", "description": "Auto-load a startup file with Obsidian Vim commands.", "minAppVersion": "0.15.3", "author": "esm", diff --git a/package.json b/package.json index e642918..c9b1394 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-vimrc-support", - "version": "0.8.0", + "version": "0.9.0", "description": "Auto-load a startup file with Obsidian Vim commands.", "main": "main.js", "scripts": { @@ -13,13 +13,13 @@ "devDependencies": { "@rollup/plugin-commonjs": "^15.1.0", "@rollup/plugin-node-resolve": "^9.0.0", - "@rollup/plugin-typescript": "^6.1.0", + "@rollup/plugin-typescript": "^11.0.0", "@types/node": "^14.14.6", "codemirror": "^5.62.2", "keyboardevent-from-electron-accelerator": "*", - "obsidian": "^0.15.4", + "obsidian": "^1.1.1", "rollup": "^2.33.0", "tslib": "^2.0.3", - "typescript": "^4.0.5" + "typescript": "^4.9.4" } }