@@ -109,12 +109,35 @@ function M.select_history()
109109end
110110
111111function M .quick_chat (message , range )
112- local options = {}
112+ if not range then
113+ if vim .fn .mode ():match (' [vV\022 ]' ) then
114+ local visual_range = util .get_visual_range ()
115+ if visual_range then
116+ range = {
117+ start_line = visual_range .start_line ,
118+ end_line = visual_range .end_line ,
119+ }
120+ end
121+ end
122+ end
123+
113124 if type (message ) == ' table' then
114125 message = table.concat (message , ' ' )
115126 end
116127
117- return quick_chat .quick_chat (message , options , range )
128+ -- If no message, prompt for input (range is captured above)
129+ if not message or # message == 0 then
130+ vim .ui .input ({ prompt = ' Quick Chat Message: ' }, function (input )
131+ local prompt , ctx = util .parse_quick_context_args (input )
132+ if input and input ~= ' ' then
133+ quick_chat .quick_chat (prompt , { context_config = ctx }, range )
134+ end
135+ end )
136+ return
137+ end
138+
139+ local prompt , ctx = util .parse_quick_context_args (message )
140+ quick_chat .quick_chat (prompt , { context_config = ctx }, range )
118141end
119142
120143function M .toggle_pane ()
@@ -968,7 +991,7 @@ M.commands = {
968991 },
969992
970993 quick_chat = {
971- desc = ' Quick chat with current context ' ,
994+ desc = ' Quick chat with current buffer or visual selection ' ,
972995 fn = M .quick_chat ,
973996 range = true , -- Enable range support for visual selections
974997 nargs = ' +' , -- Allow multiple arguments
0 commit comments