diff --git a/lazy-lock.json b/lazy-lock.json index 12b6333..441f58a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -19,6 +19,7 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "code_runner.nvim": { "branch": "main", "commit": "65218f8f646fe61e506090522df357539642ae83" }, + "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, "cyberdream.nvim": { "branch": "main", "commit": "cd3c2e7955034a5bec0e1beb9d7cb80c639ef5d5" }, "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, "duplicate.nvim": { "branch": "main", "commit": "ab057af7872c44e6fbd48df9b03983c8e67c50a7" }, diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index 7c7abac..154185a 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -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", }, }, diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 5a5a0c1..081f038 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -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 [""] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() }, + -- Tab to select completion [""] = cmp.mapping(function(fallback) if cmp.visible() and has_words_before() then - cmp.confirm { select = true } + fallback() else fallback() end end, { "i", "s" }), + -- Use and to select luasnip [""] = cmp.mapping(function(fallback) if luasnip.jumpable(1) then @@ -88,6 +80,14 @@ return { fallback() end end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + -- Check if Copilot is suggesting something + if vim.fn["copilot#Accept"]() ~= "" then + vim.api.nvim_set_keymap("i", "", "copilot#Accept(“”)", { 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. diff --git a/lua/plugins/configs/lsp/config/basedpyright.lua b/lua/plugins/configs/lsp/config/basedpyright.lua index 4112be3..50e7e06 100644 --- a/lua/plugins/configs/lsp/config/basedpyright.lua +++ b/lua/plugins/configs/lsp/config/basedpyright.lua @@ -20,7 +20,7 @@ return { indexing = false, inlayHints = { variableTypes = true, - functionReturnTypes = true, + functionReturnTypes = false, callArgumentNames = false, pytestParameters = true, }, diff --git a/lua/plugins/configs/ui/highlights.lua b/lua/plugins/configs/ui/highlights.lua index beeba11..3f84973 100644 --- a/lua/plugins/configs/ui/highlights.lua +++ b/lua/plugins/configs/ui/highlights.lua @@ -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 diff --git a/lua/plugins/disabled.lua b/lua/plugins/disabled.lua index 614d0d0..51805c2 100644 --- a/lua/plugins/disabled.lua +++ b/lua/plugins/disabled.lua @@ -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