22 <h1 align =" center " >commit-msg-sg.nvim</h2 >
33</p >
44
5- <p align =" center " >
6- Write git commit message with AI (sg.nvim).
7- </p >
5+ Write git commit message with AI ([ sg.nvim] ( https://github.com/sourcegraph/sg.nvim ) , [ Cody] ( https://sourcegraph.com/cody ) ).
86
97<div align =" center " >
108 > Drag your video (<10MB) here to host it for free on GitHub.
@@ -34,8 +32,34 @@ Snippet
3432``` lua
3533{
3634 ' towry/commit-msg-sg.nvim' ,
35+ dependencies = {
36+ ' sourcegraph/sg.nvim' ,
37+ },
38+ -- all options are optional, you can leave it as empty table `{}`.
3739 opts = {
38- -- see doc
40+ cwd = function ()
41+ return vim .uv .cwd ()
42+ end ,
43+ -- auto attach on gitcommit filetype.
44+ auto_setup_gitcommit = true ,
45+ -- auto create user command `WriteGitCommitMessage`.
46+ auto_setup_command = true ,
47+ -- callback when AI is started and attached to current buffer. (client, bufnr)
48+ -- You can create your own buffer local commands or keymaps in this callback.
49+ on_attach = nil ,
50+ -- Ghost text that will be presenting when AI is working.
51+ ghost_text = " Thinking..." ,
52+ -- function to generate prompt string.
53+ -- accept a callback that takes input as prompt string.
54+ -- prompt_gen = function(callback)
55+ -- -- some async operation to generate prompt.
56+ -- local generated_prompt_string = 'The prompt string ...'
57+ -- callback(error_or_nil, generated_prompt_string)
58+ -- end
59+ prompt_gen = nil ,
60+ -- default prompt string if you do not want to use prompt_gen.
61+ -- default_prompt = [[Some prompt string ... The diff content is: %s]]
62+ default_prompt = nil ,
3963 },
4064 cmd = { ' WriteGitCommitMessage' },
4165 ft = ' gitcommit' ,
@@ -62,11 +86,3 @@ Snippet
6286## ⌨ Contributing
6387
6488PRs and issues are always welcome. Make sure to provide as much context as possible when opening one.
65-
66- ## 🗞 Wiki
67-
68- You can find guides and showcase of the plugin on [ the Wiki] ( https://github.com/towry/commit-msg-sg.nvim/wiki )
69-
70- ## 🎭 Motivations
71-
72- > If alternatives of your plugin exist, you can provide some pros/cons of using yours over the others.
0 commit comments