From cd7dc8181eb33093e98a242affd8ed5b514f5f20 Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Thu, 21 Nov 2024 00:29:47 -0600 Subject: [PATCH] add more lsp and formatter --- src/home/shell/neovim/config/init.lua | 44 ++++++++++++++++++--- src/home/shell/neovim/config/lazy-lock.json | 4 +- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/home/shell/neovim/config/init.lua b/src/home/shell/neovim/config/init.lua index 1b1cd7c..95a69ff 100644 --- a/src/home/shell/neovim/config/init.lua +++ b/src/home/shell/neovim/config/init.lua @@ -401,8 +401,7 @@ require("lazy").setup({ }, } - - if vim.fn.executable('pip') == 1 then + if vim.fn.executable("pip") == 1 then vim.list_extend(servers, { pylsp = {}, }) @@ -412,6 +411,7 @@ require("lazy").setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { "stylua", -- Used to format Lua code + "shfmt", }) require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) @@ -462,6 +462,7 @@ require("lazy").setup({ lua = { "stylua" }, python = { "isort", "black" }, nix = { "nixfmt" }, + sh = { "shfmt" }, }, }, }, @@ -490,7 +491,38 @@ require("lazy").setup({ }, "saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", + -- "hrsh7th/cmp-path", + "https://codeberg.org/FelipeLema/cmp-async-path.git", + { + "zbirenbaum/copilot-cmp", + opts = {}, + dependencies = { + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + config = true, + }, + }, + config = function(_, opts) + local copilot_cmp = require("copilot_cmp") + copilot_cmp.setup(opts) + -- attach cmp source whenever copilot attaches + -- fixes lazy-loading issues with the copilot cmp source + local on_attach = function(client, _) + if client.name == "copilot" then + copilot_cmp._on_insert_enter({}) + end + end + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local buffer = args.buf ---@type number + local client = vim.lsp.get_client_by_id(args.data.client_id) + on_attach(client, buffer) + end, + }) + end, + }, }, config = function() -- See `:help cmp` @@ -556,6 +588,7 @@ require("lazy").setup({ end, { "i", "s" }), }), sources = { + { name = "copilot" }, { name = "lazydev", -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it @@ -563,7 +596,8 @@ require("lazy").setup({ }, { name = "nvim_lsp" }, { name = "luasnip" }, - { name = "path" }, + -- { name = "path" }, + { name = "async_path" }, }, }) end, @@ -751,7 +785,7 @@ require("lazy").setup({ -- stylua: ignore start keys = { { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, - { "bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" }, + { "bd", function() Snacks.bufdelete({ wipe = true }) end, desc = "Delete Buffer" }, { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }, { "gb", function() Snacks.git.blame_line() end, desc = "Git Blame Line" }, { "gB", function() Snacks.gitbrowse() end, desc = "Git Browse" }, diff --git a/src/home/shell/neovim/config/lazy-lock.json b/src/home/shell/neovim/config/lazy-lock.json index e753d62..0966c03 100644 --- a/src/home/shell/neovim/config/lazy-lock.json +++ b/src/home/shell/neovim/config/lazy-lock.json @@ -1,9 +1,11 @@ { "LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" }, + "cmp-async-path": { "branch": "main", "commit": "d6d1ffa2075039632a2d71e8fa139818e15ac757" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, + "copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" }, + "copilot.lua": { "branch": "master", "commit": "f8d8d872bb319f640d5177dad5fbf01f7a16d7d0" }, "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" },