jesseduffield / lazygit

simple terminal UI for git commands
MIT License
53.65k stars 1.87k forks source link

Add ability to copy commit message body to clipboard #4035

Open moha-gh opened 3 weeks ago

moha-gh commented 3 weeks ago

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.

mark2185 commented 3 weeks ago

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 commented 3 weeks ago

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

mark2185 commented 3 weeks ago

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 😅