Merge branch 'master' into v2
This commit is contained in:
commit
f8c19b0ef2
5 changed files with 21 additions and 71 deletions
|
|
@ -1,5 +1,4 @@
|
|||
const {readFileSync} = require('fs');
|
||||
const {normalize} = require('../utils/keymaps-normalize');
|
||||
const {defaultPlatformKeyPath} = require('./paths');
|
||||
|
||||
const commands = {};
|
||||
|
|
@ -8,7 +7,7 @@ const keys = {};
|
|||
const _setKeysForCommands = function(keymap) {
|
||||
for (const command in keymap) {
|
||||
if (command) {
|
||||
commands[command] = normalize(keymap[command]);
|
||||
commands[command] = keymap[command].toLowerCase();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -39,8 +38,8 @@ const _extend = function(customsKeys) {
|
|||
if (customsKeys) {
|
||||
for (const command in customsKeys) {
|
||||
if (command) {
|
||||
commands[command] = normalize(customsKeys[command]);
|
||||
keys[normalize(customsKeys[command])] = command;
|
||||
commands[command] = customsKeys[command];
|
||||
keys[customsKeys[command]] = command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
const {getKeymaps} = require('../config/keymaps');
|
||||
|
||||
const normalize = keybinding => {
|
||||
function sortAlphabetically(a, b) {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
|
||||
return keybinding
|
||||
.toLowerCase()
|
||||
.split('+')
|
||||
.sort(sortAlphabetically)
|
||||
.join('+');
|
||||
};
|
||||
|
||||
const findCommandByKeys = (keys, commands) => {
|
||||
return commands[normalize(keys)];
|
||||
};
|
||||
|
||||
const getCommand = keys => {
|
||||
return findCommandByKeys(keys, getKeymaps().keys);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
normalize,
|
||||
findCommandByKeys,
|
||||
getCommand
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue