loading...

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

lucasprag profile image Lucas Arantes Updated on ・6 min read

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.

Posted on Aug 4 '18 by:

Discussion

markdown guide
 

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

 

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.

 

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

 

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.

 

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.

 
 

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

Awesome, I'll definitely try it out. Thanks

 

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
 

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

 

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.

 

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.

 

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).

 

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

 

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

 

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.

 

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

 

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.

 

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

 

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)

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 =/

 

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?

 

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.

 

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

 

Now I see, yeah, I agree with you.

 

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

 

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.

 

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.

 

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.

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

 
 
 

They are both bloated because of Electron IMO.

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

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

 

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

 

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?

 

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.

 

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.

 

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...

 
 

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

 

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

 

Atom is vscode but is true to itself. vscode is the Wii to atom's Xbox/PlayStation. Use vim and react plugin with atom and it already has git integration!

 

Thanks for you comment. vscode has git integration too, but I don't use it. I prefer to use the command line for git. Are you a heavy user of the git integration for atom?

 

I use it sometimes, but really just as a visual tool to see changes across multiple files for a big project. The project's pane also uses color coding to show what files are new, have changes or are current with your git repo.

GitHub integration is also a perk.

One last thing is the easily custom themeing. I only had to know css and follow some instructions to make and publish a theme. It's built to be modular and themes and plugins can be added through settings directly from apm with a very accurate search.

Honestly, everything I've used is by far inferior and Atom is a picture for the future of IDEs

 

Why do you have to debug your editor to make simple things happen?

 

Because most of the plugins don't integrate with each other, like multiple cursors and simple code completation based on context, I updated my macOS and I started seeing errors so I had to fix that, make true colors work on both ubuntu/debian and macOS.

It's fun when we are programming our editor to do stuff for us like snippets or automate some task with macros or something, but not when we have to debug the editor and plugins to have basic stuff like colors for syntax.

 

Jetbrains IDEs. They do pretty much everything you want, out of the box, with a consistent experience across languages, which is important in a polyglot world.

 

Have you tried PyCharm by any chance?

 

hey thanks for your comment. I've tried RubyMine which is similar and also created by jetbrains, but I'm not a fan of IDEs, I like text editors because with a few plugins I can have good enough features alongside with 2 second or less of load time.