Skip to content

Using Editors

Krzysztof Czarnecki edited this page Sep 26, 2021 · 3 revisions

Using Editors

You will likely want to use your editor to be able to write multiline commit messages. In such case you can use:

  • from mkcommit import editor - generic editor support. Should work on macOS and Linux, not guaranteed to work on Windows. Will respect the settings in git config core.editor if they're present and will use system configuration otherwise.
  • from mkcommit import vscode - starts a VSCode editor with a temp file open.

The temp file will be read by mkcommit right when you close the file and the contents will be inserted wherever you referenced them within the template. For example:

from mkcommit import CommitMessage, vscode, to_stdout

def commit():
    return CommitMessage("whatever", vscode())

if __name__ == "__main__":
    to_stdout(commit())

The above will use VSCode editor to provide the long-body commit message.

This functionality is not very stable yet, so use it with care.

Clone this wiki locally