From ce711776833cbb40c8b8ae6a85c56973a40e9b6c Mon Sep 17 00:00:00 2001 From: Jannik Buhr Date: Fri, 20 Dec 2024 16:21:24 +0100 Subject: [PATCH] molten --- lua/plugins/completion.lua | 23 +++++--------------- lua/plugins/lsp.lua | 10 ++++----- lua/plugins/quarto.lua | 44 ++++++++++++++++++++++++++------------ lua/plugins/ui.lua | 8 +++---- 4 files changed, 44 insertions(+), 41 deletions(-) diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua index 09b743a..9947137 100644 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -27,14 +27,6 @@ return { 'jmbuhr/cmp-pandoc-references', dev = false, ft = { 'quarto', 'markdown', 'rmarkdown' }, - config = function() - -- vim.api.nvim_create_autocmd('FileType', { - -- pattern = { "markdown", "quarto", "rmarkdown" }, - -- callback = function() - -- require('cmp-pandoc-references.lsp').start() - -- end - -- }) - end }, { 'hrsh7th/cmp-emoji' }, { 'kdheepak/cmp-latex-symbols' }, @@ -59,21 +51,16 @@ return { sources = { completion = { - enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev", "references", "emoji", "symbols" }, + enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev" }, }, providers = { -- dont show LuaLS require statements when lazydev has items lsp = { fallback_for = { "lazydev" } }, lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" }, - references = { - name = "pandoc_references", - module = "blink.compat.source", - -- opts = { - -- impersonate_nvim_cmp = true, - -- enable_events = true, - -- debug = true, - -- } - }, + -- references = { + -- name = "pandoc_references", + -- module = "blink.compat.source", + -- }, emoji = { name = "emoji", module = "blink.compat.source" }, symbols = { name = "symbols", module = "blink.compat.source" }, }, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index f670675..33de292 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -265,11 +265,11 @@ return { -- Add additional languages here. -- See `:h lspconfig-all` for the configuration. -- Like e.g. Haskell: - lspconfig.hls.setup { - capabilities = capabilities, - flags = lsp_flags, - filetypes = { 'haskell', 'lhaskell', 'cabal' }, - } + -- lspconfig.hls.setup { + -- capabilities = capabilities, + -- flags = lsp_flags, + -- filetypes = { 'haskell', 'lhaskell', 'cabal' }, + -- } lspconfig.clangd.setup { capabilities = capabilities, diff --git a/lua/plugins/quarto.lua b/lua/plugins/quarto.lua index 336e6aa..39ab1c0 100644 --- a/lua/plugins/quarto.lua +++ b/lua/plugins/quarto.lua @@ -4,7 +4,7 @@ return { -- for complete functionality (language features) 'quarto-dev/quarto-nvim', ft = { 'quarto' }, - dev = false, + dev = true, opts = { codeRunner = { enabled = true, @@ -128,23 +128,39 @@ return { { 'benlubas/molten-nvim', dev = false, - enabled = false, + enabled = true, + version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes build = ':UpdateRemotePlugins', init = function() vim.g.molten_image_provider = 'image.nvim' - vim.g.molten_output_win_max_height = 20 + -- vim.g.molten_output_win_max_height = 20 vim.g.molten_auto_open_output = true + vim.g.molten_auto_open_html_in_browser = true + vim.g.molten_tick_rate = 200 + end, + config = function() + local init = function() + local quarto_cfg = require'quarto.config'.config + quarto_cfg.codeRunner.default_method = "molten" + vim.cmd[[MoltenInit]] + end + local deinit = function() + local quarto_cfg = require'quarto.config'.config + quarto_cfg.codeRunner.default_method = "slime" + vim.cmd[[MoltenDeinit]] + end + vim.keymap.set("n", "mi", init, + { silent = true, desc = "Initialize molten" }) + vim.keymap.set("n", "md", deinit, + { silent = true, desc = "Stop molten" }) + vim.keymap.set("n", "mp", ":MoltenImagePopup", + { silent = true, desc = "molten image popup" }) + vim.keymap.set("n", "mb", ":MoltenOpenInBrowser", + { silent = true, desc = "molten open in browser" }) + vim.keymap.set("n", "mh", ":MoltenHideOutput", + { silent = true, desc = "hide output" }) + vim.keymap.set("n", "ms", ":noautocmd MoltenEnterOutput", + { silent = true, desc = "show/enter output" }) end, - keys = { - { 'mi', ':MoltenInit', desc = '[m]olten [i]nit' }, - { 'md', ':MoltenDeinit', desc = '[m]olten [d]einit' }, - { - 'mv', - ':MoltenEvaluateVisual', - mode = 'v', - desc = 'molten eval visual', - }, - { 'mr', ':MoltenReevaluateCell', desc = 'molten re-eval cell' }, - }, }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 68c97e5..1e55528 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -418,10 +418,10 @@ return { window_overlap_clear_enabled = true, tmux_show_only_in_active_window = true, window_overlap_clear_ft_ignore = { 'cmp_menu', 'cmp_docs', 'scrollview', 'scrollview_sign' }, - max_width = nil, - max_height = nil, - max_width_window_percentage = nil, - max_height_window_percentage = 30, + max_width = 100, + max_height = 14, + max_height_window_percentage = math.huge, + max_width_window_percentage = math.huge, kitty_method = 'normal', }