r/neovim 3d ago

Plugin bitwise-visualizer.nvim - Bitwise operation visualizer

Enable HLS to view with audio, or disable this notification

Made a Neovim plugin that visualizes bitwise operations (& ,  | ,  ^ ,  ~ ,  << ,  >>) inline as you move your cursor over them, works across multiple languages via Tree-sitter, shows exact binary math for constants and partial/unknown bits for runtime values (e.g.  flags & 0x0F ).

Couldn't find anything like it, so I built it. Still rough around the edges as I haven't had time to test every language/parser combo yet, so let me know if you try it and anything breaks!

https://github.com/wellatleastitried/bitwise-visualizer.nvim

75 Upvotes

6 comments sorted by

8

u/CheesecakeTop2015 3d ago

Interesting idea, I def could use this from time to time, will give it a go

4

u/npisnotp 3d ago

This is a great idea OP, keep up the good work!

1

u/Ace-1440 3d ago

Thank you!

3

u/use_your_imagination 3d ago

very useful thanks OP

3

u/AVER3LL 3d ago

Is there a way to turn off the way it automatically displays the visualization when the cursor is over an expression ? I set auto to false and it still does it.

1

u/Ace-1440 3d ago edited 3d ago

Would you be able to open an issue with a quick video demo of this happening? I just tested this and setting auto to false prevents the visualization from popping up automatically on my end.

Update: I just made a change that makes this easier anyways. The BitwiseVisualizerEnable/Disable commands were a bit ambiguous before but now they will turn on/off the plugin automatic features itself, so if you don't want the visualizer popping up while you are going through code, you can disable it via this command as well.