71/dance

Thoughts on integrating edamagit

Closed this issue · 4 comments

edamagit is a cool extension that mimics magit, a famous git interface for Emacs. This extension opens read-only buffers with status information, and the user can press keys to trigger git actions. I'm trying to figure out the best way to integrate that with Dance. The two main options I'm thinking about are:

  1. Support as many magit keys as possible. This is easy to implement by pasting in these key settings and commenting out any unwanted keys.
  2. Support the critical magit keys and stuff the rest behind a Dance menu. This one is more work to implement, but it's nice in that I won't remember the less-used keys anyway.

I'm not a magit (or git) expert. One reason for doing this is to try to get better at git operations.

Here are the edamagit keys:

Popup and dwim commands
  A Cherry-pick      b Branch           c Commit
  d Diff             f Fetch            F Pull
  I Ignore           l Log              m Merge
  M Remote           P Push             r Rebase
  t Tag              V Revert           X Reset
  y Show Refs        z Stash            shift+1 Run
  shift+5 Worktree   o Submodules       shift+4 Process Log

Applying changes
  a Apply          s Stage          u Unstage
  v Reverse        S Stage all      U Unstage all
  k Discard

Essential commands
  g        refresh current buffer
  TAB      toggle section at point
  RET      visit thing at point
  shift+4  show git process view
  q        exit / close magit view

  ctrl+j Move cursor to next entity
  ctrl+k Move cursor to previous entity

The main conflicts where I really want Dance/Kakoune keys are: k and x/X.

I suspect the most important magit keys are: TAB, RET, q, s, S, u, U, b, and c.

I'll experiment with these two approaches, but I'm curious if anyone has any suggestions...

Here's my first cut at a menu for magit. It seems to work decently well. I bound it to m in magit buffers.

        "magit": {
            "items": {
                "g": { "text": "refresh", "command": "magit.refresh" },
                "f": { "text": "fetching", "command": "magit.fetching" },
                "b": { "text": "branching", "command": "magit.branching" },
                "m": { "text": "merging", "command": "magit.merging" },
                "r": { "text": "rebasing", "command": "magit.rebasing" },
                "x": { "text": "reset-mixed", "command": "magit.reset-mixed" },
                "X": { "text": "resetting", "command": "magit.resetting" },
                "H": { "text": "reset-hard", "command": "magit.reset-hard" },
                "c": { "text": "commit", "command": "magit.commit" },
                "M": { "text": "remoting", "command": "magit.remoting" },
                "l": { "text": "logging", "command": "magit.logging" },
                "y": { "text": "show-refs", "command": "magit.show-refs" },
                "d": { "text": "diffing", "command": "magit.diffing" },
                "t": { "text": "tagging", "command": "magit.tagging" },
                "A": { "text": "cherry-picking", "command": "magit.cherry-picking" },
                "V": { "text": "reverting", "command": "magit.reverting" },
                "i": { "text": "ignoring", "command": "magit.ignoring" },
                "!": { "text": "running", "command": "magit.running" },
                "%": { "text": "worktree", "command": "magit.worktree" },
                "P": { "text": "pushing", "command": "magit.pushing" },
                "F": { "text": "pulling", "command": "magit.pulling" },
                "z": { "text": "stashing", "command": "magit.stashing" },
                "o": { "text": "submodules", "command": "magit.submodules" },
                "k": { "text": "discard", "command": "magit.discard-at-point" },
                "a": { "text": "apply", "command": "magit.apply-at-point" },
                "v": { "text": "reverse", "command": "magit.reverse-at-point" },
                "s": { "text": "stage", "command": "magit.stage" },
                "S": { "text": "stage-all", "command": "magit.stage-all" },
                "u": { "text": "unstage", "command": "magit.unstage" },
                "U": { "text": "unstage-all", "command": "magit.unstage-all" },
                "$": { "text": "process-log", "command": "magit.process-log" },
                "q": { "text": "quit", "command": "magit.quit" },
           }
        },
71 commented

I haven't tried your keybindings yet as I'm not familiar with edamagit (though I'd like to try it out at some point) but if you feel they're good and that other users may benefit from them, I encourage you to add them to the wiki. If you do so, please link to this issue as well.

Thanks for that. I had missed that you had enabled the wiki. So far, I'm liking it. I'll add something to the wiki once my usage settles a bit.