diff options
| author | Martin Bielik <mx.bielik@gmail.com> | 2024-02-26 22:22:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-26 22:22:49 +0100 |
| commit | d482318e7a0666d078f21df4a54440de5ceed3fa (patch) | |
| tree | 0fdd533d2050737aa42043b6981bbbd50896cf01 /README.md | |
| parent | ed6333e968d563c12b24cbd78605578914a7f32a (diff) | |
| parent | cbc890a85c98f792b3d2743724cd533705f868b3 (diff) | |
| download | vim-ai-d482318e7a0666d078f21df4a54440de5ceed3fa.tar.gz | |
Merge pull request #77 from Konfekt/range
fix selection handling in vim_ai functions
Diffstat (limited to '')
| -rw-r--r-- | README.md | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -377,7 +377,6 @@ To create a custom command, you can call `AIRun`, `AIEditRun` and `AIChatRun` fu function! GitCommitMessageFn() 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:range = 0 let l:config = { \ "engine": "chat", \ "options": { @@ -386,7 +385,7 @@ function! GitCommitMessageFn() \ "temperature": 1, \ }, \} - call vim_ai#AIRun(l:range, l:config, l:prompt) + call vim_ai#AIRun(l:config, l:prompt) endfunction command! GitCommitMessage call GitCommitMessageFn() @@ -398,9 +397,9 @@ function! CodeReviewFn(range) range \ "initial_prompt": ">>> system\nyou are a clean code expert", \ }, \} - '<,'>call vim_ai#AIChatRun(a:range, l:config, l:prompt) + exe a:firstline.",".a:lastline . "call vim_ai#AIChatRun(a:range, l:config, l:prompt)" endfunction -command! -range CodeReview <line1>,<line2>call CodeReviewFn(<range>) +command! -range=0 CodeReview <line1>,<line2>call CodeReviewFn(<count>) ``` ## Contributing |