r/C_Programming • • Oct 09 '26

Video Reading assembly of a C source code directly inside neovim

868 Upvotes

68 comments sorted by

47

u/0xdeadf1sh Oct 09 '26

Since a lot of people liked it, I am sharing it as a public domain github repo: https://github.com/0xdeadf1sh/AssemblyForNeovim

40

u/pwnedary Oct 09 '26

You may want to take inspiration from the Emacs package: https://gitlab.com/jgkamat/rmsbolt

10

u/0xdeadf1sh Oct 09 '26

Wow this one's actually professional. Mine is just a single Lua file :D

19

u/Interesting_Buy_3969 Oct 09 '26 edited Oct 09 '26

I absolutely need that, thank you so much for sharing! (I don't see the link though, am I missing something?)

You should also repost in r/neovim so that more people discover it.

Edit: corrected my Engrish

11

u/0xdeadf1sh Oct 09 '26

Since a lot of people liked it I am sharing it as a public domain github repo: https://github.com/0xdeadf1sh/AssemblyForNeovim

2

u/Interesting_Buy_3969 Oct 09 '26

Appreciate that, thank you!!!

8

u/Siddhesh18 Oct 09 '26

This will be very helpful for getting in to assembly.

5

u/0xdeadf1sh Oct 09 '26

Yeah it also shows whether any assembly is getting outputted at all. I actually use it to see whether a function got inlined or not.

2

u/Siddhesh18 Oct 09 '26

Very cool! I could finally check whether any micro-optimizations actually do something.

3

u/0xdeadf1sh Oct 09 '26

You know you just gave me an idea: maybe we could put markers at the top & bottom of the visual block and then run it N times to see what the actual performance is. It'd be a different extension though.

5

u/Luigi_Boy_96 Oct 09 '26

I assume x86/x64 architecture, or does the plugin allow to configure the backend?

6

u/0xdeadf1sh Oct 09 '26

On my laptop yes, but I also have a bananapi m7 where aarch64 assembly shows up.

2

u/Luigi_Boy_96 Oct 09 '26

So it automatically deduces the running platform itself, I guess.

10

u/SubhanBihan Oct 09 '26

What's the VS Code equivalent?

19

u/0xdeadf1sh Oct 09 '26

Someone might have done it already but I haven't checked. I use neovim mostly.

6

u/hatsuneadc Oct 09 '26

That is so cool, is this a plugin?

10

u/0xdeadf1sh Oct 09 '26 edited Oct 09 '26

It's a lua script that neovim loads in C/C++ files. Not sure if I'd call that a plugin, more like a script.

Edit: here's the github link to the repo: https://github.com/0xdeadf1sh/AssemblyForNeovim

1

u/glitchyMate Oct 09 '26

this is sexy, are you planning on opensourcing?

4

u/0xdeadf1sh Oct 09 '26

Hmm should I just dump it like a comment to this post? It's just a small lua file :D

1

u/glitchyMate Oct 09 '26

github preferably, i'd love to share it with colleagues

5

u/pjl1967 Oct 09 '26

I'm old(er) school and just use vim. It would be nice to just use a split window in vim.

-2

u/AbleConfection381 Oct 09 '26

bro vim and nvim is the literally same stop limiting yourself for dumb reasons

0

u/laurentbercot Oct 09 '26

4

u/0xdeadf1sh Oct 09 '26

Linux kernel contributions are also increasingly AI generated, but I don't wanna leave linux.

-3

u/laurentbercot Oct 09 '26

You can pin Linux to a working pre-slop version. It will work. LTS gets the fixes backported.

You can use vim-classic, or a pinned version of vim.

LLMs are not inevitable. That's what the companies providing them want you to think, but it's not true.

4

u/non-existing-person Oct 09 '26

At one point that non-llm version of Linux will get heavily outdated. And LLM are actually good at helping to find vulnerabilities. So at certain point your only move is to ditch linux for something else.

I'm no fan of LLM myself. But if we refuse to use any program that has been touched by LLM. We then soon will have very limited software selection :/

7

u/0xdeadf1sh Oct 09 '26

We will use TempleOS, in the way God intended.

-1

u/laurentbercot Oct 09 '26

We are working on it. Just please don't make it worse for us.

5

u/ErorrTNTcz Oct 09 '26

"AI assisted" doesn't inherently sound like it was vibe-coded. Yeah if someone just asked ai for a quick patch/update and blindly pushed it then call it out, but AI will generally save you a lot of work if you understand what it made and have the ability to incorporate it to your code safely.

0

u/laurentbercot Oct 09 '26 edited Oct 11 '26

That's the point: there is no way to incorporate it into your code safely. For cognitive reasons (your thinking about the project gets influenced by what the LLM put it), and for legal reasons (the LLM has been trained on stolen content, and nothing it produces is copyrightable), even if you don't care about the environmental and political reasons to stay away from LLMs.

Yeah, it seems helpful, but it's a poisoned gift, or a devil's bargain.

ETA: you can downvote me all you want because you don't like it, but it doesn't make it any less true.

2

u/C_Sorcerer Oct 11 '26

You know some people just simply Google something and an AI thing shows up right? A lot of the time it’s easier just to read what it says there rather than go through loads of documentation. I try to use documentation where present but if I see something simple like a function signature pop up on Google, I’m using that

1

u/laurentbercot Oct 11 '26

Yeah, most people would rather do the easy thing than the right thing. That's exactly why we are where we are now.

2

u/C_Sorcerer Oct 12 '26

Dude. As someone intensely against AI, this is still just too extreme. I love wasting time reading through sloppy Reddit and stackoverflow threads trying to figure out what my problem is rather than looking at a single thing that compiles it. Laziness is copying code goofball. I never and will never copy code. Learn the difference and stop being a dense asshole. I hate AI but if it’s right there and it’s only an informational reference then just do it

0

u/laurentbercot Oct 12 '26

As intensely against AI as you say you are, it seems like you're not against it enough. I can only hope that you understand my position (and I'm not alone, far from it) one day, when you experience the brain rot for yourself; and the sooner the better.

