git clone https://github.com/mrinmoyf2/Vim-Strudel.git
cd Vim-Strudel
npm install
npx playwright install
- In ~/.vimrc
autocmd BufWritePost main.js silent! !curl -X POST --header "Content-Type: text/plain" --data "%" http://localhost:3000/update
- Add the following line to the end of the file. This creates an "autocommand" that triggers only when you save a file named main.js inside your project.
autocmd BufWritePost main.js silent! !curl -X POST --header "Content-Type: text/plain" --data "%" http://localhost:3000/update
node server.js
Now, structure your project with a main file and component files. Your server directory (vim-strudel-live) should look like this:
vim-strudel-live/
├── node_modules/
├── components/
│ ├── drums.js
├── main.js
├── package.json
└── server.js
components/drums.js
// This file only contains the drum pattern
sound("bd hh*2 sd [hh bd] bd - [hh sd] cp")
main.js
// @import "./components/drums.js"
- Run
node server.js. - Open
main.jsand your component files (e.g.,drums.js) in Vim. - Make changes to
drums.jsand save it. Nothing will happen. - Now, simply open
main.jsand save it (:w), even without making any changes. - The server will now re-read
main.js, pull in the latest versions ofdrums.js, and update Strudel with the complete result.