Skip to content

Commit

Permalink
Merge pull request #221 from adiviness/no_conf_input_bug
Browse files Browse the repository at this point in the history
keymap configurations only override defaults that are changed
  • Loading branch information
jpoon committed May 16, 2016
2 parents 3aee721 + a835109 commit 95003c2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/mode/modeHandler.ts
Expand Up @@ -21,14 +21,27 @@ export class ModeHandler implements vscode.Disposable {
this._configuration = Configuration.fromUserFile();

// This probably should be somewhere else but will work for now.
// TODO: Only override default settings specified instead of all of them
let normalKeymap = vscode.workspace.getConfiguration("vim")
let normalKeymap = cmds.newDefaultNormalKeymap();
let insertKeymap = cmds.newDefaultInsertKeymap();
let visualKeymap = cmds.newDefaultVisualKeymap();
let normalKeymapConf = vscode.workspace.getConfiguration("vim")
.get("normalModeKeybindings", cmds.newDefaultNormalKeymap());
let insertKeymap = vscode.workspace.getConfiguration("vim")
let insertKeymapConf = vscode.workspace.getConfiguration("vim")
.get("insertModeKeybindings", cmds.newDefaultInsertKeymap());
let visualKeymap = vscode.workspace.getConfiguration("vim")
let visualKeymapConf = vscode.workspace.getConfiguration("vim")
.get("visualModeKeybindings", cmds.newDefaultVisualKeymap());

let copyFunc = function (to: {[key: string]: cmds.Command},
source: {[key: string]: cmds.Command}) {
for (var key in source) {
if (source.hasOwnProperty(key)) {
to[key] = source[key];
}
}
};
copyFunc(normalKeymap, normalKeymapConf);
copyFunc(insertKeymap, insertKeymapConf);
copyFunc(visualKeymap, visualKeymapConf);
this._motion = new Motion(null);
this._modes = [
new NormalMode(this._motion, this, normalKeymap),
Expand Down

0 comments on commit 95003c2

Please sign in to comment.