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

Add ability to copy commit message body to clipboard #4035

Open
moha-gh opened this issue Nov 4, 2024 · 3 comments
Open

Add ability to copy commit message body to clipboard #4035

moha-gh opened this issue Nov 4, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@moha-gh
Copy link
Contributor

moha-gh commented Nov 4, 2024

Is your feature request related to a problem? Please describe.

I frequently need to copy the commit message body to the clipboard. Currently this isn't possible, so I copy the whole message (via y, m) and strip the subject manually.

Describe the solution you'd like

An extra "Commit body" entry in the "Copy to clipboard" menu that copies the body of the commit message (i.e. the body with the subject and the empty separator line after that removed) to the clipboard.

Describe alternatives you've considered

n/a

Additional context

I'd be happy to (try to) file a PR for this, if the feature is deemed useful.

@moha-gh moha-gh added the enhancement New feature or request label Nov 4, 2024
@mark2185
Copy link
Collaborator

mark2185 commented Nov 4, 2024

What about a custom command as an alternative that would run something like this?

$> git log --format=%B -n 1 <commit> | xclip -sel clipboard

@moha-gh
Copy link
Contributor Author

moha-gh commented Nov 4, 2024

Thanks, I'll give that a try! I guess that would work, but two (possible) limitations come to mind:

  • os.copyToClipboardCmd is not taken into account automatically if set
  • It would be tricky to get assign a keybinding that mimics the other 'copy attribute' commands, i.e. y, b for example, wouldn't it? And from the list of contexts I guess it would need to be a global one since the corresponding menu is not listed?

@mark2185
Copy link
Collaborator

mark2185 commented Nov 4, 2024

os.copyToClipboardCmd is not taken into account automatically if set

Correct.

It would be tricky to get assign a keybinding that mimics the other 'copy attribute' commands, i.e. y, b for example, wouldn't it?

Not just tricky, but impossible. But hey, it's a workaround, not a solution that you had envisioned 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants