Keymap from keystroke to keystroke in your keymap.cson
.
RULE: Command name must start with keystroke<space>
.
'atom-text-editor':'ctrl-a': 'keystroke ctrl-e ctrl-p''atom-text-editor.vim-mode-plus.normal-mode':'space j': 'keystroke 5 j''space k': 'keystroke 5 k'
keymap.cson
was loaded, collect keystroke
prefixed commands from loaded keymaps.For historical reason, there is two way to register keystroke commands.
keystroke.commands
configuration( older way ).keymap.cson
keymap.cson
'atom-text-editor':'ctrl-cmd-c': 'keystroke ctrl-shift-w backspace''atom-text-editor.vim-mode-plus.normal-mode':'C': 'keystroke c i w'
config.cson
config.cson
"*":"keystroke":commands: [{name: "delete-current-word"keystroke: "ctrl-shift-w backspace"scope: 'atom-workspace' # atom-workspace is default, just for demo.}{name: "change-inner-word"keystroke: "c i w" # using vim-mode-plus keymap}]
keymap.cson
'atom-text-editor':'ctrl-cmd-c': 'keystroke:delete-current-word''atom-text-editor.vim-mode-plus.normal-mode':'C': 'keystroke:change-inner-word'
Currently just provide buildCommandSpecsFromKeyBindings
function only.
Which can be used to process keymap file bundled in your developing package.
I'll explain with example-pkg
package which bundles it's own keymap in keymaps/example-pkg.cson
file.
You have to do TWO things.
package.json
.consumeKeystroke
function in your package's main file.consumeKeystorke
of your pkg's main file is called when keystorke pkg become available"consumedServices": {"keystroke": {"versions": {"^1.0.0": "consumeKeystroke"}},},
activate() {this.keystrokeCommands = new CompositeDisposable()},deactivate() {this.keystrokeCommands.dispose()},consumeKeystroke(service) {// get it's own keymap filePathsconst filePaths = atom.packages.getLoadedPackage("example-pkg").getKeymapPaths()for (const filePath of filePaths) {this.keystrokeCommands.add(service.registerKeystrokeCommandsFromFile(filePath))}},
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.