nvim: Get beancount python env from dynamic home env

While we are still hacking our way around a specific pipx venv (which
has to change), we are at least not hardcoding my own home directory
name anymore.
This commit is contained in:
Marty Oehme 2025-01-30 22:29:57 +01:00
parent ce78b89597
commit 49c9dfcc9b
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -1,3 +1,5 @@
local is_available = require("core.util").is_available
local completion_engine = { local completion_engine = {
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
@ -178,11 +180,12 @@ local snippet_engine = {
"benfowler/telescope-luasnip.nvim", "benfowler/telescope-luasnip.nvim",
dependencies = { { "nvim-telescope/telescope.nvim", optional = true } }, dependencies = { { "nvim-telescope/telescope.nvim", optional = true } },
config = function() config = function()
if require("core.util").is_available("telescope") then if is_available("telescope") then
require("telescope").load_extension("luasnip") require("telescope").load_extension("luasnip")
end end
end, end,
}, },
{ "hrsh7th/nvim-cmp", optional = true },
}, },
event = { "InsertEnter" }, event = { "InsertEnter" },
build = "make install_jsregexp", build = "make install_jsregexp",
@ -237,15 +240,10 @@ local beancount_cmp = {
}, },
ft = "beancount", ft = "beancount",
opts = function(_, opts) opts = function(_, opts)
vim.g.python3_host_prog = "/home/marty/.local/pipx/venvs/beancount/bin/python" -- FIXME: Find a way to dynamically derive environment
vim.g.python3_host_prog = os.getenv("HOME") .. "/.local/pipx/venvs/beancount/bin/python"
table.insert(opts.sources, { table.insert(opts.sources, {
name = "beancount", name = "beancount",
-- option = {
-- -- TODO: implement dynamically
-- -- I believe if we don't supply this it automatically takes
-- -- from the open file which would be good enough
-- account = "/home/marty/documents/records/budget/main.beancount",
-- },
}) })
end, end,
} }