Skip to content

User provided URL for launching Strudel sessions #23

@BriceChivu

Description

@BriceChivu

Hello,
First of all, thank you very much for having built this plugin. I'm having a lot of fun using it!
I'm not very knowledgeable in the technical aspects, so my apologies if my question is trivial.
As I'm often offline, I would find it very useful to be able to have nvim strudel plugin to launch a Strudel session locally, as opposed to Strudel.cc.
I tried to vibe-code my way into this but failed...
Is what I am describing even possible? If so, could you be kind enough to guide me, please?

Here is my /Users/brice/.config/nvim/lua/plugins/strudel.lua:

return {
  "gruvw/strudel.nvim",
  build = "npm install",
  config = function()
    require("strudel").setup({
      ui = {
        maximise_menu_panel = true,
        hide_menu_panel = false,
        hide_top_bar = false,
        hide_code_editor = false,
        hide_error_display = false,
      },
      update_on_save = false,
      sync_cursor = true,
      report_eval_errors = true,
      headless = false,
      browser_data_dir = "~/.cache/strudel-nvim/",
    })

    local strudel = require("strudel")

    vim.keymap.set("n", "<leader>sl", strudel.launch, { desc = "Launch Strudel" })
    vim.keymap.set("n", "<leader>sq", strudel.quit, { desc = "Quit Strudel" })
    vim.keymap.set("n", "<leader>st", strudel.toggle, { desc = "Strudel Toggle Play/Stop" })
    vim.keymap.set("n", "<leader>su", strudel.update, { desc = "Strudel Update" })
    vim.keymap.set("n", "<leader>ss", strudel.stop, { desc = "Strudel Stop Playback" })
    vim.keymap.set("n", "<leader>sb", strudel.set_buffer, { desc = "Strudel set current buffer" })
    vim.keymap.set("n", "<leader>sx", strudel.execute, { desc = "Strudel set current buffer and update" })
  end,
}

I have a local installation of Strudel and inside it I have "run-strudel.sh" (/Users/brice/Documents/strudel/run-strudel.sh):

#!/usr/bin/env bash
set -e
cd /Users/brice/Documents/strudel/website
pnpm preview --port 4321 --host 0.0.0.0

So running ~/Documents/strudel/run-strudel.sh spins up a Strudel session in http://localhost:4322/, which allows me to code and play music without internet connection. But I'm struggling to sync that session to nvim strudel plugin...

Let me know if other information is needed!
Thanks a ton in advance for your time

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions