commit daa244c0b335479e44253e912922edbcc2edc0a3 parent 69d8aa4131b496ed3c6cbca3128af494988d474a Author: Daniel Barlow <dan@telent.net> Date: Sat, 31 Dec 2022 15:48:32 +0000 add switch-to-buffer command Diffstat:
| M | buffer.fnl | | | 4 | ++++ |
| M | command.fnl | | | 9 | +++++++++ |
| M | dunlin.fnl | | | 5 | +++-- |
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/buffer.fnl b/buffer.fnl @@ -39,4 +39,8 @@ :match (fn [s] (collect [name buffer (pairs buffers)] (if (string.find name s) (values name buffer)))) + :next (fn [buffer] + (let [n (or (next buffers buffer.name) (next buffers))] + (. buffers n))) + }) diff --git a/command.fnl b/command.fnl @@ -23,6 +23,15 @@ #(Gtk.main_quit)) (define-command + "switch-to-buffer" + [[:buffer + Buffer.match + #(. (Buffer.next $1.buffer) :name)] + ] + (fn [{:frame frame :buffer buffer}] + (frame:show-buffer buffer))) + +(define-command "visit-location" [[:buffer Buffer.match diff --git a/dunlin.fnl b/dunlin.fnl @@ -12,8 +12,9 @@ "g" ["visit-location" {:buffer #$1.buffer }] "M-q" ["quit-browser" {}] "C-x" { - "C-c" ["quit-browser" {}] - } + "C-c" ["quit-browser" {}] + "b" ["switch-to-buffer" {}] + } }) (let [f (Frame.new my-keymap)