lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Support for gitmoji

Open edwinclement08 opened this issue 3 years ago • 10 comments

Is your feature request related to a problem? Please describe. Well, its a minor convenience right now, but feel that it would help a lot in standardizing commit messages. Would like to integrate gitmoji in the commit flow, based on a config flag.

Describe the solution you'd like Those who enable the feature can use the gitmoji cli within the commit window. Gitmoji-cli(https://github.com/carloscuesta/gitmoji-cli) already has a clear interactive flow. We can have a tab based form(like html) that can tab through gitmoji, scope, commit title, message

I understand this would be hard and time consuming to implement. Another way to do this is to use the git hooks feature of gitmoji. The hook is triggered on git commit. I believe this is something I myself can implement given some guidance.

Describe alternatives you've considered Currently, I am exiting lazygit and then committing in the shell before re-entering lazygit to push changes.

Additional context How Gitmoji CLI looks gitmoji

edwinclement08 avatar May 08 '21 20:05 edwinclement08

@edwinclement08 This sounds like a worthwhile feature. I don't think I'll be able to submit a PR for this anytime soon (others are welcome to though!) but you can access it from within lazygit via a customcommand which opens gitmoji in a subprocess. See the examples here: https://github.com/jesseduffield/lazygit/wiki/Custom-Commands-Compendium

jesseduffield avatar May 09 '21 07:05 jesseduffield

Will check it out.

edwinclement08 avatar May 10 '21 08:05 edwinclement08

Hello any updates on this ? Would love to have this feature the least we can have is emoji displayed instead of just plain text

ShivamJoker avatar Dec 04 '21 09:12 ShivamJoker

I'm a gitmoji user and in my case having the gitmoji hooks breaks the basic commit function. I enter my commit message and it just hangs and never completes. the offending gitmoji hook is prepare-commit-msg:

#!/bin/sh
# gitmoji as a commit hook
exec </dev/tty
gitmoji --hook $1 $2

It might be good to add general support for interactive prepare-commit-msg hooks like this, but a simple gitmoji fix would be nice as well.

ablacklama avatar Feb 01 '22 02:02 ablacklama

Work around for Mac Users:

I have Raycast installed, which has a plugin for gitmoji. I have a shortcut for opening the gitmoji plugin and can search and add the gitmoji into the commit message in Lazygit. You don't have to leave the keyboard to do this.

kjvdven avatar Jan 22 '24 20:01 kjvdven

I managed to have something that I like with that, if that helps

customCommands:
- command: git commit -m '{{ .Form.emoji }} {{ .Form.message }}'
  context: files
  description: Commit changes using gitmojis
  key: C
  prompts:
  - command: gitmoji -l
    filter: ^(.*?) - (:.*?:) - (.*)$
    key: emoji
    labelFormat: '{{ .group_1 }} - {{ .group_3 }}'
    title: 'Select a gitmoji:'
    type: menuFromCommand
    valueFormat: '{{ .group_2 }}'
  - key: message
    title: 'Enter a commit message:'
    type: input

Sail0rd avatar Jul 18 '24 19:07 Sail0rd

Hmmm, I don't know why (or if I am the only one with this issue) but somehow it selects the text instead of the emoji itself, is it normal?

I installed gitmoji-cli via npm (npm i -g gitmoji-cli) image

Mourishitz avatar Aug 08 '24 12:08 Mourishitz

Hmmm, I don't know why (or if I am the only one with this issue) but somehow it selects the text instead of the emoji itself, is it normal?

I installed gitmoji-cli via npm (npm i -g gitmoji-cli) image

yes that's normal, after on your repo you will see an emoji instead of the text, it's how gitmoji work behind the scene as well

Sail0rd avatar Aug 08 '24 12:08 Sail0rd

Got it!! Appreciate it, I´ve never used gitmoji-cli actually, I've been pasting emojis manually ever since

Mourishitz avatar Aug 08 '24 12:08 Mourishitz

If you want to do it like this it's still possible, you'll just have to change the {{ .group_2 }} in {{ .group_1 }} 👍

Sail0rd avatar Aug 08 '24 13:08 Sail0rd