Moving from Emacs to VsCode

Posted on August 16, 2023 • 7 min read • 1,461 words
Share via

My thoughts and reasoning about moving to VsCode.

Moving from Emacs to VsCode
Photo by Unkertmedia on unkertmedia.com

What do I even know about Emacs?

I have been an avid Emacs user for about 12 years. In that time I have curated a decently extensive Emacs config file both for stock emacs and for the spacemacs config.

My config before moving to spacemacs was around 1200 lines including comments etc. Before moving to VsCode my .spacemacs file was 770 lines including a lot of comments.

In comparison my VsCode settings.json is currently 95 lines and keybindings.json is 43 lines where parenteses is a line by it self. I have 9 custom keybindings in that file, so that is not a lot of custumization.

I would argue I have gotten my hands dirty with Emacs and know a decent amount about how it works and how I configure it - still I am by no means an expert and that is part of the problem.

Reasons for moving away

As I’ve talked about in other posts my life circumstances has changed over the last couple of years. Girlfriend, dog, house and now kid take a lot of my spare time, so the time I do have to code and tinker with tech is limited. That is why I put a lot of value in tooling that doesn’t get in my way.

Custom configuration

Emacs can do about everything VsCode can do and even more, but that also comes with the price of a lot of custom configuration. With a decently sized configuration something is bound to break when some package you are using updates etc. Every time I’ve reinstalled my operating system over the years or gone to a newer version something in the emacs config needed updating and I had to spend time bug hunting.

Just take setting emacs up for a new language like python. You need to figure out what package to use for syntax highlighting and configure it to activate on the correct files, then you would like auto complete and need to setup an language server outside of emacs that emacs can communicate with to do the autocompletion, then there is linting, debugging, project management etc. It’s not hard to do once you get the hang of Emacs the learning curve is just a lot more steep.

This leads me to my next topic

Packages

Elpa is a great addition to the emacs community, but compared to the VsCode extension marketplace it’s lacking in UX and discoverability. It is rarely just click and install almost every package requires some sort of custom configuration to work, where compared to VsCode everything is packaged in the extension.

In the example above about setting up an editor for Python development; in VsCode i just opened a .py file and it asked me if i wanted to install the exstension to manage that. I clicked yes and was up and running with syntax highlighting, code completion etc. in a matter of seconds. Now i prefer black formatter for python so i searched marketplace and got it going in a minute. Now with time I decided to do some minor custumizations to the extensions. That can be done in a settings UI for discoverability and whatever setting is changed is appended to your settings.json file where you also can configure yourself.

With VsCode my config is rather limited and the extensions are in my opinion easier to manage than what elpa offers and I am yet to have an extension just break down and stop working in VsCode after an update. I also have way less extensions installed compared to the amount my emacs setup needed at the end.

Configuration synchronization and management

Keeping your editor config synced between multiple computers is another topic where VsCode by default is easier. Login with a github account and enable sync, now all your settings and keybindings will be synced as soon as you login to the same account on another computer.

Someone else is polishing my knob.

VsCode has a lot of paid dedicated developers working on it who’s main focus is keeping it stable and improving it’s performance and features. Emacs do also have a lot of developers keeping it updated and stable but it is entirely OSS driven a lot of the polishing is up to the user wich has it’s appeal for sure.

The last couple of years I dreaded whenever a new emacs version came out, as I knew upgrading would net me a whole slew of problems and things that just did not work as before. With VsCode i just update whenever a new one pops up and has so far never broken anything.

VsCode also have a lot of community extensions but almost every major language has a microsoft certified extension to do the bulk of the work and then the community extensions appends to that.

Follow the masses

StackOverflow's 2022 developer survey editor choice results.

As you can see from the image above VsCode is by far the most popular editor right now. That by nature also means it’s the editor that will get priority for new features and all the others will slowly copy or adapt to it.

Having a big and thriving community is also a big plus whenever you inevitably run into some sort of problem chances then are that someone else have already had that issue and found a solution.

By now emacs is so old that many of the results you’ll find on google is outdated. You have to be a little critical that the things you read is even relevant or best practice still.

Not being an expert

Emacs as many say are self explanatory and that is true if you know how to get it to explain itself. I’m decent at emacs and have made some custom modifications, but as I do not tinker with it every day I forgot how to do more custom things and have to spend some time learning how to do it again.

It might just be a memory issue for me, but the same problem occurs when writing elisp. I write is so rarely that I can barely remember the correct syntax whenever I get back to tinkering with my emacs setup. I would then spend a lot of time looking up functions, syntax etc. and accomplish what I’ve set out to do just to forget it all before I have the need to tinker with emacs again.

With VsCode the config files are in json and extensions are written in Javascript(Node.js). I am neither an expert in Javascript or Node.js, but the syntax is closer to languages I use daily and as a fullstack developer I do run into JS from time to time.

Disclaimers and things I miss

With emacs I ended up using spacemacs. It’s a config/package collection that aims to bring the best of both worlds with emacs and vim. So by nature my muscle memory is used to vim editing and emacs keybindings in insert mode. Luckily there is a vim extension in VsCode, and enabling that gives me vim editing in VsCode.

I do have some keybindings setup that I just can’t shake, mostly the ones I also use a lot in a shell like:

  • Ctrl-a: Move to the beggining of a line.
  • Ctrl-e: Move to the end of a line.
  • Ctrl-K: Delete line(s)

At the end of my emacs/spacemacs usage i heavily relied on vims normal mode to do my editing and as such it is a little limited what I miss from the emacs part of things. The most prominant thing is the REPL and lisp customization.

As an example in my emacs configuration I had 2 custom functions bound to Ctrl-a and Ctrl-e that made me jump between beginning of line and first beginning of first character when pressing Ctrl-a multiple times, same thing for Ctrl-e. Theese one of very custom things I am yet to find a way to do in VsCode without having to make an extension for it myself but i have not looked to much into that yet.

I do still use vim a lot when I have to ssh somewhere and configure a server as it often requires root or switching to other users to have the correct permissions to edit a given file.

Vi or vim are always there and being familiar with them is a very QoL thing to know imo. From time to time I even get the urge to test out neovim and all it plugins, but I simply do not have the time to get to a point where it can compete with VsCode.

Tesla, MacBook and VsCode. I even grew a beard during the lockdown that has remained all I need now is a Starbucks coffee to join the hipster squad. /s

Follow me

If for some reason you would want to see more of me I also generate web trash at theese locations. Should you wanna buy me a beer click the heart, as beer is love.