From 2a8bfbf94690ea95773622198064326921cf95eb Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 15 Sep 2026 01:05:38 -0700 Subject: glide: Add function to copy commit hash from URL This works for github and sourcehut for the moment. --- glide/.config/glide/glide.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/glide/.config/glide/glide.ts b/glide/.config/glide/glide.ts index 48430db..b7dfa61 100644 --- a/glide/.config/glide/glide.ts +++ b/glide/.config/glide/glide.ts @@ -436,3 +436,18 @@ glide.autocmds.create("UrlEnter", { 'geo.provider.network.url', 'data:application/json,{"location": {"lat": 45.542805, "lng": -122.7369563}, "accuracy": 100.0}'); }); + +glide.autocmds.create("UrlEnter", /git(\.sr\.ht|hub\.com)\/.*?\/commit\//, async () => { + glide.buf.keymaps.set( + "normal", + "yc", + () => { + const parts = glide.ctx.url.pathname.split('/'); + + if (parts[parts.length - 2] === 'commit') { + navigator.clipboard.writeText(parts[parts.length - 1]); + } else { + console.error('no deal', parts[parts.length - 2]); + } + }); +}); -- cgit v1.3-2-g0d8e