Add Swedish keyboard layout

This commit is contained in:
AntonAderum 2016-01-08 10:43:17 +01:00
parent 6ae24ac68e
commit 521a09c8b2
3 changed files with 32 additions and 1 deletions

View File

@ -97,6 +97,9 @@ export function activate(context: vscode.ExtensionContext) {
registerCommand(context, 'extension.vim_backslash', () => handleKeyEvent("\\"));
registerCommand(context, 'extension.vim_oem_102', () => handleKeyEvent("oem_102"));
registerCommand(context, 'extension.vim_shift_oem_102', () => handleKeyEvent("shift+oem_102"));
context.subscriptions.push(modeHandler);
}

View File

@ -117,7 +117,9 @@
{ "key": "Ctrl+r", "command": "extension.vim_ctrl_r", "when": "editorTextFocus" },
{ "key": "Shift+,", "command": "extension.vim_<", "when": "editorTextFocus" },
{ "key": "Shift+.", "command": "extension.vim_>", "when": "editorTextFocus" }
{ "key": "Shift+.", "command": "extension.vim_>", "when": "editorTextFocus" },
{ "key": "oem_102", "command": "extension.vim_oem_102", "when": "editorTextFocus" },
{ "key": "Shift+oem_102", "command": "extension.vim_shift_oem_102", "when": "editorTextFocus" }
],
"configuration": {
"title": "Vim Configuration",

View File

@ -27,6 +27,8 @@ export class KeyboardLayout {
return new KeyboardLayout(new KeyMapperDeDeQwertz());
case 'da-DK (QWERTY)':
return new KeyboardLayout(new KeyMapperDaDKQwerty());
case 'sv-SE (QWERTY)':
return new KeyboardLayout(new KeyMapperSvSEQwerty());
default:
return new KeyboardLayout();
}
@ -105,3 +107,27 @@ class KeyMapperDaDKQwerty implements KeyMapper {
return this.mappings[key] || key;
}
}
class KeyMapperSvSEQwerty implements KeyMapper {
private mappings = {};
constructor() {
this.mappings = {
'oem_102': '<', // Only works when building from source atm, should work next vscode update
'shift+oem_102': '>', // Only works when building from source atm, should work next vscode update
'>': ':',
'<': ';',
':': '^',
'^': '&'
};
}
get name() : string {
return 'sv-SE (QWERTY)';
}
get(key : string) : string {
return this.mappings[key] || key;
}
}