Ask HN: Could VSCode be the new Emacs?
VSCode is clearly a code editor. Emacs is used by many as an operating system / UI framework / app platform.
Emacs's adepts have been using it for email, calendars, process management, taking notes, terminal GUI, coding (dah), and some even browse the web without leaving it.
I've been using Orgmode (+ org-roam) for a couple of years already and no other software can replace it for me.
I have huge respect for this almost 40 years old piece of technology and all the people keeping it alive and active. I love the hacker community around it.
All that said, I mostly hate using Emacs. It's slow (I have i7 with 4 cores and 32Gb of RAM). Emacs Lisp drives me crazy. I constantly mis-press some weird key chord and enter a state where I can't do anything unless I restart the app. It's hard for me to find docs on how to integrate with various parts of the UI, so I mostly rely on reading the source code of different extensions. Two years in, I still can't read Emacs Lisp well.
I feel unproductive when changing how Emacs behaves. And I've been coding for 7+ years, including functional programming.
---
Now, I've been using VSCode for quite a while (after 4 years of Vim).
I've noticed that, on the surface, VSCode extensions can do everything Emacs does.
If you think about it, VSCode is a UI framework too — there's an API for all the UI components such as the sidebar or the text editor area itself; and you can also add your custom commands that can be triggered in a number of ways.
Which means you can actually implement things like Orgmode in VSCode.
Also: - You are coding using the most popular ecosystem in the world (Web). - The community is larger than one of Emacs. - The docs are much friendlier.
---
From what I understand, the main difference is that with Emacs you can start hacking any part of the environment right from the start. It's designed to be played with.
With VSCode, you just have a strictly defined JSON config file, and everything else requires you to work with "extensions" which sounds like something less accessible and "oh, that sounds grand, I'm not sure how deep that rabbit hole is". You can't just open a file, define a new hook or whatever and now your VSCode behaves differently.
But are there any other reasons, technical or otherwise, why people don't seem to use VSCode for things beyond editing code?
If only you could open some special file, write some Typescript, and modify anything about VSCode in a dirty hacker manner, would you use it?
92 comments
[ 3.8 ms ] story [ 116 ms ] threadMaster Foo nodded.
The novice continued: “Isn't it also the Unix way that the wheel should not be reinvented?”
Master Foo nodded again.
“Why, then, are there several tools with similar capabilities in text processing: sed, awk and Perl? With which one can I best practice the Unix way?”
Master Foo asked the novice: “If you have a text file, what tool would you use to produce a copy with a few words in it replaced by strings of your choosing?”
The novice frowned and said: “Perl's regexps would be excessive for so simple a task. I do not know awk, and I have been writing sed scripts in the last few weeks. As I have some experience with sed, at the moment I would prefer it. But if the job only needed to be done once rather than repeatedly, a text editor would suffice.”
Master Foo nodded and replied: “When you are hungry, eat; when you are thirsty, drink; when you are tired, sleep.”
Upon hearing this, the novice was enlightened.
EDIT - source: http://www.catb.org/esr/writings/unix-koans/shell-tools.html
Why it is historically and culturally significant: https://en.wikipedia.org/wiki/The_Gateless_Barrier
Unix is an OS for I/O streams / lines. That's what it's good at. That's what the tools are designed for.
perl -pie 's/foo/bar/'
C-g
> You can't just open a file, define a new hook or whatever and now your VSCode behaves differently.
By that definition of extensibility, even gEdit "could be the new Emacs".
> the main difference is that with Emacs you can start hacking any part of the environment right from the start. It's designed to be played with.
You just answered your own question.
I think you nailed the big difference right there.
I mostly use vim but configuring the editor is a gateway to programming new functionality. You start small by defining a function bound to a key. Then you start exploring more of the api and gluing functions together. Eventually you refactor it a bit if you find it worth sharing.
I've only used emacs for a bit and I understand it has more of that "OS" aspect to it where people stay in their editor for a lot of tasks that are more than just"edit text". But like vim, users can tweak functionality in a relatively accessible and not overly-limiting way. And they are introduced to this early on.
I've used vs code. It's pretty. It works well. I have the impression that to change functionality I either have to hope it already exists as a toggle somewhere or go read how to write a full vs code extension. At least in my experience, it lacks the incremental aspect described above.
The best answer I've seen to this question is https://www.murilopereira.com/the-values-of-emacs-the-neovim...
Amongst other things, it lists different values that each tool prioritizes, and how "Core values are self-reinforcing. They attract like-minded people, who will then defend them."
Emacs: Extensibility, Freedom, Introspectability, Keyboard centrism, Stability, Text centrism.
VSCode: Approachability, Integration, Maintainability, Progressiveness, Velocity.
That is, even if VS Code achieves technical parity with Emacs (wrt introspectibility/extensibility), its community might not prioritize using VS Code for things beyond editing code.
Or maybe it will. These things are difficult to predict!
[0]: https://insights.stackoverflow.com/survey/2021#section-most-...
Hmm not so sure about that. The main reason that I have not complete switched over to VS Code, is that it feel klunky and I'm using a 16GB macbook pro, not top of the line, but something where I should expect a code editor would feel not so klunky.
I doubt I'll ever not use vim when I'm working/thinking in systems mode, though. The thought of waiting for a "real" editor to launch when I just want to edit a tiny unstructured file is a sad one to me.
Amen to that. That's why I use emacs. ;) Just timed it myself, started and ready to go in 120ms. Pretty sure we can shave more time off that.
Let me get this straight. You plan to code for hours, and your biggest concern at this point in time is your editor takes 1 - 2 seconds more to start?
A second is 1.666666666667% of a minute. And 0.02777777777% of an hour. Just how much more productive are you getting by saving this time?
On the other hand emacs is notorious for making users spend days to get a decent working set up. And even that's more like bad vscode clone than anything else.
On the scale of reality, it's obviously less time to just pick up VScode in a few hours of learning (if that), and then deal with it taking 2-3 seconds to launch
But on the scale of programmer brain, it's clearly wayyyy better to invest days into learning emacs, writing custom configs for it, learning plugin ecosystems, and the like so that you can see and FEEL that 150ms startup every time.
If you are writing html, css, react, js, python, sql and myriad other things. Then having all of this configured to your likings is a multi month project. While vscode gets you up and running in minutes.
Edit efficiency should be least of your worries. vscode constantly reminds me if I forgot to import something, or if I imported something and forgot to use it. It lets me navigate code semantically, not just through text tags. It lets me debug, have a project running on a remote box, and let me work on it like Im working locally etc etc. Writing a full feature list will make this a blog post/book.
At the end of the day my job is write code, not to work on side tooling projects.
NO. Mine isn't. I happily used emacs when it took a solid half a minute to fully load. Hell, I once was stuck on an AIX machine that needed lots of maintenance and figured it would "save time in the long run" if I built emacs from source so I could debug things there instead of copying files back and forth. Eight megs and constantly swapping and I feel fine. :) I was just pointing out the startup time as an easy way to pop the nonsensical argument that on today's hardware emacs is anything but lightning fast.
> On the other hand emacs is notorious for making users spend days to get a decent working set up.
Days? Powerful tools can take years to master! The best are those which let you be productive immediately, while providing a natural and built-in path for you to grow as you need to. Make easy things easy, hard things possible, &c.
It's naive to measure productivity in editor startup times when developer satisfaction is way more important.
Clearly this developer values shaving time off editor start time. Seems like it's a mistake to conclude they are concerned about recouping the milliseconds.
To be honest, I don't even notice what happens in 1 - 2 seconds.
Its like less than the time I take to sip my green tea.
And yeah more importantly. I don't kill vscode and restart it every day that's more like once in a few weeks.
I think Im ok sacrificing 1 - 2 seconds a month for the value vscode has to offer.
> VSCode: Approachability, Integration, Maintainability, Progressiveness, Velocity.
VSCode: Microsoft, Approachability, ~Integration~, ~Maintainability~, ~Progressiveness~, ~Velocity~.
Some people like customizing the heck out of their editor, getting super deep into metaprogramming and macros. Personally, I don't really have time for that. I want an editor which does 95% of what I want out of the box. For me, that's pycharm, but vscode is really nice as well. It feels lighter than pycharm.
You can usually configure all kinds of macros and plugins for IDEs. Like you said, it's a bit of a rabbit hole, but so is emacs lisp.
You will hopefully be programming for decades: I have been programming already for three decades and I expect I will be programming for another two before my mind gives out (if I am lucky, I might get another four). Customize your tools: they are yours, and being able to continue using and improving your workflow over time isn't a distraction if you are in this for the long haul.
The core point is overall productivity; it may still be more productive overall not to know some tools extremely well.
I have programmed for 20 years professionally (and a few more). I have the exact opposite approach. I don't even learn ketyboard shortcuts, would never customize my environment even a little (like moving a tool window around in an IDE) because it just doesn't stick. The difference in philosophy is probably because I'm a windows dev and I just don't have (or trust) there to be a persistent settings storage. The small papercuts of not customization it is less annoying than the constant re-customization required when it keeps breaking, or you use a different machine. There is no real dotfile system, the user profile directory is a mess and even if it is, applications usually don't bother to maintain their settings and compatibility. So my philosophy has basically become: change nothing, and everything will look your way even on a clean system (and after the next upgrade).
On the joke side, Emacs also started out as a resource hungry beast, just like VS Code now.
Emacs feels to me a bit more extensible, and does a number of things better than VS Code (e.g., can cut rectangles, better shortcuts, regexp support, and others).
Sure VSCode has its strengths and as an IDE easier to get started and work with, especially for newcomers. That said, the fact that it requires a desktop environment to operate in means there are niches that Emacs fills which VSCode currently cannot.
Yes, but it's very buggy, and tends to drop both connections and characters all the time. If you're doing heavy terminal work you need an external terminal.
EDIT: actually I realised you were probably talking about running headless, whereas I was thinking of an integrated terminal. I don't believe vscode can run headless.
No
Can VSCode be used to SSH to a remote machine and immediately start editing with muscle memory using the same keystrokes as in the GUI?
Yes: https://code.visualstudio.com/docs/remote/ssh
On the other hand vscode is first class, or almost.
Seemed to work well.
The key is to get a shortcut to emacs in your SendTo menu :)
Practically speaking, now that VS Code extensions can present web views, they can be arbitrarily powerful as long as they don't need to mess with the editor's internals that is not exposed by the extension API. So making things like a mail reader or pixel editor is fine. Rearranging the whole UI is not.
probably the best thing that come from Microsoft in decades
update: has momentum, a huge marketing budget (helps) and the cost of entry way lower than emacs' one (typescript ecosystem a fair bit less exotic than lisps').
performance is OK, really. i remember more than 20yrs ago when one had to use vi, micro emacs and lesser options because emacs was then the resource hog. at same age / stage vscode is way less hungry than emacs then...
- It's really slow (noticable keyboard latency) and this bums me out.
- Haven't yet got into a proper VSCode git plugin but I'm pretty sure when I do I'll still miss Magit.
- The only place where I really miss Emacs' ultra flexibility is the window management. VSCode's model is pretty simplistic and seems dumb to me.
On the whole with my hatred of ELisp I think the relative inflexibility of VSCode is a wash, especially when you factor in how easy it was to get started. But it does make me sad to know if I stick with it I'll never escape the slowness.
What the fuck does "the new emacs" mean?
99% of my time in front of the computer is spent in an editor (for both work and play). Having invested and continuing to invest so much time and effort in my tools and my environment, I would hate for something so fundamental in my life to not be free as in freedom:
By choosing open source, you can reduce the amount of carpet pulled out from under you.But yes, it is a valid concern for sure.
If tomorrow Microsoft decided that some new versions of essential extensions should follow the same path VsCodium would basically become useless, I wouldn't trust Microsoft that easily.
> It's slow (I have i7 with 4 cores and 32Gb of RAM)
Something is wrong here. I can't remember the exact specs of the machine when I first started using it but it might have been as low as a 486 with 1 core and 32Mb of RAM.
On the other had vscode is the best experience I've had editing files remotely. Unlike emacs where you have install and configure tramp. The experience in vscode was seamless. In fact the Python vscode plugin is clever enough to understand you are opening a remote python project. It will ensure the local venv is set up with all your tooling(flake, black etc)
None of this possible with Emacs.
Emacs gives a good editing experience. But we have moved one from coding being merely a text typing excercise.
I want to process and respond to this question, but I can't get past:
> It's slow (I have i7 with 4 cores and 32Gb of RAM)...
Consider that you must be doing something deeply wrong? I have a broadwell (2015) i7, 2 cores, 16GB of ram (8 of which is reserved), and Emacs is quite fast.
I tried to use VSCode once, around when it came out. It was a pathetic joke. Once you manage to stop laughing at the concept of using an editor, hosted in a webbrowser, written in javascript, you were able to enjoy exactly the performance you would expect from such an "application".
I couldn't type more than a few lines before the high latency, and the fact that I could feel my CPU heating up, gave me all the info I needed.
What's VSCode for?? I don't do much (any) UI work, so I'd believe you if that's its strength, but.. an editor???? I doubt it!
Having noticeable latency between keystrokes and requiring huge amounts of system resources make it kinda ... hard to take seriously.
> I couldn't type more than a few lines before the high latency, and the fact that I could feel my CPU heating up, gave me all the info I needed.
Consider that you must be doing something deeply wrong? I have a MacBook Pro (2015) i7, 4 cores, 16GB of ram, and VS Code is quite fast.
Keep in mind I said "when it came out". I don't know when that was, and maybe it's improved. A bit. That being said, the fact that VS Code isn't a native application, but something run as a local web app, is all the info you need. (no idea how it's gonna grab the keybindings it's gonna need if it's in a web browser... and the fact that it burns CPU on blinking the cursor isn't exactly a sign of Quality Engineering)
I would consider that, if it made sense to do so. But, my coding environments are pretty bare bones, there's not a lot of things to "do" wrong.
That being said, if I can do so in under a few minutes, I'll install VSCode right now and see if it runs... And if VSCode seems fast on your machine, you should check out emacs! ;)
I do mostly backend development in a few languages, all using emacs, but will bust out VS Code when I need to browse a web codebase for whatever reason. It's a very performant application. It can grab all the keybinds it needs and my install with a handful of addons doesn't burn CPU doing nothing and is just as snappy as emacs.
Happy to discuss the pros of emacs but your cons list for VS Code is in part wildly outdated and in part flat out untrue.
What's untrue about it?
Not disagreeing with you, just am not in a position to test it myself (yet). I JUST managed to get VS Code installed, and am trying to run it for the first time, as I type this...
> ... bust out VS Code when I need to browse a web codebase for whatever reason.
Makes sense. I'll just go ahead and believe you on this, because I don't know what a "web codebase" is, how it might differ from a normal one, and hence benefit from whatever specialized tooling VS Code has for that. Does "web codebase" mean any interactive webapp, with HTML, JS, CSS, and some language or UI framework combined? I wouldn't be surprised if VS Code is superior out of the box for those sorts of things, if it's designed for them.
> It's a very performant application. It can grab all the keybinds it needs and my install with a handful of addons doesn't burn CPU doing nothing and is just as snappy as emacs.
We'll find out won't we! I now have VSCode running for a comparison. "just as snappy" is far from true, but I admit, it's far more responsive than when I tried it before. Possibly even usable.
I like the seamless integration of extensions! The need to "pick a folder" just to open and compile a single file seems a bit unnecessary, but a small annoyance. But I stand corrected, this is not nearly as bad as I expected. Once I can make it use emacs key bindings, and tweak it enough to have less "policy requirements" it might be worth a peek.
For the most part emacs is also not native: most of emacs is written in elisp, which only got a compiler very recently and it is very likely still nowhere as good as as the V8 jit.
I understand that as most electron applications VSCode was very slow and bloated initially, but these days people say is quite snappy (I wouldn't know, I never used it).
I did, I rely heavily on code completion, hinting, linting, marking unused variables, lighting big red light when I made type error... you get the point. And I have two conclusions. First is that setting all up how i like it was a pain, I finally had to use Doom Emacs as a boilerplate (kudos for hlissner, I believe this is best Emacs hope for new users), and it made it bearable, but whole setup felt really slow when UI had to take second or two before showing my precious type error.
Now, I really believe you when you are saying that i could make it faster. It's just that I would have to put evenings just to be basically in the same place.
Additionally, I would replace the most popular editor with one that has an almost negligible share of the "market".
The "it burns CPU on blinking the cursor" argument doesn't appeal to me at all, because it's not like the computer is unresponsive because that cursor is blinking, or even noticeably slower. I have to spend dozens of hours learning and configuring emacs to make parameters I don't notice improve?
Webbrowsers are designed, as it's main function, to display text. Makes sense to me to use something that can render text in all sorts of different ways *as a text editor.*
I've tried to use Emacs several times, and come away thinking that it does a lot of things, but none of them particularly well. Elisp seems fine I suppose, but JavaScript is one of the most popular programming languages and so it's sensible to use that as a basis for an ide whereby more people have the existing knowledge to hack away with it.
Elisp is antisocial and restricting because Stallman fought against the use of modules and they only become available in with Emacs 25. As for FFI Emacs developers are still dragging their feet inspite of other developers an Emacs developer actually having done the work. All the core developers need to do is to integrate it.
As for question itself, yes VSCode can be the new Emacs if your workstations are powerful enough, Apple M1 Pro Max or whatever.