nvim: Do not establish quarto molten session on open
We now disable the automatic establishing of quarto molten sessions (using the virtual environment provided python interpreter) as soon as the file is opened since it can have some negative side-effects and also slows down quarto file opening. Instead, use the `JupyterStart` command to establish a jupyter session in the correct environment and initialize a molten session. The behaviour can be re-enabled with `vim.g.quarto_auto_init_molten_session = true`.
This commit is contained in:
parent
a94b1ccbb2
commit
1b4f73ae9b
2 changed files with 20 additions and 10 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
local default_buffer_session = function()
|
local default_buffer_session = function()
|
||||||
local buffer_path = vim.api.nvim_buf_get_name(0) or vim.fn.tempname()
|
local buffer_path = vim.api.nvim_buf_get_name(0) or vim.fn.tempname()
|
||||||
local temp_path = vim.fn.stdpath("run") .. "/molten-sessions" .. buffer_path .. ".json"
|
local temp_path = vim.fn.stdpath("run") .. "/molten-sessions" .. buffer_path .. ".json"
|
||||||
|
@ -44,6 +45,7 @@ vim.api.nvim_create_user_command("JupyterStart", function()
|
||||||
startsession(vim.b["sessionfile"] or default_buffer_session())
|
startsession(vim.b["sessionfile"] or default_buffer_session())
|
||||||
end, {})
|
end, {})
|
||||||
|
|
||||||
|
if vim.g.quarto_auto_init_molten_session then
|
||||||
vim.api.nvim_create_autocmd({ "InsertEnter", "BufEnter" }, {
|
vim.api.nvim_create_autocmd({ "InsertEnter", "BufEnter" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
if vim.b["sessionfile"] == nil then
|
if vim.b["sessionfile"] == nil then
|
||||||
|
@ -53,6 +55,8 @@ vim.api.nvim_create_autocmd({"InsertEnter", "BufEnter"}, {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- -- -- TODO find better way to enable lsp key mappings for quarto buffers
|
-- -- -- TODO find better way to enable lsp key mappings for quarto buffers
|
||||||
-- -- local prefix = require("which-key").register
|
-- -- local prefix = require("which-key").register
|
||||||
-- -- prefix({ ["<localleader>l"] = { name = "+lsp" } })
|
-- -- prefix({ ["<localleader>l"] = { name = "+lsp" } })
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
-- Change (personal) plugin options
|
||||||
|
-- mainly intended for things I have not packaged as plugin but may
|
||||||
|
-- require options to be set.
|
||||||
|
vim.g.quarto_auto_init_molten_session = false
|
||||||
|
|
||||||
|
-- Change (Neo)Vim default options
|
||||||
local default_builtins_disabled = { "netrw", "netrwPlugin" }
|
local default_builtins_disabled = { "netrw", "netrwPlugin" }
|
||||||
local disable_builtins = function(builtins)
|
local disable_builtins = function(builtins)
|
||||||
for _, plugin in pairs(builtins) do
|
for _, plugin in pairs(builtins) do
|
||||||
|
|
Loading…
Reference in a new issue