DEV Community

lucasprag
lucasprag

Posted on • Updated on

VSCode vs VIM My editor journey: sublime, vim, emacs, vscode

I will talk about my experience using each of those text editors, maybe it could be useful for someone evaluating text editors to invest time learning.

sublime text

I started learning about programming when I was in high school, it was so much fun to write some code and see the results on the browser. I used sublime text because I was learning with blog posts and videos and most of the content mentioned sublime text. Also, it was fast and I had a few plugins installed to handle php, html, javascript and css. I used it for a few years at work too until the day I joined a company that had vim and emacs users.

vim

The vim users worked on projects more closed to my own project so I started to check how they did things and then I started learning about vim. It was not cool, it was too hard to learn how to use it, to load new config files I had to restart vim every time and so much other problems, but since they did, I convinced myself that I could learn it too so I did.

I used vim for a few months and what I like about vim the most is that it's optimized for editing files not creating new ones. For the most of the time, we're editing files and moving between lines of code so that makes sense. Finally I was happy and productive using vim.

neovim

One day I heard about neovim, not sure exactly why I switched to it, but take a look on the github project for both projects:

vim project with only one contributor

vim project with 392 contributors

Wait what? Only one contributor on the vim repository? How only one person could have done that? Checking the pull request list I saw that the author applies changes from other people as it was his changes. Ok, I didn't liked that, so I changed to neovim which gives credit for people when they contribute.

UPDATE: I agree that my survey is too shallow. My see this comment. But I still don't like that.

nvim + tmux

At that time people was talking about tmux which is a terminal multiplexer so you could split your terminal and have tabs and customize everything from shortcuts to how tmux looks like for example adding useful info to your status bar. I tried and I liked. Since I was using nvim in the terminal it worked very well and I even found some plugins to integrate them smoothly. Here is how it looks like:

using tmux and vim having different tabs and splits and running test in a split bellow

I don't use nvim anymore, but you can still find my configuration for vim and tmux.

I used this stack for 3 years and I was happy.

Then I see myself managing configs and plugins for nvim, tmux, zsh to run well on terminator on my Debian at work and iTerm on macOS at home. Not everything worked well between plugins too, for example I had auto completation on nvim and it works well unless I'm using multiple cursors which is a feature from another plugin, the auto completation would work only for the first cursor because they didn't integrated with each other. I got other frustrating problems like that one and I see myself spending too much time debugging or trying alternative plugins, so I was tented to try something different and this is where emacs came to my attention.

emacs

Emacs has a GUI app which makes me don't need terminator or iTerm anymore and it has his own shell written in elist called eshell, so I'd have one config and plugins for everything. I tried to start from scratch writing down every config as I did with vim, but it was too much to learn and I had to get some work done so I tried spacemacs and with some help I could be productive in no time.

Spacemacs has vim key bindings so I was at home, I just needed to learn to handle different aspects of spacemacs like layouts and workspaces. It was easier to do things because it has a real-time display of available key bindings, so while you type you can see your options, also it is mnemonic so if you want layouts you'd use SPC + l, if want to toggle something you'd use SPC + t, if you want buffers you'd use SPC + b, for projects SPC + p, for files SPC + f and to save a file you'd combine commands like SPC + fs which means spacemacs -> file -> save and SPC + pt to see the project tree of files. Very straightforward right?

It took me like a month to understand everything and to work well. I was not happy with everything, I got some bugs which is ok, I reported and I tried to fix them but I had to learn one more language (elisp) to be able to do that. It was a great experience because I was learning a lot of elisp which is a great language in my opinion so I was having fun, which made me use spacemacs for 6 months.

Then I saw this video:

Wait what? 10 years of love for Emacs undone by a week of VSCode? I have some friends who are happy with vscode too, they strongly recommend it. Ok, let's give it a try.

vscode

I had to do some coding in a weekend so I switched to vscode and overall the experience was great, but I had to use the mouse a lot initially.

