From aaa33d7f360a28bd51ce3c296d5a0f655399f67e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 3 Aug 2020 15:49:30 +0200 Subject: [PATCH] Add Alt+Up/Down key bindings --- keybindings.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/keybindings.js b/keybindings.js index 524b720..96d83bd 100644 --- a/keybindings.js +++ b/keybindings.js @@ -36,6 +36,39 @@ export const keybindings = [ } }, }, + { + key: "ArrowUp", + altKey: true, + description: "Jump to the previous buffer", + execute: (app) => { + var prev = null; + for (var buf of app.state.buffers.values()) { + if (app.state.activeBuffer == buf.name) { + if (prev) { + app.switchBuffer(prev.name); + } + break; + } + prev = buf; + } + }, + }, + { + key: "ArrowDown", + altKey: true, + description: "Jump to the next buffer", + execute: (app) => { + var found = false; + for (var buf of app.state.buffers.values()) { + if (found) { + app.switchBuffer(buf.name); + break; + } else if (app.state.activeBuffer == buf.name) { + found = true; + } + } + }, + }, ]; export function setup(app) {