From eb58cfd9a9fa70388707377b2476a8ef5a96295b Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 6 Mar 2026 23:55:50 -0800 Subject: glide: Add some window splitting functions --- glide/.config/glide/glide.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'glide') diff --git a/glide/.config/glide/glide.ts b/glide/.config/glide/glide.ts index 045cb50..c505eab 100644 --- a/glide/.config/glide/glide.ts +++ b/glide/.config/glide/glide.ts @@ -424,3 +424,45 @@ glide.keymaps.set('normal', 'kb', async () => { })), }); }); + + +// Split windows + +const split_window = glide.excmds.create({ + name: 'split_window', + description: 'Ask for a tab and show it in a split with this window', +}, async () => { + const activeTab = await glide.tabs.active(); + const tabs = await glide.tabs.query({}); + + glide.commandline.show({ + title: "Show other", + options: tabs.map(t => ({ + label: t.title, + async execute() { + glide.unstable.split_views.create([activeTab.id, t.id]); + } + })), + }); +}); + +const unsplit_window = glide.excmds.create({ + name: 'unsplit_window', + description: 'Remove the current split of windows', +}, ({ tab_id }) => { + glide.unstable.split_views.separate(tab_id); +}); + +const other_window = glide.excmds.create({ + name: 'other_window', + description: 'Focus other window', +}, async ({ tab_id }) => { + const split_tabs = await glide.unstable.split_views.get(tab_id); + const other_tab = split_tabs.tabs.filter(t => t.id !== tab_id)[0]; + + await browser.tabs.update(other_tab.id, { active: true }); +}); + +glide.keymaps.set('normal', '4b', 'split_window'); +glide.keymaps.set('normal', '1', 'unsplit_window'); +glide.keymaps.set('normal', '', 'other_window'); -- cgit v1.3-2-g0d8e