aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2026-09-15 01:05:38 -0700
committerGravatar Tom Willemse2026-09-15 01:05:38 -0700
commit2a8bfbf94690ea95773622198064326921cf95eb (patch)
tree491bf502bad26fafb1cc9b5f2bf19213411d939c
parent67e39f46e1c1d56084154a1385e191cfee25f1e5 (diff)
downloadnew-dotfiles-2a8bfbf94690ea95773622198064326921cf95eb.tar.gz
new-dotfiles-2a8bfbf94690ea95773622198064326921cf95eb.zip
glide: Add function to copy commit hash from URL
This works for github and sourcehut for the moment.
-rw-r--r--glide/.config/glide/glide.ts15
1 files changed, 15 insertions, 0 deletions
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]);
+ }
+ });
+});