Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: command to copy commit_id from line annotation and hyperlink commit id to external git client #567

Open
arpit-uno opened this issue Feb 12, 2022 · 2 comments

Comments

@arpit-uno
Copy link

Description

Feature requests or proposals:

A command to copy the commit id from current line annotation. In the following screengrab, as you one can see the commitID, df799d7. This commit id should be able to be copied via a keyboard shortcut and if possible, can be a link, when clicked opens the commit in an external git client say Meld or git-fork or git-kraken.

image

Support Info

  • Sublime Text 4126
  • Platform: windows
  • Arch: x64
  • GitGutter 1.11.7
  • Install via PC: True
  • git version 2.32.0.windows.2
  • mdpopups 4.2.1
  • markdown 3.2.2
  • pygments 2.1a0
  • jinja2 2.10.1
@ljames8
Copy link

ljames8 commented May 25, 2023

I just stumbled upon this, having the same idea in mind.
I successfully tried a quick and dirty proof of concept for ST4 that just copies the commit hash to the clipboard when clicking on the inline commit text

diff --git a/GitGutter.sublime-settings b/GitGutter.sublime-settings
index 058478e..53360a4 100644
--- a/GitGutter.sublime-settings
+++ b/GitGutter.sublime-settings
@@ -179,7 +179,7 @@
     //   {{line_committer_tz}   -- the timezone string of commit
     //   {{line_summary}}       -- the first line of the commit message
     //   {{line_previous}}      -- the hash of the previous commit
-    "line_annotation_text": "{% if line_commit and line_commit[:7] != '0000000' %} {{line_commit[:7]}} | {% endif %}{{line_author}} ({{line_author_age}}) · {{line_summary}}",
+    "line_annotation_text": "{% if line_commit and line_commit[:7] != '0000000' %} <a href={{line_commit}}>{{line_commit[:7]}}</a> | {% endif %}{{line_author}} ({{line_author_age}}) · {{line_summary}}",

     //
     // Status Bar
diff --git a/modules/annotation.py b/modules/annotation.py
index b51b213..5ab9691 100644
--- a/modules/annotation.py
+++ b/modules/annotation.py
@@ -256,6 +256,7 @@ class GitGutterLineAnnotationST4(object):
                 annotation_color=foreground,
                 flags=(sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE |
                        sublime.HIDE_ON_MINIMAP),
+                on_navigate=sublime.set_clipboard,
             )

 if int(sublime.version()) >= 4000:

@Kentzo
Copy link

Kentzo commented Oct 13, 2023

I need this feature too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants