copilot/codegpt

master
blob42 10 months ago
parent aeb11c5989
commit c4169d6d48

@ -0,0 +1,24 @@
local ok, codegpt = pcall(require, "codegpt")
if not ok then
vim.notify("missing module codegpt", vim.log.levels.WARN)
return
end
local M = {}
M.setup = function()
vim.g["codegpt_commands"] = {
["tests"] = {
language_instructions = {
python = "Use pytest framework."
}
},
["docu4"] = {
system_message_template = "You are a technical documentation assistant to a software developer. You will help improving project documentation.",
user_message_template = "Improve the following text: ```{{text_selection}}```\n. Use a professional. Write as if you are writing a python project documentation for a Github repo. {{command_args}}"
},
model = "gpt-4"
}
end
return M

@ -8,7 +8,7 @@ local M = {}
local config = {
panel = {
enabled = true,
enabled = false,
auto_refresh = false,
keymap = {
jump_prev = "[[",
@ -23,7 +23,7 @@ local config = {
},
},
suggestion = {
enabled = true,
enabled = false,
auto_trigger = false,
debounce = 75,
keymap = {
@ -36,8 +36,9 @@ local config = {
},
},
filetypes = {
python = true,
yaml = false,
markdown = false,
markdown = true,
help = false,
gitcommit = false,
gitrebase = false,
@ -47,7 +48,9 @@ local config = {
["."] = false,
},
copilot_node_command = 'node', -- Node.js version must be > 16.x
server_opts_overrides = {},
server_opts_overrides = {
-- trace = "verbose"
},
}
M.setup = function()

@ -178,6 +178,10 @@ return {
-- https://github.com/thmsmlr/gpt.nvim
["dpayne/CodeGPT.nvim"] = {
keys = {"<leader>gpT"},
config = function()
require("codegpt.config")
require("custom.plugins.configs.code-gpt").setup()
end
},
["jackMort/ChatGPT.nvim"] = {
-- lock = true,

@ -35,6 +35,12 @@ cmp_window.info = function(self)
return info
end
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
end
local options = {
-- preselect = cmp.PreselectMode.None,
window = {
@ -117,7 +123,7 @@ local options = {
}),
["<Tab>"] = cmp.mapping(function(fallback)
local luasnip = require("luasnip")
if cmp.visible() then
if cmp.visible() and has_words_before() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
@ -132,7 +138,7 @@ local options = {
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
local luasnip = require("luasnip")
if cmp.visible() then
if cmp.visible() and has_words_before() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
@ -146,6 +152,7 @@ local options = {
},
sources = {
{ name = "luasnip", priority = 1000 },
{ name = "nvim_lua", priority = 900 },
{ name = "nvim_lsp", priority = 800 },
{
name = "buffer",
@ -158,10 +165,10 @@ local options = {
return vim.tbl_keys(bufs)
end
},
priority = 700
},
{ name = "nvim_lua", priority = 900 },
{ name = "copilot", priority = 100 },
{ name = "path" },
{ name = "copilot" },
},
}

Loading…
Cancel
Save