local lspconfig = require('lspconfig') -- Get python executable from env local python = vim.fn.globpath(vim.fn.getcwd(), "env/bin/python") -- Set configuration local config = {} if python ~= '' then config.cmd = { python, '-m', 'pylsp' } end -- Set up pylsp lspconfig.pylsp.setup(config)