File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 1- -- Define a module table
1+ local utils = require (' CopilotChat.utils' )
2+
23local M = {}
34
45-- Set up the plugin
56M .setup = function ()
6- vim .notify (
7- " Please run ':UpdateRemotePlugins' and restart Neovim to use CopilotChat.nvim" ,
8- vim .log .levels .INFO ,
9- {
10- title = ' CopilotChat.nvim' ,
11- }
12- )
7+ -- Add new command to explain the selected text with CopilotChat
8+ utils .create_cmd (' CChatExplain' , function (opts )
9+ vim .cmd (' CChat Explain how it works' )
10+ end , { nargs = ' *' , range = true })
1311end
1412
1513return M
Original file line number Diff line number Diff line change 1+ local M = {}
2+
3+ --- Create custom command
4+ --- @param cmd string The command name
5+ --- @param func function The function to execute
6+ --- @param opt table The options
7+ M .create_cmd = function (cmd , func , opt )
8+ opt = vim .tbl_extend (' force' , { desc = ' CopilotChat.nvim ' .. cmd }, opt or {})
9+ vim .api .nvim_create_user_command (cmd , func , opt )
10+ end
11+
12+ return M
You can’t perform that action at this time.
0 commit comments