← Back to context

Comment by rustystump

4 days ago

While i am sure this sounds insane i had to drop zed due to lack of the “last file dif” button gitlens vscode plugin provides.

It is a godsend on quickly debugging the why of things. If anyone knows how to replicate the same functionality with the same number of clicks in zed, id happily switch back to it.

Seems like a minor thing to change IDEs over. Would a Zed task that runs the relevant git command work for you? e.g.

    // ${XDG_CONFIG_HOME}/zed/tasks.json
    [
      {
        "command": "git --paginate log --follow -p -m -1 ${ZED_FILE}",
        "label": "last-file-diff:${ZED_FILE}",
        "shell": { "program": "sh" }
      }
    ]

You can even throw a keybind on it if you'd like:

    // ${XDG_CONFIG_HOME}/zed/keymap.json
    [
      {
        "context": "Editor && mode == full",
        "bindings": {
          "ctrl-shift-g d": [
            "task::Spawn",
            { "task_name": "last-file-diff:${ZED_FILE}" }
          ]
        }
      }
    ]

I am not familiar with gitlens so not sure how close this gets you but you should be able to replicate the functionality you need from the git CLI and some light scripting. This can be a jumping off point maybe. If you want to view the diff using the zed diff viewer, you can do so using `zed --diff`, as demonstrated in this GitHub discussion: https://github.com/zed-industries/zed/discussions/33503#disc...

i use the gutter markers, where a click shows the chunk-diff.

there is also inline-blame, both are native (ie. no plugins required)

  • Nice. I dont like the gutters taking up space. I like the ux of click, see dif of last change, click see the next last change.

    It seems such a silly thing but it made me not use zed at least until vscode eats all my ram again.