new: Make nvim work nicely with python venvs

This commit is contained in:
Sayantan Santra 2024-04-01 22:12:25 -05:00
parent df5ac44769
commit f3cdacbe07
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -1,6 +1,7 @@
-- This file defines all the global config
local set = vim.opt
local g = vim.g
local fn = vim.fn
-- Turn on numbers
set.number = true
@ -29,3 +30,10 @@ set.spelllang = { "en", "programming" }
g.loaded_perl_provider = 0
g.loaded_node_provider = 0
g.loaded_ruby_provider = 0
-- Make nvim work nicely with venvs
if fn.exists("$VIRTUAL_ENV") == 1 then
g.python3_host_prog = fn.substitute(fn.system("which -a python3 | head -n2 | tail -n1"), "\n", "", "g")
else
g.python3_host_prog = fn.substitute(fn.system("which python3"), "\n", "", "g")
end