Commit faster and cleaner with keybound formatted commit prompt for VS Code.
- ⌨ Add & commit multiple files without using your mouse once.
- 💄 Improve your git history with two strong default presets.
- ⚙ Specify your own questions, types, scopes from a simple config file.
- ✅ Based on the well known commitizen and Conventional Commits.
This demo shows a simple commit, with the default setup you will get after installing the extension, with the conventional-commits
preset.
You can also find a demo of the cz-emoji
preset here.
The default keybinding for Commit
command is Cmd+Y
.
The default keybinding is the following:
{
"command": "vscode-commit-prompt.commit",
"key": "ctrl+y",
"mac": "cmd+y",
"when": "editorTextFocus"
}
You can edit it from your own vscode keybindings settings using the key vscode-commit-prompt.commit
.
You can also add a key for the Add
command only using vscode-commit-prompt.add
.
There is two way to handle the configuration of this extension.
The first is to use the configuration parameters from VSCode, you will find all the available settings under commit-prompt
keys.
The second is to use config files from the current repository you are working with.
The per repository config can be specified from 3 places:
.cprc
file placed at root..cp.json
file placed at root.- "config" key in
package.json
.
The format must be the following:
{
"config": {
"commit-prompt": {}
}
}
I recommend you to use the package.json config key.
VSCode settings exposes four parameters:
You can choose between conventional-commits
and cz-emoji
.
You can find preset types content here:
This parameter will be ignored if you overwrite types
or questions
from package.json
or .cprc
.
Default: conventional-commits
.
Whether or not you want the extension to show the add
each team you hit the commit
command.
Default: true
The max allowed length for the commit subject.
Default: 75
Show the output channel when you commit.
This allows three values: onError
, off
, always
.
Default: onError
Per repository config exposes three parameters: scopes
, types
and questions
.
Scopes is a text input by default, allowing you to define a custom scope on each commit.
If you want to lock scopes, and specify a list, you can by using the scope
attribute from config.
Specify a list of scope, and you will be prompted to chose between them on each commit.
const scopes: CpScopeType
export interface CpScopeType {
name: string
description: string
}
{
"config": {
"commit-prompt": {
"scopes": [
{
"name": "the-next-big-feature",
"description": "Use this scope when working on our next big feature"
}
]
}
}
}
If you specify this key in config, the default types will be overwritten by yours completely.
Default can be found in defaultTypes.ts, copy/pasting them can be a great starting point for your own config.
const types: CommitPromptType[]
interface CommitPromptType {
emoji?: string // The emoji displayed (optional)
code: string // The value added to the commit message (gitmojis works)
description: string // The description displayed in the prompt
name: string // An id
}
{
"config": {
"commit-prompt": {
"types": [
{
"emoji": "💄",
"code": ":lipstick:",
"description": "Updating the UI.",
"name": "ui"
}
]
}
}
}
Specifying questions
key will result in overwriting the complete default scenario.
This means you can easily build your own scenario from the config file.
Note that using this key will result in both types and scopes keys to be useless, as you will have to specify these keys directly from your questions payloads.
const questions: Question[]
export interface Question {
name: string
type: 'oneOf' | 'input'
placeHolder: string
emojiTypes?: CommitPromptType[]
scopes?: CpScopeType[]
format?: string
}
{
"config": {
"commit-prompt": {
"questions": [
{
"name": "type",
"placeHolder": "Select the type of change you are committing (type)",
"type": "oneOf",
"emojiTypes": [
{
"emoji": "💄",
"code": ":lipstick:",
"description": "Updating the UI.",
"name": "ui"
}
],
"format": "({value})"
}
]
}
}
}
This VSCode app has been written by Yaël GUILLOUX.
This has been heavily inspired by cz-emoji by ngryman.
If you have any question concerning this app, don't hesitate to reach me, on Twitter or by email.