[[Lazygit]]で[[カスタムコマンド (Lazygit)|カスタムコマンド]]を定義する方法。[[Lazygit]]の設定ファイルに以下のように追加する。 ```yaml customCommands: - key: 'a' context: 'files' command: "git {{if .SelectedFile.HasUnstagedChanges}} add {{else}} reset {{end}} {{.SelectedFile.Name | quote}}" description: 'Toggle file staged' ``` ## ショートカットキーを設定したくない場合 `?`で[[カスタムコマンド (Lazygit)|カスタムコマンド]]を実行できるように登録したいが、ショートカットキーで発動したくないケースがある。しかし、`key`は必須プロパティなので省略はできない。この場合は`key`に空文字を指定する。 ```yaml customCommands: - key: '' context: 'files' command: "git {{if .SelectedFile.HasUnstagedChanges}} add {{else}} reset {{end}} {{.SelectedFile.Name | quote}}" description: 'Toggle file staged' ```