diff options
| author | Martin Bielik <martin.bielik@instea.sk> | 2024-12-08 23:15:33 +0100 |
|---|---|---|
| committer | Martin Bielik <martin.bielik@instea.sk> | 2024-12-08 23:15:33 +0100 |
| commit | 9d43ef6c4966705376af2cd16fb012d020ce673d (patch) | |
| tree | a42b69d00d394ce174a1a1662013dd2f007659cf /README.md | |
| parent | ea83fdc59b64843f570c94d34d97c3131663d3e8 (diff) | |
| download | vim-ai-9d43ef6c4966705376af2cd16fb012d020ce673d.tar.gz | |
don't include not selected line, refactor ranges, fixes #112
Diffstat (limited to '')
| -rw-r--r-- | README.md | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -107,8 +107,6 @@ In the documentation below, `<selection>` denotes a visual selection or any oth ### `:AI` -`:AI` - complete the text on the current line - `:AI {prompt}` - complete the prompt `<selection> :AI` - complete the selection @@ -481,6 +479,7 @@ To create a custom command, you can call `AIRun`, `AIEditRun` and `AIChatRun` fu ```vim " custom command suggesting git commit message, takes no arguments function! GitCommitMessageFn() + let l:range = 0 let l:diff = system('git --no-pager diff --staged') let l:prompt = "generate a short commit message from the diff below:\n" . l:diff let l:config = { @@ -491,10 +490,11 @@ function! GitCommitMessageFn() \ "temperature": 1, \ }, \} - call vim_ai#AIRun(l:config, l:prompt) + call vim_ai#AIRun(l:range, l:config, l:prompt) endfunction command! GitCommitMessage call GitCommitMessageFn() + " custom command that provides a code review for selected code block function! CodeReviewFn(range) range let l:prompt = "programming syntax is " . &filetype . ", review the code below" @@ -505,7 +505,7 @@ function! CodeReviewFn(range) range \} exe a:firstline.",".a:lastline . "call vim_ai#AIChatRun(a:range, l:config, l:prompt)" endfunction -command! -range=0 CodeReview <line1>,<line2>call CodeReviewFn(<count>) +command! -range -nargs=? AICodeReview <line1>,<line2>call CodeReviewFn(<range>) ``` ## Contributing |