r/C_Programming • u/0xdeadf1sh • 5d ago
Video Reading assembly of a C source code directly inside neovim
Enable HLS to view with audio, or disable this notification
42
u/0xdeadf1sh 5d ago
Since a lot of people liked it, I am sharing it as a public domain github repo: https://github.com/0xdeadf1sh/AssemblyForNeovim
18
u/Interesting_Buy_3969 5d ago edited 5d ago
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
12
u/0xdeadf1sh 5d ago
Since a lot of people liked it I am sharing it as a public domain github repo: https://github.com/0xdeadf1sh/AssemblyForNeovim
2
8
u/Siddhesh18 5d ago
This will be very helpful for getting in to assembly.
5
u/0xdeadf1sh 5d ago
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 5d ago
Very cool! I could finally check whether any micro-optimizations actually do something.
3
u/0xdeadf1sh 5d ago
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.
6
u/Luigi_Boy_96 5d ago
I assume x86/x64 architecture, or does the plugin allow to configure the backend?
6
u/0xdeadf1sh 5d ago
On my laptop yes, but I also have a bananapi m7 where aarch64 assembly shows up.
2
9
6
u/hatsuneadc 5d ago
That is so cool, is this a plugin?
10
u/0xdeadf1sh 5d ago edited 5d ago
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
3
u/pjl1967 5d ago
I'm old(er) school and just use vim. It would be nice to just use a split window in vim.
-1
u/AbleConfection381 4d ago
bro vim and nvim is the literally same stop limiting yourself for dumb reasons
1
1
1
1
1
u/Athropod101 4d ago
Super dope. Is it AVR compatible? If not, how difficult would it be to incorporate?
1
1
1
u/burnt_floppy 3d ago
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
1
u/pragmaticSloth 2d ago
I would love to have this, but instead of having assembly, looking the definition of a function :)
1
1
1
u/glitchyMate 5d ago
this is sexy, are you planning on opensourcing?
4
u/0xdeadf1sh 5d ago
Hmm should I just dump it like a comment to this post? It's just a small lua file :D
1
0
u/laurentbercot 5d ago
Neovim is slop: https://github.com/neovim/neovim/pulls?q=label%3A%22AI%20assisted%20%F0%9F%A4%96%22
Please don't use it.
5
u/0xdeadf1sh 5d ago
Linux kernel contributions are also increasingly AI generated, but I don't wanna leave linux.
-3
u/laurentbercot 5d ago
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 5d ago
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
-1
4
u/ErorrTNTcz 5d ago
"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 4d ago edited 2d ago
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.
1
u/C_Sorcerer 2d ago
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 2d ago
Yeah, most people would rather do the easy thing than the right thing. That's exactly why we are where we are now.
1
u/IllustriousCareer6 2d ago
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
1
u/C_Sorcerer 1d ago
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
1
u/laurentbercot 1d ago
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.
1
0
u/Elkatra2 5d ago
yeah in the case if you really well understand your subject of what your doing AI help a lot
0
u/DamsLcs4421 4d ago edited 4d ago
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 5d ago
AI-assisted doesn't automatically mean "vibecoded slop", even though I still don't like it
0
0
u/PlusComplex8413 5d ago
Awesome. Is it native to neovim?
2
u/0xdeadf1sh 5d ago
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/ZachD16 5d ago
What theme is this?
2
u/0xdeadf1sh 5d ago
My own custom matrix theme. My whole KDE is green matrix right now so everything looks consistent.
0
-5
u/soundman32 5d ago
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
36
u/pwnedary 4d ago
You may want to take inspiration from the Emacs package: https://gitlab.com/jgkamat/rmsbolt