craftzdog / dotfiles-public

My personal dotfiles
6.43k stars 1.16k forks source link

fix: Commitizen needs specify which command #170

Closed tony-sn closed 6 months ago

tony-sn commented 6 months ago

Hi craftzdog,

When I follow your config for lazygit, whenever I click C it will show the CLI screen with only option press enter to return to lazygit and when I look at lazygit the example instruction is shown as

customCommands:
  - key: "C"
    command: "git cz c"
    description: "commit with commitizen"
    context: "files"
    loadingText: "opening commitizen commit tool"
    subprocess: true

So it is likely we need to append c at the end of the command, to enhance normal c shortcut from lazygit to commitizen

craftzdog commented 6 months ago

It still says the same message:

Screenshot 2024-05-09 at 22 00 37

craftzdog commented 6 months ago

It gets an error

error: pathspec 'c' did not match any file(s) known to git

where is the c option documented? https://github.com/commitizen/cz-cli

tony-sn commented 6 months ago

Hi Takuya,

I believe it's the link from lazygit: lazygit custom commands

Also, lazygit's config file located differently based on OS: Linux: ~/.config/lazygit/config.yml MacOS: ~/Library/Application\ Support/lazygit/config.yml Windows: %LOCALAPPDATA%\lazygit\config.yml (default location, but it will also be found in %APPDATA%\lazygit\config.yml

Source: Lazygit User Config

Therefore, if you're using a Mac, you need to copy custom command to Application Support location above, it looks like lazygit on Mac will not understand config from .config/ folder

One more thing I notice, you may install commitizen from npm install commitizen -g, while Mac or Linux can use brew install commitizen

EDIT: I see you might change the config folder for mac export XDG_CONFIG_HOME="$HOME/.config", so perhaps the way commitizen installed would be the case here.

This is the result from my Mac after the config:

PR_Commitizen
craftzdog commented 6 months ago

The commitizen on Homebrew is a different tool. It is confusing that they have the same name. You have to install it via npm.