4

u/C_Sorcerer Oct 13 '26

I am more against AI than you pussy fuck you its just Google imbecile

1

u/IllustriousCareer6 Oct 11 '26

That's just extreme thinking. It's literally right there, why would you take a longer route just because you don't like using AI? Like it or don't, it's here and acting like it's not useful for ANYTHING is beyond foolish. Good luck with that.

1

u/laurentbercot Oct 11 '26

They're not paying you enough to be a slop propagandist.

1

u/IllustriousCareer6 Oct 11 '26

I'm against slop, what's your point?

0

u/Elkatra2 Oct 09 '26

yeah in the case if you really well understand your subject of what your doing AI help a lot

0

u/DamsLcs4421 Oct 10 '26 edited Oct 10 '26

Makes me think of Dave Plummer, have you heard about him? Retired engineer from Microsoft, worked on W95 up to XP, shell team if I recall correctly. Anyway, the good old "taskmgr.exe" is from him! You can find him and his stories on Youtube... as well as a brand new (multiplatform) vibe-coded task manager.

(I guess he wanted to try for real, he's really not a casual dumb programmer believe me :p)

Although he realeased it like for free as of now but with a paid "full features" version to come, he also shared the 'bigass prompt' (more of a specification) he submitted to get this application done.

People are amused cause "it doesn't ressemble a prompt, it's like he himself as senior dev told exactly to the agent how to build this thing in the minute details and wrote the full specification"... Boys will, I mean, Programmers will be programmers 🤗

4

u/Interesting_Buy_3969 Oct 09 '26

AI-assisted doesn't automatically mean "vibecoded slop", even though I still don't like it

1

u/itsoctotv Oct 09 '26

when you need to ENHANCE

1

u/Tryton77 Oct 09 '26

Love it, thanks

1

u/Total_Ad803 Oct 09 '26

Probably very useful

1

u/xpusostomos Oct 09 '26

That's fun, what a wonderful learning tool if you wanted to learn assembly.

1

u/Athropod101 Oct 09 '26

Super dope. Is it AVR compatible? If not, how difficult would it be to incorporate?

1

u/4bjmc881 Oct 09 '26

Is there a helix plugin that does the same?

1

u/Standard-Value-9737 Oct 10 '26

aw that's sick as hell

1

u/[deleted] Oct 11 '26

That's really cool, i've been wanting to switch over to neovim from vim for a while but haven't had the time

1

u/pragmaticSloth Oct 12 '26

I would love to have this, but instead of having assembly, looking the definition of a function :)

1

u/Wayne_Fidger Oct 13 '26

What theme is that, it looks wonderful.

2

u/Outrageous-Radish319 Oct 15 '26

I also want to know! It's gorgeous

1

u/LiarisHeart Oct 14 '26

Super cool!

1

u/Chingiz11 Oct 16 '26

Do you plan to add MIPS and RISC-V support?

0

u/PlusComplex8413 Oct 09 '26

Awesome. Is it native to neovim?

2

u/0xdeadf1sh Oct 09 '26

Honestly the script is kind of scuffed. You need to have a compiler installed, and I haven't really tested it on many different systems. This is from arch linux on x64 cpu.

0

u/Dan13l_N Oct 09 '26

It's in the Intel format, interesting!

4

u/0xdeadf1sh Oct 09 '26

Yeah I don't like %%% sprinkled over my assembly

-5

u/soundman32 Oct 09 '26

Right click, view dissasembly? it might be neat in neovim, but my IDE of choice has had this feature since I started in the late 80s.

2

u/0xdeadf1sh Oct 09 '26

Not right click, we neovimmers don't like mice. It's space + a keystore.

0

u/soundman32 Oct 09 '26

It was probably alt-V/D back in the days of TurboC.

0

u/[deleted] Oct 09 '26

[deleted] — view deleted comment

2

u/0xdeadf1sh Oct 09 '26

My own custom matrix theme. My whole KDE is green matrix right now so everything looks consistent.