I installed the vim key bindings which for my surprise also has support for common vim plugins like vim-easymotion, vim-surround, vim-commentary and others that I've never heard of.

Killer features for me that I found in vscode:

  • cmd + p to open files using fuzzy search is faster and more intelligent (it puts recent files on top)
  • shortcuts are more similar with browser shortcuts which makes my life easier as web developer
  • config files are JSON files and there is no need for too much customization (my config file has 22 lines and that's all)
  • the integrated multiple terminal works really well and it has splits like tmux
  • vscode is maintened by Microsoft which I think it's great to have a team working on it and adding features that integrate well with each other
  • I don't need to debug vscode and I didn't find any bug so far
  • I don't need to install too much plugins
  • jump to definition for React

Vscode plugins I have installed:

using vscode to switch to files, bookmark files and jump to bookmarks, and use the integrated terminal

That's my experience with text editors. Today I don't have to debug my editor to make simple things happen and I still can customize it for my needs. Yeah, I'm pretty happy with vscode and maybe you should try it too. I hope it was useful for someone.

Also I'm looking forward to hear your opinion and experience about those text editors. Thanks.

Top comments (57)

Collapse
 
evantypanski profile image
Evan Typanski

I can definitely say that vim or emacs or any other text editor like that is not for everyone. I've been pretty well into vim almost since I started coding and love it. What I think might set that apart is how barebones I try to make vim; my vimrc is almost all quality of life simple configuration, no cool plugins or trying to make vim more than what it should be. I just stick to the basics.

Now, my mindset is sorta stupid in most cases. I often put vim before all else, sticking to it even if it doesn't fit the job well. The reason is I think it's making me a better developer. I don't have code completion, I have nothing telling me that my syntax is wrong. It's up to me to fix it. That sorta goes into what you're saying about vim being great for editing files: it's so good to make one extra block because you don't have to keep track of 50 curly braces. The second you do, vim becomes a hindrance.

So, yeah, vim or emacs can be trumped by a fully featured IDE any day. But, that can also be half the fun, at least for me.

Collapse
 
lucasprag profile image
lucasprag • Edited

Thanks for your comment. Yeah, I see your point, it's fun to hack emacs or vim and do stuff. It's so simple, we don't really need anything else. But some plugins like easymontion can help us to do a better job when moving between lines of code, maybe you should give it a try.

Hey I see you have a configuration for something called.wtf. It looks like a todo list integrated with your terminal or tmux maybe, I'd like to know what it is please.

Collapse
 
jasonm23 profile image
Jason Milkins

It's for wtfutil wtfutil.com

Thread Thread
 
lucasprag profile image
lucasprag

Thank you

Collapse
 
evantypanski profile image
Evan Typanski

Yeah! wtf is a terminal-based dashboard utility. It has modules that you can place in boxes in the terminal, ones I use most are the todo list and git integration (both tracking a local repo and tracking pull requests on other repos). Its configuration is just a grid, so you just say what rows and columns something will take up, how much space to give each row and column, and there you go.

For a todo list it's a bit eh, there's no priority or date markings you can integrate with, but it's good for just a list of stuff. You can reorder it though.

You can integrate it with lots of different things as well like Google calendar and weather, basically I wanted something to put next to my web browser in a workspace and it fit that role perfectly for me.

And as a note, I found out about it from hacker news

Thread Thread
 
lucasprag profile image
lucasprag

Awesome, I'll definitely try it out. Thanks

Collapse
 
heast profile image
h_east

Your survey is too shallow.

Vim does not depend on GitHub.

See document.
github.com/vim/vim/blob/master/CON...

Patches are welcome in whatever form. Discussions about patches happen on the vim-dev maillist. If you create a pull request on GitHub it will be forwarded to the vim-dev maillist. You can also send your patch there directly. An attachment with a unified diff format is preferred. Information about the maillist can be found on the Vim website.

You can confirm the contributor with the following command etc.
:h patches-8
:h patches-8.1

Collapse
 
lucasprag profile image
lucasprag

hey thanks for your comment. I see, that process is not that common.
I'm not saying that it's wrong, I'm only saying that I didn't like it and I don't feel that it gives proper credit for people's contributions.

Collapse
 
lucasprag profile image
lucasprag

yeah, thinking about it twice, I agree, I was too shallow.

Collapse
 
sleepful profile image
Jose Vargas • Edited

I use Doom emacs, let me address each of these:

cmd + p to open files using fuzzy search is faster and more intelligent (it puts recent files on top)

SPC SPC fuzzy search all project files
SPC , fuzzy search all open files
SPC > fuzzy search all open buffers (like a vscode tab)

shortcuts are more similar with browser shortcuts which makes my life easier as web developer

  1. you customize your emacs keybindings to whatever you want, you can't have leader keys in vscode
  2. vim plugin in vscode is so far from complete, evil for emacs on the other hand though

config files are JSON files and there is no need for too much customization (my config file has 22 lines and that's all)

Good for plug-and-play kind of experience, not so good when you want to get creative. TBF it took me longer than a week to figure out a good configuration for TypeScript/JSX on emacs.

the integrated multiple terminal works really well and it has splits like tmux

it does

vscode is maintened by Microsoft which I think it's great to have a team working on it and adding features that integrate well with each other

or rather, you are vendor-locking yourself, and you have poor ability to edit/fix your own editor. You haven't seen issues, but "Find all references" never worked for me, ctrl + click broke often on large projects, etc. Also, telemetry

I don't need to debug vscode and I didn't find any bug so far

It's not so much that you do not need to debug vscode, as it is that you are unable to do so.

I don't need to install too much plugins

This is one of the vscode strengths, you can be productive with minimal effort. But with time you might want to change things... I had about 26 plugins installed, probably used only half of them, and a lot were almost good enough but I couldn't configure them how I wanted. On the other hand Emacs packages are very configurable.

jump to definition for React

Install either LSP or Tide for emacs and you get the same functionality and more. Tide's "Find all references" and "Rename symbol" have worked tons better for me than they did in vscode.

Just to give you an idea of the fun things you can do in emacs, if I press SPC g p while in normal mode my emacs will create a git commit automatically with all modified files, pull from repo any changes, and then push my commit. Few keystrokes to keep my notes in sync with remote. :)

Collapse
 
jeremyf profile image
Jeremy Friesen

I went the TextMate -> Sublime -> Atom -> Vim (for about 2 weeks) -> VSCode (for about a week) -> Emacs.

Why? First, Emacs is radically open source. Second, I use my text editor for more than coding. Lots of note taking and blogging. When I get "better" at using my writing tool, I get better at using my coding tool, and when I want to make my tool better I end up practicing my coding skills.

And last, keyboard macros are an absolutely fantastic utility.

Collapse
 
dmfay profile image
Dian Fay

This won't be changing your mind at all but you can in fact hot-reload config changes in vim with :so $MYVIMRC, or even configure your vimrc to auto-reload by adding an autocommand group:

augroup myvimrc
  au!
  au BufWritePost .vimrc,vimrc so $MYVIMRC
augroup END
Collapse
 
lucasprag profile image
lucasprag

btw, I ended up doing like this:

" reload vim configuration (aka vimrc)
" :e reloads buffer to trigger the FileType event, useful if you don't want to put files into ftplugin
command! ReloadVimConfig so $MYVIMRC
  \| execute 'e'
  \| echo 'config reloaded!'

github.com/lucasprag/vimlociraptor...

Thanks

Collapse
 
lucasprag profile image
lucasprag

Awesome! I knew is was possible but not that it is that easy. Thanks
As I see, when I write a .vimrc or vimrc buffer it will also run the command to load my vimrc. Nice.

Collapse
 
dmfay profile image
Dian Fay

Right -- I have ~/.vimrc symlinked from ~/.dotfiles/vimrc so the buffer could have either name, if you don't have that setup you can obviously adjust the name detection as needed.

Collapse
 
sublimevidas profile image
Sublime Vidas • Edited

I may have to try out vscode once more. I used vscode quite a few times before and I didn't quite like it in the past. For one, I didn't get the key binding to work like vim or sublime so it was a pain to navigate in vscode. For two, which is a bigger reason than one, I find atom/vscode to be slower in performance than sublime. When I launch sublime, bam! I can start typing and get my ideas into reality right away. With vscode, I had to wait and wait.. And by the time, the editor is ready, I already half way lose the thought on what I wanted to write. Of course, that can be solved by having vscode open and running in the background 24/7

Edit: I just gave vscode another shot, and boy, it is certainly a huge improvement from v1.0. The keybinding support works flawlessly on 1.25.1, and it has become much more intuitive to install extensions/plug-ins. The launch time is still slower than sublime 2 and 3, but it is definitely much faster than what I experienced with v1.0 and pre 1.0 releases. Kudos to Microsoft. If they can make vscode launch faster than sublime, I would have no excuse to switch over. But at this time, I am half way sold.

Collapse
 
lucasprag profile image
lucasprag

Yeah, I agree with you, sublime is incredibly fast, even when opening large files.

Collapse
 
tux0r profile image
tux0r

I am gradually moving on from Emacs to Acme. I noticed that I spend way too much time configuring my IDE and way to little time being productive with it. Sometimes it helps to get back to the basics.

VS Code faces a similar problem IMO: too many options with which one could experiment for weeks, basically wasting time. Let's see how far I get with Acme (or, for UX reasons, acme2k... there is some comfort to be had, at least).

Collapse
 
lucasprag profile image
lucasprag

wow, I've never heard of Acme. Do you use it to code in a day-to-day basis?

Collapse
 
tux0r profile image
tux0r

Somewhat. (But I still resort to Emacs for most things, especially on Windows.)

Thread Thread
 
lucasprag profile image
lucasprag

Nice

Collapse
 
elabftw profile image
eLabFTW

Pretty surprised to see this thing with the vim repo where contributors don't get to be author in the repo. Anyone knows why is that?

Collapse
 
ninjaaron profile image
Aaron Christianson • Edited

It's because vim has been around looooong before GitHub, and was only moved to GitHub (relatively) recently. Bram is old-school and probably just uses the project management strategies he always has. Most vim development takes place on the mailing list anyway. I'm not saying it's great how he does it, but it's not super realistic to expect a project that's been around since 1991 to fit the normal GitHub workflows.

There are other good reasons to use neovim, but this one is anachronistic, in my opinion.

Collapse
 
tux0r profile image
tux0r

Why would you want to adapt your workflow to fit one certain VCS when your project is basically driven by you as the BDFL?

Collapse
 
lucasprag profile image
lucasprag

Now I see, yeah, I agree with you.

Collapse
 
lucasprag profile image
lucasprag

yeah, I don't know that either and I can't find an answer by searching on Google. =/

Collapse
 
katylava profile image
katy lavallee

I really want to switch from vim (well, neovim) to VSCode because I feel like the IDE features are just better and require less configuration and hassle. However, I want the whole app to respond to vim-like key bindings. I don't want to have to Cmd+anything, and certainly not Cmd+Opt+Shift anything. I wish the whole damn thing was modal.

Collapse
 
lucasprag profile image
lucasprag

yeah, I agree with you. it would be a lot better if the whole vscode could respond to vim-like key bindings, but it's good enough for me right now. I'm really focused on creating and publishing projects and vscode has helping me with that goal.

Collapse
 
katylava profile image
katy lavallee

totally fair. i'm adaptable in most things but i have a lot of trouble hitting the right keys when i have to hit multiple at once, unless it's Ctrl+, for some reason.

Thread Thread
 
lxndrcx profile image
Alexander Cox

Note that Oni2 should be able to do this kind of thing when finished

Collapse
 
gisu profile image
sascha fuchs

I find VS code quite nice but it's like Sublime, an editor I can enhance with plugins. I was a fan of Sublime until I started making an IDE out of it. You can get close but not quite. The whole plugin skeleton is like a house of cards, which prefers to collapse on Mondays :D
For me the best thing about VS code is the VIM mode (better than in Sublime), but I'm not really a fan. Too often the VSCode happens at 100 - 300% CPU load and the editor slows down the whole system.

So I'll stay with PHPStorm and Vim. Storm for the big stories and Vim for the stories where I don't need special IDE features.

I haven't really gotten to Emacs yet, if I ever did it.

Collapse
 
lucasprag profile image
lucasprag

I see your points. Do you get 100 - 300% CPU load when using vscode? I'm keep an eye on mine to see if I'm getting that too. Thanks

Collapse
 
gisu profile image
sascha fuchs

Yes, this is one of the problems that always spoils my fun with VSCode. 2 or 3 VSCode helpers each causing 100% CPU load on its own. I think it will depend on a plugin, but that's just the same problem that has already bothered Sublime, which is why I prefer to use PHP Storm (most of it is a core plugin)

Thread Thread
 
lucasprag profile image
lucasprag

Just because you said, I got vscode using too much memory/cpu and getting really slow.
I guess I wasn't slow before because I wasn't using that many programs in the same time.
I switched back to my tmux+vim setup just to compare and even my batery takes less time to dry out.

Not sure if I will continue with vscode after this =/

Collapse
 
mnaderian profile image
Mahdi Naderian

I liked VS Code at first but when I saw that a text editor like that takes too much of my system resources I decided to give something else a try, and guess what, now I love Vim and I don't wanna use anything other than this lovely beast.

Collapse
 
wagyourtail profile image
wagyourtail

What about Atom?

Collapse
 
migueldeleon profile image
Miguel De León

Atom isn't good as VSCode.

Collapse
 
tux0r profile image
tux0r

They are both bloated because of Electron IMO.

Thread Thread
 
lucasprag profile image
lucasprag

yeah, both are made using Electron, but vscode handles it a lot better as I heard. Never tried it tough, I give it a try in the next weekend. thanks you all

Thread Thread
 
tux0r profile image
tux0r

I actually tried VS Code on a six-core Intel and it still takes a few seconds to start.

Collapse
 
lucasprag profile image
lucasprag

I've never tried Atom, not sure why. Do you really like it? What do you think is best and worse on Atom?

Collapse
 
a__m profile image
antonio miranda

but I had to use the mouse a lot initially

How do you manage this now? Can you have a full session without mouse, say create a new branch, work on a feature, commit new code and PR? All that without a mouse?

Collapse
 
rubberduck profile image
Christopher McClellan

If you’re heavily using the multi-terminal feature of VSCode, I have some essential keybindings for you.

Switch between terms:

gist.github.com/rubberduck203/5777...

Collapse
 
lucasprag profile image
lucasprag

Thanks =D

Collapse
 
rubberduck profile image
Christopher McClellan

You’re welcome!
I get downright frustrated when I jump onto a pair station that doesn’t have these.

Collapse
 
adityavarma1234 profile image
Aditya Varma • Edited

I have read vim resources like practical vim and mastering vim books. They helped me a lot when i was switching from sublime to vim. You can have a look at them when you are free.

I am just curious to know have you read the above mentioned resources? I am using mvim right now and after reading your post it seems I am missing out on a lot of things by not giving vscode a try.

Collapse
 
lucasprag profile image
lucasprag

Thanks for your comment. I didn't read those books, but I was used to read a lot of blog posts, other people's config files and see talks from youtube (thoughtbot mostly).

I'm reading about mastering vim and it looks very interesting, I will take a deeper look on that later, thank you for you recommendation.

Collapse
 
antonrich profile image
Anton

Man, thanks for sharing the video. Thanks for the cunningham's law.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.