From 0f483b469fe07e80c04c42eab3e51c10943d9b7f Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 5 Feb 2025 11:27:34 +0000 Subject: [PATCH] Add sourcegraph nvim plugin for cody AI --- lazy-lock.json | 1 + lua/config/plugins/lsp.lua | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index cddc73f..6eaabbd 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -20,6 +20,7 @@ "oil.nvim": { "branch": "master", "commit": "add50252b5e9147c0a09d36480d418c7e2737472" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "rustaceanvim": { "branch": "master", "commit": "f03035fa03ccb36cd26d0792c946fbacba1d1a39" }, + "sg.nvim": { "branch": "master", "commit": "775f22b75a9826eabf69b0094dd1d51d619fe552" }, "snacks.nvim": { "branch": "main", "commit": "e6e9123debbe7317112a0889b15468bb6aedf992" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, diff --git a/lua/config/plugins/lsp.lua b/lua/config/plugins/lsp.lua index 1ae86be..8f56e8c 100644 --- a/lua/config/plugins/lsp.lua +++ b/lua/config/plugins/lsp.lua @@ -10,6 +10,17 @@ local blinkAcceptKeybind = { 'fallback' } +local function on_attach(_, buf) + local function map(keys, fn, desc) + vim.keymap.set("n", keys, fn, { buffer = buf, desc = "LSP: " .. desc }) + end + + map("cr", vim.lsp.buf.rename, "Rename") + map("ca", vim.lsp.buf.code_action, "Code Action") + map("gd", require("telescope.builtin").lsp_definitions, "Goto Definition") + map("gr", require("telescope.builtin").lsp_references, "Goto References") +end + return { { "williamboman/mason.nvim", @@ -33,17 +44,6 @@ return { local lspconfig = require("lspconfig") - local function on_attach(_, buf) - local function map(keys, fn, desc) - vim.keymap.set("n", keys, fn, { buffer = buf, desc = "LSP: " .. desc }) - end - - map("cr", vim.lsp.buf.rename, "Rename") - map("ca", vim.lsp.buf.code_action, "Code Action") - map("gd", require("telescope.builtin").lsp_definitions, "Goto Definition") - map("gr", require("telescope.builtin").lsp_references, "Goto References") - end - for server, config in pairs(opts.servers) do config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities) config.on_attach = on_attach @@ -116,5 +116,14 @@ return { dependencies = { "nvim-lua/plenary.nvim", }, - } + }, + { + "sourcegraph/sg.nvim", + dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" }, + config = function() + require("sg").setup { + on_attach = on_attach + } + end + }, }