summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr2dev2 <ronak.badhe@gmail.com>2021-08-30 10:19:35 -0700
committerr2dev2 <ronak.badhe@gmail.com>2021-08-30 10:19:35 -0700
commita556afc67641707ce0772364234d72daec2c6abb (patch)
tree79a58a8edd3e42b849c119aeb68f56b4d9333b13
parent86ee44e00e48eaf575fa036ffbce6784f4447726 (diff)
Add A,I,$,0,o,O bindings
-rw-r--r--docs-vim.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/docs-vim.js b/docs-vim.js
index 26bf0fd..c12e1aa 100644
--- a/docs-vim.js
+++ b/docs-vim.js
@@ -10,8 +10,17 @@ vim = {
"b": [["ArrowLeft", true]], // ctrl + <-
"e": [["ArrowRight", true]], // ctrl + ->
// w is same behavior as eeb
- "w": [["ArrowRight", true], ["ArrowRight", true], ["ArrowLeft", true]]
- }
+ "w": [["ArrowRight", true], ["ArrowRight", true], ["ArrowLeft", true]],
+ "a": [["ArrowRight"]],
+ "A": [["ArrowDown", true]],
+ "I": [["ArrowUp", true]],
+ "$": [["ArrowDown", true]],
+ "0": [["ArrowUp", true]],
+ "o": [["ArrowDown", true], ["Enter"]],
+ "O": [["ArrowUp", true], ["ArrowLeft"], ["Enter"]]
+ },
+ "needsInsert": ["a", "A", "I", "o", "O"]
+
};
vim.addKeyMappings = function (baseMap) {
@@ -52,11 +61,6 @@ vim.normal_keydown = function (e) {
e.preventDefault();
e.stopPropagation();
- if (e.key == "a") {
- docs.pressKey(docs.codeFromKey("ArrowRight"));
- e.key = "i";
- }
-
if (e.key == "i") {
vim.switchToInsertMode();
return true;
@@ -86,6 +90,11 @@ vim.normal_keydown = function (e) {
vim.num = "";
});
+ if (vim.needsInsert.includes(e.key)) {
+ vim.switchToInsertMode();
+ return true;
+ }
+
if (e.key.indexOf("Arrow") == 0 || e.key == "Delete") {
if (vim.num.length == 0 || isNaN(vim.num)) {
vim.num = "1";
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback