From 9399b1cdee43d648fd8649c15220afdc33fc3ec0 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke <marijnh@gmail.com> Date: Mon, 7 Dec 2015 15:43:13 +0100 Subject: [PATCH] [vim bindings] Use a simpler way to handle splitting on dashes --- keymap/vim.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/keymap/vim.js b/keymap/vim.js index 02ed53af3..c1532a179 100644 --- a/keymap/vim.js +++ b/keymap/vim.js @@ -292,12 +292,7 @@ // Keypress character binding of format "'a'" return key.charAt(1); } - var pieces = key.split('-'); - if (/-$/.test(key)) { - // If the - key was typed, split will result in 2 extra empty strings - // in the array. Replace them with 1 '-'. - pieces.splice(-2, 2, '-'); - } + var pieces = key.split(/-(?!$)/); var lastPiece = pieces[pieces.length - 1]; if (pieces.length == 1 && pieces[0].length == 1) { // No-modifier bindings use literal character bindings above. Skip. -- GitLab