From f607bde009005d5de5a983bf7dff2e98ea708a5a Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Thu, 3 Aug 2023 14:03:51 -0500 Subject: [PATCH] copilot --- lazy-lock.json | 47 +++++++++++++++++++++++++++++++++ lua/keymaps.lua | 4 +-- lua/plugins/colorpicker_ccc.lua | 2 +- lua/plugins/copilot.lua | 31 ++++++++++++++++++++++ lua/plugins/lsp.lua | 32 +++++++++++----------- 5 files changed, 97 insertions(+), 19 deletions(-) create mode 100644 lazy-lock.json create mode 100644 lua/plugins/copilot.lua diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..b5e401a --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,47 @@ +{ + "LuaSnip": { "branch": "master", "commit": "a658ae2906344a1d2b9c507738e585cf68e685c7" }, + "auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" }, + "autoclose.nvim": { "branch": "main", "commit": "469782b0456f0b4f764378ffda94c18599544e09" }, + "ccc.nvim": { "branch": "main", "commit": "4a0ddaf787cc82796e84ab8a7f70d086f250aeb6" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "copilot-cmp": { "branch": "master", "commit": "c2cdb3c0f5078b0619055af192295830a7987790" }, + "copilot.lua": { "branch": "master", "commit": "e48bd7020a98be217d85c006a298656294fd6210" }, + "crates.nvim": { "branch": "main", "commit": "1dffccc0a95f656ebe00cacb4de282473430c5a1" }, + "diffview.nvim": { "branch": "main", "commit": "e91110d2a7f8e2f667666aba6ea089ff823f8748" }, + "gitsigns.nvim": { "branch": "main", "commit": "5d73da785a3c05fd63ac31769079db05169a6ec7" }, + "glow.nvim": { "branch": "advanced_window", "commit": "f1157d4cb7e46e830c72004e7e1adb81a1f9b04c" }, + "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, + "lazy.nvim": { "branch": "main", "commit": "5af331ea65418dc9361769891921fdee4bcc837a" }, + "lazygit.nvim": { "branch": "main", "commit": "3466e48439601445e26c65635421625886f2d0c0" }, + "lsp-inlayhints.nvim": { "branch": "main", "commit": "d981f65c9ae0b6062176f0accb9c151daeda6f16" }, + "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "82685fdd0f67a694b244cb058b83761f54664d68" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, + "mason.nvim": { "branch": "main", "commit": "5ad3e113b0c3fde3caba8630599373046f6197e8" }, + "material.nvim": { "branch": "main", "commit": "c7631d373d3ae02ef502ec6b8620a8ff36ab922e" }, + "neo-tree.nvim": { "branch": "v2.x", "commit": "20c2f2f5ba083bbb1e37b8bc3d590621434f31e9" }, + "neodev.nvim": { "branch": "main", "commit": "0705c72c281626f45c78d0916151d3e2bfb53fae" }, + "neogit": { "branch": "master", "commit": "343ea071602c52a618fdee4f1333dc37f0d7757b" }, + "nerdcommenter": { "branch": "master", "commit": "ab2ae4d502a26bc591db78a8548823ddd04bbc9c" }, + "nui.nvim": { "branch": "main", "commit": "d146966a423e60699b084eeb28489fe3b6427599" }, + "null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" }, + "nvim-cmp": { "branch": "main", "commit": "2743dd989e9b932e1b4813a4927d7b84272a14e2" }, + "nvim-lspconfig": { "branch": "master", "commit": "51739a8bc531542079698c58512feb68469f5d27" }, + "nvim-treesitter": { "branch": "master", "commit": "1ef286e5b0cfd17f56586a8445cd83d61647f851" }, + "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" }, + "nvim-web-devicons": { "branch": "master", "commit": "9ab9b0b894b2388a9dbcdee5f00ce72e25d85bf9" }, + "openingh.nvim": { "branch": "main", "commit": "2719e5759ecf4b9a2d492fbf52d03d2e6fc6126a" }, + "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" }, + "plenary.nvim": { "branch": "master", "commit": "bda256fab0eb66a15e8190937e417e6a14ee5d72" }, + "rest.nvim": { "branch": "main", "commit": "0d4b6176ce7fee2d33a716402d47d65a35acf173" }, + "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, + "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, + "text-case.nvim": { "branch": "main", "commit": "cd7cc65a412beb713e68f3b84e45990a939b7b6b" }, + "undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" } +} \ No newline at end of file diff --git a/lua/keymaps.lua b/lua/keymaps.lua index d95cc5d..c0188bc 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -38,8 +38,8 @@ require("util").keymaps({ [""] = { "k", desc = "Move window above current" }, [""] = { "l", desc = "Move window right current" }, -- tab navigation - [""] = { "tabprevious", desc = "Move to previous tab" }, - [""] = { "tabnext", desc = "Move to next tab" }, + ["H"] = { "tabprevious", desc = "Move to previous tab" }, + ["L"] = { "tabnext", desc = "Move to next tab" }, -- reformat LSP ["lf"] = { function() diff --git a/lua/plugins/colorpicker_ccc.lua b/lua/plugins/colorpicker_ccc.lua index 700c882..da64cb4 100644 --- a/lua/plugins/colorpicker_ccc.lua +++ b/lua/plugins/colorpicker_ccc.lua @@ -2,6 +2,6 @@ return { "uga-rosa/ccc.nvim", event = "BufRead", keys = { - { "cp", ":CccPick ", desc = "Color Picker" }, + { ",cp", ":CccPick ", desc = "Color Picker" }, }, } diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua new file mode 100644 index 0000000..05edb6b --- /dev/null +++ b/lua/plugins/copilot.lua @@ -0,0 +1,31 @@ +return { + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + opts = { + suggestion = { enabled = false }, + panel = { enabled = false }, + }, + config = function(_, opts) + require("copilot").setup(opts) + end, + }, + { + "zbirenbaum/copilot-cmp", + dependencies = { "zbirenbaum/copilot.lua" }, + opts = {}, + config = function(_, opts) + require("copilot_cmp").setup(opts) + end, + keys = { + { + "ct", + function() + require("copilot.suggestion").toggle_auto_trigger() + end, + desc = "Toggle copilot suggestions.", + }, + }, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 9cd7e11..b78cafb 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -9,7 +9,10 @@ local function prereqs() if output == nil or output == "" or string.find(output, "not installed for the toolchain") then print("Installing rust-analyzer globally with rustup") vim.fn.system({ - "rustup", "component", "add", "rust-analyzer" + "rustup", + "component", + "add", + "rust-analyzer", }) end end @@ -33,7 +36,7 @@ local servers = { diagnostics = { globals = { "vim", - "require" + "require", }, }, }, @@ -76,15 +79,11 @@ local servers = { }, } -vim.lsp.handlers["textDocument/publishDiagnostics"] = - vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, - { - virtual_text = true, - signs = true, - update_in_insert = true - } - ) +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = true, + signs = true, + update_in_insert = true, +}) local signs = { "Error", "Warn", "Hint", "Info" } for _, type in pairs(signs) do @@ -132,7 +131,6 @@ local gen_capabilities = function(cmp) capabilities = cmp.default_capabilities(capabilities) end - return { { "lvimuser/lsp-inlayhints.nvim", @@ -147,6 +145,7 @@ return { "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", --"Saecki/crates.nvim", -- SEE plugins/rust-tools.lua + "zbirenbaum/copilot-cmp", }, }, { @@ -179,7 +178,7 @@ return { -- LSP -- nvim-cmp supports additional completion capabilities, so broadcast that to servers - local capabilities = gen_capabilities(require("cmp_nvim_lsp")); + local capabilities = gen_capabilities(require("cmp_nvim_lsp")) -- Install servers used mason_lspconfig.setup({ @@ -241,6 +240,7 @@ return { end, { "i", "s" }), }), sources = { + { name = "copilot", priority = 9 }, { name = "nvim_lsp", priority = 8 }, { nane = "buffer", priority = 7 }, { name = "luasnip", priority = 6 }, @@ -273,9 +273,9 @@ return { }, }, config = function(_, opts) - opts.server.capabilities = gen_capabilities(require("cmp_nvim_lsp")); - require('rust-tools').setup(opts) - end + opts.server.capabilities = gen_capabilities(require("cmp_nvim_lsp")) + require("rust-tools").setup(opts) + end, --config = function(_, opts) --require('rust-tools').setup(opts) --end