Vim editor bindings (or external editor) and mocking led configurations

I tried searching for it, but not a lot of luck, and was hoping y’all could point me to something, and if not, then I have a weekend project.

I use vim for most of my coding, and I’d love to be able to work on things between meetings without having to plug in my board. Has anyone made a language mapping file for vim or any other editor to work on things locally?

Also, any tools to test led configurations and how patterns play out on it without the physical leds hooked up? I would love to test configurations and patterns on them without having to set it all up first (especially for wearables where I could do lots of configurations).

Thanks!

What, the existing JavaScript syntax highlighting isn’t good enough? :stuck_out_tongue: It would be nice to have a full dev loop without a web browser but … not so nice that I have set it up myself. With sufficient duct tape it would be possible to set it up such that writing your file would set it running on the PB immediately.

The preview on the Edit tab works for me. Apparently you can tweak its appearance via some browser JS variables. There is also PixelTeleporter which will read the PB output over a serial port and draw a preview for you via Processing.

PixelTeleporter looks awesome, but no mac support :frowning: I’m guessing that has to do with lack of a serial port?

I don’t need to have code from local sync to the PB, just prefer programming in vim and could copy/paste as needed.

The language itself is a subset of JavaScript (ES6). I don’t know of a PB specific language mapping file for vim, etc.

I’d second the in browser preview, added in V3.24. There has always been a live 1D preview on top, and now in the editor a preview for 2D/3D if a pixel map is configured. You can do most things with these previews without any physical LEDs, though you still need a Pixelblaze running and a browser.

The language compiler runs in that browser app, so sending it code via another method is going to be fairly challenging.


However, the editor used (Ace) does have a vim mode, via a plugin that doesn’t ship with Pixelblaze. Thanks to StackOverflow, I found a way this can be loaded on demand. Running this in your browsers dev console seems to do the trick:

ace.require("ace/lib/net").loadScript("https://rawgithub.com/ajaxorg/ace-builds/master/src-min-noconflict/keybinding-vim.js", 
function() { 
    editor.setKeyboardHandler(ace.require("ace/keyboard/vim").handler);
})

With a bit of work you could hack that into the page (download, ungzip, hack, gzip, upload) or use some browser extension to inject that snippet whenever you load the page.

Or use this purpose built extension that enables vim on any Ace editor:

3 Likes

BTW, PixelTeleporter works fine on Macs. All the UI code is platform independent.

It’s in Processing (which is really just Java). And you should be able to use the Linux version of the USB->serial server if you’ve got the appropriate adapter. Or, you could skip the serial port entirely, hook your Pixelblaze to an ESP8266 and send the data over your network.

It still requires that there be a Pixelblaze around somewhere though – you just don’t have to have the actual LEDs.

All of this is so amazing, thanks for the pointers and resources. I have a lot to set up and play with :slight_smile:

I wish I had known about all of these things like 5 years ago. The days of spending 20+ hours to get leds onto clothing and then hope you can do interesting patterns are over.

2 Likes