From 49c9dfcc9b338b9bf2a302bdeb32a7da10f814d8 Mon Sep 17 00:00:00 2001 From: Marty Oehme <marty.oehme@gmail.com> Date: Thu, 30 Jan 2025 22:29:57 +0100 Subject: [PATCH] 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. --- nvim/.config/nvim/lua/plugins/completion.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/completion.lua b/nvim/.config/nvim/lua/plugins/completion.lua index 6d38c40..4c75211 100644 --- a/nvim/.config/nvim/lua/plugins/completion.lua +++ b/nvim/.config/nvim/lua/plugins/completion.lua @@ -1,3 +1,5 @@ +local is_available = require("core.util").is_available + local completion_engine = { { "hrsh7th/nvim-cmp", @@ -178,11 +180,12 @@ local snippet_engine = { "benfowler/telescope-luasnip.nvim", dependencies = { { "nvim-telescope/telescope.nvim", optional = true } }, config = function() - if require("core.util").is_available("telescope") then + if is_available("telescope") then require("telescope").load_extension("luasnip") end end, }, + { "hrsh7th/nvim-cmp", optional = true }, }, event = { "InsertEnter" }, build = "make install_jsregexp", @@ -237,15 +240,10 @@ local beancount_cmp = { }, ft = "beancount", 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, { 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, }