summaryrefslogtreecommitdiff
path: root/plugin/vim-ai.vim
diff options
context:
space:
mode:
authorMartin Bielik <martin.bielik@instea.sk>2024-12-08 23:15:33 +0100
committerMartin Bielik <martin.bielik@instea.sk>2024-12-08 23:15:33 +0100
commit9d43ef6c4966705376af2cd16fb012d020ce673d (patch)
treea42b69d00d394ce174a1a1662013dd2f007659cf /plugin/vim-ai.vim
parentea83fdc59b64843f570c94d34d97c3131663d3e8 (diff)
downloadvim-ai-9d43ef6c4966705376af2cd16fb012d020ce673d.tar.gz
don't include not selected line, refactor ranges, fixes #112
Diffstat (limited to '')
-rw-r--r--plugin/vim-ai.vim21
1 files changed, 5 insertions, 16 deletions
diff --git a/plugin/vim-ai.vim b/plugin/vim-ai.vim
index 1ed5326..d27f312 100644
--- a/plugin/vim-ai.vim
+++ b/plugin/vim-ai.vim
@@ -4,19 +4,8 @@ if !has('python3')
finish
endif
-" detect if a visual selection is pending: https://stackoverflow.com/a/20133772
-let g:vim_ai_is_selection_pending = 0
-augroup vim_ai
- autocmd!
- autocmd CursorMoved *
- \ let g:vim_ai_is_selection_pending = mode() =~# "^[vV\<C-v>]"
-augroup END
-
-command! -range -nargs=? -complete=customlist,vim_ai#RoleCompletion AI <line1>,<line2>call vim_ai#AIRun({}, <q-args>)
-command! -range -nargs=? -complete=customlist,vim_ai#RoleCompletion AIEdit <line1>,<line2>call vim_ai#AIEditRun({}, <q-args>)
-" Whereas AI and AIEdit default to passing the current line as range
-" AIChat defaults to passing nothing which is achieved by -range=0 and passing
-" <count> as described at https://stackoverflow.com/a/20133772
-command! -range=0 -nargs=? -complete=customlist,vim_ai#RoleCompletion AIChat <line1>,<line2>call vim_ai#AIChatRun(<count>, {}, <q-args>)
-command! -nargs=? AINewChat call vim_ai#AINewChatRun(<f-args>)
-command! AIRedo call vim_ai#AIRedoRun()
+command! -range -nargs=? -complete=customlist,vim_ai#RoleCompletion AI <line1>,<line2>call vim_ai#AIRun(<range>, {}, <q-args>)
+command! -range -nargs=? -complete=customlist,vim_ai#RoleCompletion AIEdit <line1>,<line2>call vim_ai#AIEditRun(<range>, {}, <q-args>)
+command! -range -nargs=? -complete=customlist,vim_ai#RoleCompletion AIChat <line1>,<line2>call vim_ai#AIChatRun(<range>, {}, <q-args>)
+command! -nargs=? AINewChat call vim_ai#AINewChatRun(<f-args>)
+command! AIRedo call vim_ai#AIRedoRun()