astro-nvim-v3 - fix conflict tab press between copilot and nvim_cmp
This commit is contained in:
@@ -27,7 +27,7 @@ return {
|
||||
jedi_language_server = {
|
||||
init_options = {
|
||||
completion = {
|
||||
disableSnippets = true,
|
||||
disableSnippets = false,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
@@ -37,7 +37,7 @@ return {
|
||||
"numpy",
|
||||
"pandas",
|
||||
"torch",
|
||||
"sklearn"
|
||||
"sklearn",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -74,15 +74,18 @@ return {
|
||||
"D415",
|
||||
"E402",
|
||||
"E501",
|
||||
"ERA001",
|
||||
"TRY003",
|
||||
"TD002",
|
||||
"TD003",
|
||||
"T201",
|
||||
"FIX002",
|
||||
"N803",
|
||||
"PD901",
|
||||
-- "F401",
|
||||
"I001",
|
||||
"RET504",
|
||||
"PLR2004",
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ return {
|
||||
symbol_map = require "plugins.configs.ui.lspkind",
|
||||
},
|
||||
},
|
||||
{
|
||||
"github/copilot.vim",
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function(_, opts)
|
||||
@@ -18,23 +21,10 @@ return {
|
||||
|
||||
cmp.setup.filetype("python", {
|
||||
sources = cmp.config.sources {
|
||||
{ name = "nvim_lsp", priority = 700},
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "buffer", priority = 500 },
|
||||
{ name = "path", priority = 250 },
|
||||
},
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
|
||||
},
|
||||
priority_weight = 1000
|
||||
},
|
||||
})
|
||||
|
||||
return require("astrocore").extend_tbl(opts, {
|
||||
@@ -65,14 +55,16 @@ return {
|
||||
mapping = {
|
||||
-- Esc to close completion menu
|
||||
["<Esc>"] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() },
|
||||
|
||||
-- Tab to select completion
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() and has_words_before() then
|
||||
cmp.confirm { select = true }
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
-- Use <C-n> and <C-p> to select luasnip
|
||||
["<C-n>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.jumpable(1) then
|
||||
@@ -88,6 +80,14 @@ return {
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-f>"] = cmp.mapping(function(fallback)
|
||||
-- Check if Copilot is suggesting something
|
||||
if vim.fn["copilot#Accept"]() ~= "" then
|
||||
vim.api.nvim_set_keymap("i", "<C-f>", "copilot#Accept(“<CR>”)", { expr = true, silent = true })
|
||||
else
|
||||
fallback() -- If no suggestion, fallback to default behavior
|
||||
end
|
||||
end, { "i", "s" }), -- Enable in insert and command-line mode
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false, -- this feature conflict with copilot.vim's preview.
|
||||
|
||||
@@ -20,7 +20,7 @@ return {
|
||||
indexing = false,
|
||||
inlayHints = {
|
||||
variableTypes = true,
|
||||
functionReturnTypes = true,
|
||||
functionReturnTypes = false,
|
||||
callArgumentNames = false,
|
||||
pytestParameters = true,
|
||||
},
|
||||
|
||||
@@ -10,12 +10,13 @@ return {
|
||||
DiagnosticVirtualTextHint = { fg = get_hlgroup("DiagnosticHint").fg, bg = "none" },
|
||||
DiagnosticVirtualTextInfo = { fg = get_hlgroup("DiagnosticInfo").fg, bg = "none" },
|
||||
DiagnosticVirtualTextWarn = { fg = get_hlgroup("DiagnosticWarn").fg, bg = "none" },
|
||||
|
||||
CursorLineNr = { fg = "#FFD700", bg = "none", bold = true },
|
||||
CursorLine = { fg = "none", bg = "#004C4C", bold = true },
|
||||
Visual = { fg = "#000000", bg = "#FFFFFF", bold = true },
|
||||
|
||||
-- remove background of inlay hints
|
||||
LspInlayHint = { fg = get_hlgroup("LspInlayHint").fg, bg = "none" },
|
||||
LspInlayHint = { fg = "#FF748B", bg = "none" },
|
||||
}
|
||||
|
||||
return hl
|
||||
|
||||
@@ -34,7 +34,7 @@ return {
|
||||
{ "echasnovski/mini.move", enabled = true },
|
||||
{ "nvim-neo-tree/neo-tree.nvim", enabled = true },
|
||||
{ "folke/flash.nvim", enabled = true },
|
||||
|
||||
{ "github/copilot.vim", enabled = true },
|
||||
}
|
||||
|
||||
-- if true then return {} end
|
||||
|
||||
Reference in New Issue
Block a user