在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):zbirenbaum/copilot.lua开源软件地址(OpenSource Url):https://github.com/zbirenbaum/copilot.lua开源编程语言(OpenSource Language):Lua 97.5%开源软件介绍(OpenSource Introduction):copilot.luaThis plugin is the pure lua replacement for https://github.com/github/copilot.vim While using copilot.vim, for the first time since I started using neovim my laptop began to overheat. Additionally, I found the large chunks of ghost text moving around my code, and interfering with my existing cmp ghost text disturbing. As lua is far more efficient and makes things easier to integrate with modern plugins, this repository was created. (IMPORTANT) Usage:Note that this plugin will only start up the copilot server. The current usage of this is via https://github.com/zbirenbaum/copilot-cmp, which turns copilot suggestions into menu entries for cmp, and displays the full text body in a float, similar to how documentation would appear, off to the side. On its own, this plugin will do nothing. You must either use https://github.com/zbirenbaum/copilot-cmp to make the server into a cmp source, or write your own plugin to interface with it, via the request and handler methods located in copilot.utils.lua InstallPreliminary StepsCurrently, you must have had the original copilot.vim installed and set up at some point, as the authentication steps you do during its setup create files in ~/.config/github-copilot which copilot.lua must read from to function. Fairly soon, copilot.lua will be able to perform this authentication step on its own, but as the plugin is in early stages, this has not yet been fully implemented. Install copilot.vim with After the setup steps are complete for copilot.vim, ensure that ~/.config/github-copilot has files in it, and then you are free to uninstall copilot.vim and proceed to the following steps. SetupYou have to run the Because the copilot server takes some time to start up, I HIGHLY recommend that you load copilot after startup. This can be done in multiple ways, the best one will depend on your existing config and the speed of your machine:
use {
"zbirenbaum/copilot.lua",
event = {"VimEnter"},
config = function()
vim.defer_fn(function()
require("copilot").setup()
end, 100)
end,
}
use {
"zbirenbaum/copilot.lua",
after = 'feline.nvim', --whichever statusline plugin you use here
config = function ()
vim.defer_fn(function() require("copilot").setup() end, 100)
end,
}
use {
"zbirenbaum/copilot.lua",
event = "InsertEnter",
config = function ()
vim.schedule(function() require("copilot").setup() end)
end,
} ConfigurationThe following is the default configuration: cmp = {
enabled = true,
method = "getCompletionsCycling",
},
panel = { -- no config options yet
enabled = true,
},
ft_disable = {},
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
server_opts_overrides = {}, cmpSet the enabled field to false if you do not wish to see copilot recommendations in nvim-cmp. Set the -- Recommended
require("copilot").setup {
cmp = {
enabled = true,
method = "getCompletionsCycling",
}
}, -- Not Currently Recommended
require("copilot").setup {
cmp = {
enabled = true,
method = "getPanelCompletions",
}
}, panelEnabling panel creates the require("copilot").setup {
panel = {
enabled = false,
}
},
ft_disablePrevents copilot from attaching to buffers with specific filetypes. Example: require("copilot").setup {
ft_disable = { "markdown", "terraform" },
} plugin_manager_pathThis is installation path of Packer, change this to the plugin manager installation path of your choice Example: require("copilot").setup {
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
} server_opts_overridesOverride copilot lsp client settings. The Example: require("copilot").setup {
server_opts_overrides = {
trace = "verbose",
settings = {
advanced = {
listCount = 10, -- #completions for panel
inlineSuggestCount = 3, -- #completions for getCompletions
}
},
}
}, |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论