add venv-selector and vim-go

This commit is contained in:
2025-05-19 10:16:40 -05:00
parent fcd7a1e036
commit 2efcf9f592
4 changed files with 38 additions and 45 deletions

View File

@@ -69,38 +69,7 @@ return {
cmp_nvim_lsp.default_capabilities(),
require("lsp-file-operations").default_capabilities()
)
local on_attach = function(client, bufnr)
-- Enable completion triggered by <C-x><C-o>
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
-- Define key mappings for LSP functionality
local opts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>fr", function()
vim.lsp.buf.format({ async = true })
end, opts)
-- Additional client-specific setup
if client.server_capabilities.document_highlight then
vim.api.nvim_create_augroup("LspDocumentHighlight", { clear = true })
vim.api.nvim_create_autocmd("CursorHold", {
group = "LspDocumentHighlight",
buffer = bufnr,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd("CursorMoved", {
group = "LspDocumentHighlight",
buffer = bufnr,
callback = vim.lsp.buf.clear_references,
})
end
end
-- Change the Diagnostic symbols in the sign column (gutter)
-- (not in youtube nvim video)
local signs = { Error = "", Warn = "", Hint = "󰠠 ", Info = "" }
@@ -166,13 +135,11 @@ return {
end,
["gopls"] = function()
lspconfig.gopls.setup({
on_attach = on_attach,
capabilities = cmp_nvim_lsp.default_capabilities(),
cmd = { "gopls" },
filetypes = { "go", "gomod", "gowork", "gotmpl" },
root_dir = lspconfig.util.root_pattern("go.work", "go.mod", ".git"),
settings = {
gopls = {
staticcheck = true,
completeUnimported = true,
usePlaceholder = true,
analyses = {

View File

@@ -0,0 +1,18 @@
return {
"linux-cultist/venv-selector.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
"mfussenegger/nvim-dap-python", --optional
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
},
lazy = false,
branch = "regexp", -- This is the regexp branch, use this for the new version
keys = {
{ "<leader>v", "<cmd>VenvSelect<cr>" },
},
---@type venv-selector.Config
opts = {
-- Your settings go here
},
}

View File

@@ -0,0 +1,5 @@
return {
"fatih/vim-go",
build = ":GoInstallBinaries",
ft = { "go" },
}