From 0a3aac427b78be95edf4138f7d0f24b6c85e2801 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 13 Jun 2025 18:07:33 -0600 Subject: [PATCH] add jj tug alias --- dot_config/jj/config.toml.tmpl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dot_config/jj/config.toml.tmpl b/dot_config/jj/config.toml.tmpl index cacf565..9758e9f 100644 --- a/dot_config/jj/config.toml.tmpl +++ b/dot_config/jj/config.toml.tmpl @@ -6,6 +6,19 @@ email = {{ .email | quote }} editor = "nvim" merge-editor = "vscode" pager = "delta" +diff-formatter=":git" -[ui.diff] -format = "git" +[aliases] + +# tug - move the nearest bookmark to the nearest non-empty change at or before @ +tug = ["bookmark", "move", "--from", "closest_bookmark(@)", "--to", "closest_nonempty(@)"] + +# closestbookmark - show the name of the nearest bookmark at or before @ +closestbookmark = ["util", "exec", "--", "bash", "-c", """ +jj log --no-graph -r 'closest_bookmark(@)' -T 'stringify(local_bookmarks.map(|b| b.name()).join("\n")).first_line()++"\n"' +""", ""] + +[revset-aliases] + +'closest_bookmark(to)' = 'heads(::to & bookmarks())' +'closest_nonempty(to)' = 'heads(::to ~ empty())'