-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
-- Define a module table | ||
local utils = require('CopilotChat.utils') | ||
|
||
local M = {} | ||
|
||
-- Set up the plugin | ||
M.setup = function() | ||
vim.notify( | ||
"Please run ':UpdateRemotePlugins' and restart Neovim to use CopilotChat.nvim", | ||
vim.log.levels.INFO, | ||
{ | ||
title = 'CopilotChat.nvim', | ||
} | ||
) | ||
-- Add new command to explain the selected text with CopilotChat | ||
utils.create_cmd('CChatExplain', function(opts) | ||
vim.cmd('CChat Explain how it works') | ||
end, { nargs = '*', range = true }) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local M = {} | ||
|
||
--- Create custom command | ||
---@param cmd string The command name | ||
---@param func function The function to execute | ||
---@param opt table The options | ||
M.create_cmd = function(cmd, func, opt) | ||
opt = vim.tbl_extend('force', { desc = 'CopilotChat.nvim ' .. cmd }, opt or {}) | ||
vim.api.nvim_create_user_command(cmd, func, opt) | ||
end | ||
|
||
return M |