Skip to content

Commit

Permalink
Add README for keymap wrappers #11
Browse files Browse the repository at this point in the history
  • Loading branch information
tshino committed Dec 5, 2021
1 parent b9c64c9 commit c5cd084
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ The followings are the details.
- If you have an `args` parameter for the target command, you could write it in `args.args`.
- If the target command is not a build-in command of VS Code, in other words, it is provided by an extension, likely you may need to add an `args.await` parameter in the wrapper. See below.

## How to enable your favorite keymap extension to record

See [Keymap Wrappers](keymap-wrapper/README.md).

## The `args.await` parameter

When this extension performs playback of a recorded command sequence, the commands should be executed one by one exactly. Specifically, each command in the sequence should end its execution and all the side effects of the command such as document change should be completed before the subsequent command is invoked. Otherwise, it may cause an unexpected result.
Expand Down
26 changes: 26 additions & 0 deletions keymap-wrapper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Keymap Wrappers

As described in the [README](../README.md) in the root of this repository, it is required to write a keymap wrapper for a keymap extension so that the keymap works combined with this Keyboard Macro extension.

A keymap wrapper is a list of keybindings to wrap each keyboard shortcut of a keymap to enable it to record.

To use a keymap wrapper, you simply insert the whole keybindings into your `keybindings.json`.

While you can create your own keymap wrapper for your favorite keymap extension by hand-writing, it is better to use a script to generate one based on the `package.json` of the keymap extension.

And of course the more better way is to use existing keymap wrapper.

## Available Keymap Wrappers

| Keymap extension | Extension ID | Keymap wrapper |
| ---------------- | ------------ | -------------- |
| Vz Keymap | `tshino.vz-like-keymap` | [tshino.vz-like-keymap.json](tshino.vz-like-keymap.json) |

I am currently working to add more keymap wrappers to support some popular keymap extensions.

## Making a Keymap Wrapper

1. `git clone` this repository
2. Run `npm install`
3. Make a config file for a new keymap wrapper in the `keymap-wrapper` directory. The file name should be in the form of `{EXTENSION-ID}.config.json`.
4. Run `npm run update-keymap-wrapper` (on bash) which downloads `package.json` of each target keymap extension into `keymap-wrapper/tmp` directory and generates and writes a keymap wrapper file into `keymap-wrapper` directory. (or run `node generator/gen-keymap-wrapper.js` to skip downloading)

0 comments on commit c5cd084

Please sign in to comment.