loading...

Vscode Vim VSCode vs Vim

ben profile image Ben Halpern ・1 min read

Your life as a developer depending on what you choose as an editor.

Let's compare and contrast your experience if you go down either of these paths. Feel free to branch the conversation on to other editors but I felt like this is the most relevant debate today.

Discussion

pic
Editor guide
Collapse
citizen428 profile image
Michael Kohl

My story goes like this: very much in love with Vim in the early 2000s. When I got into Clojure ~2009, I got into Emacs, and lived in it for the next couple of years (I pretty much used it as my OS, running a Twitter client and other things in it). But modal editing is just so much more efficient, so I eventually ended up with Spacemacs (and much later Doom Emacs). Around 2015 or 2016 I got into VSCode, but the sluggishness of Electron apps drives me crazy, so I went back to the roots and now use Vim again.

My current NeoVim setup looks roughly like this (NerdTree and TagBar are toggleable and I don't have them visible most of the time):

neovim screenshot

Collapse
katylava profile image
katy lavallee

i need to figure out how to set up tag bar. i love vim but i don’t have it set up well to be a great IDE.

Collapse
citizen428 profile image
Michael Kohl

Maybe you can get some inspiration from my NeoVim config:

github.com/citizen428/nvim-config

Thread Thread
katylava profile image
katy lavallee

it's actually setting up a ctags library that i've had trouble with. although looks like you are using something called universal-ctags instead of exuberant-ctags. i'll give that a try.

Thread Thread
citizen428 profile image
Michael Kohl

I see. Yeah, just brew install universal-ctags and Tagbar and things should just work™. It's their recommend version now:

Exuberant Ctags >= 5.5, or (highly recommended) any version of Universal Ctags which is a currently maintained fork of Exuberant Ctags with many bugfixes, support for many more formats, and proper Unicode support.

If you get stuck feel free to message me here, my DMs are open.

Collapse
srepollock profile image
Spencer Pollock

VSCode (VSC) and VIM are my two main editors.

I sit within VSC almost all day every day. Editing on multiple devices gets annoying when switching over (Windows/macOS), but there are some plugins to help with that effort (search extension shan.code-settings-sync). VSC is a very powerful editor. Once you have keybinding setup, a few environment configs, and runners, you're good to go. The extension list is ever-expanding, and with that, you're more likely to find a few that really work well for you, or even make your own. Outside of the extensions, Intellisense is my saving grace. I often forget what functions are already implemented (or even the documentation and the argument variables) but that's when VSC is there holding my hand. The majority of work is in VSC because it's pretty on the eyes, integrated terminal for Windows (because no global hotkeys for iTerm2 like macOS) and the ability to work on various instances - even in the browser (see GitHub's new Codespaces?).

VIM is however my go-to editor. If I need things quick done now I run vim not vscode in my terminal to kick things off. Any time I'm remoting into a machine, I run vim. Even when VIM is not there, I install it, copy my dotfiles from GitHub, and continue with my day. VIM is excellent, fast to use - especially when you start understanding the basics - and there is still so much more I don't know about it and have to learn; but there's help with that (duh StackOverflow too). I recommend learning some of the basics in navigation for developers of any kind. Again, back to remoting into other machines, having an editor already there for you taking just a single config file and you're on your way is an amazing tool to have some skills with as a developer. It opens lots of doors, and just like the comments made here (by @wayofthepie ) it's something that can take time doing, but once you get the basics, "[it's like playing an instrument...my fingers just know what to do.]"

Also, I know there are other terminal editors too, if one stands out then pick that one! Whatever makes you the most productive is the best for you and that's really all that matters. Stay safe 😄❤️

Collapse
citizen428 profile image
Michael Kohl

Intellisense is my saving grace

I'm not a big user of Intellisense, but I find Vim's offerings sufficient (I do use ctags quite a bit too):

vim intellisense

integrated terminal for Windows (because no global hotkeys for iTerm2 like macOS)

The terminal in Vim8/NeoVim is pretty good too, but I don't know if/how well it works on Windows.

Collapse
itsjzt profile image
Saurabh Sharma

You can use coc.nvim which brings intellisense of vs code to vim

Thread Thread
citizen428 profile image
Michael Kohl

I’m using deoplete.

Collapse
pianocomposer321 profile image
pianocomposer321

The terminal buffer in Vim8 and NeoVim is good, but one plugin that I came across recently makes it awesome. It's called neoterm. Here's a great video on neoterm (hosted by Drew Neil, author of the amazing "Vimcasts").

You can also check out this snippet from my Neovim config:
gist.github.com/pianocomposer321/f...

Collapse
bravemaster619 profile image
bravemaster619

VSCode for development in local, vim for editing env files in production server.

Collapse
wayofthepie profile image
Stephen O'Brien

They are both great. Used vscode mainly for about a year and really liked it. Didn't have to do much to get it working for most languages!

But I started getting some back, shoulder and wrist issues around that time. Not because of vscode, but because of how I sat and used my keyboard and mouse.

So I totally changed my whole workflow and setup. Moved to vim (well neovim) and switched to a tiling window manager so I could reduce mouse usage.

I spent a lot of time tweaking my vim setup to get what I wanted for the different languages and tooling I need to use. It's made me much more productive for sure. Not really faster overall - coding is mainly thinking 😄 - just more comfortable in translating those thoughts to code than I was with any other setup before.

It's become kind of like a musical instrument 🤔 I don't have to think much about performing a certain action, my fingers just know and do it.

Collapse
katylava profile image
katy lavallee

I switched to vim from TextMate over 10 years ago. I love modal editing. I also love modally controlling the whole editor (like opening files and showing/hiding different buffers). I have more trouble learning to hit several keys at once than learning to hit them in series. I do have a few key combos set up in vim that I keep forgetting so I should probably turn them into mappings.

That said I think VSCode is pretty awesome. What attracts me to it most is the powerful intellisense, since I haven’t figured out how to get more robust completion with vim plugins.

I’ve tried getting into VSCode, since I can at least edit text modally with it (although it feels slower), but there’s just too much to set up. Back in 2008 or 09, it took me two weeks of being fairly unproductive to get vim set up well for me. At the time there wasn’t much work to do because of the economy, but right now I have a lot of work to do (in spite of the economy).

Collapse
0xdonut profile image
Mr F.

Vim is amazingly powerful - but I can't be bothered to keep a map of key shortcuts in my brain.
VS Code - I might lose some time pointing and clicking, but it requires no extra mental arithmetic.

I can save that effort for creative problem solving. :)

I should add that I do have a level of envy for people who can do the former (including emacs users) - its impressive and I admire it. It's just one skill I've been unable to learn

Collapse
citizen428 profile image
Michael Kohl

Vim is amazingly powerful - but I can't be bothered to keep a map of key shortcuts in my brain.

I have no intention of convincing you, if you're happy with VSCode keep on using it!

But Vim commands are very logical and consistent, so there's not much remembering to do. For example:

  • foo_bar, with the cursor at the f: df_ will Delete until it Finds an _, leaving you with bar. If you change the d to a c you would Change unTil _, leaving you in insert mode before _bar.

  • variableName with the cursor on N: cw will Change the Word, leaving you with variable in insert mode, whereas ciw (change inner word) will replace the whole name and leave you in insert mode. daw on the other hand will Delete A Word including the whitespace that follows it and you'll still be in normal mode.

Once you learn basic commands, how to efficiently repeat them and the most common text objects you can already achieve a lot without having to remember too much.

Collapse
katylava profile image
katy lavallee

I always though of i as “inside” and a as “around”.

Thread Thread
citizen428 profile image
Michael Kohl

Those are great mnemonics 😊 I tend to use the terms from Vim's documentation (help text-objects), so people get used to the official terminology:

aw                "a word", select [count] words (see |word|).
                  Leading or trailing white space is included, but not
                  counted.
                  When used in Visual linewise mode "aw" switches to
                  Visual characterwise mode.

iw                "inner word", select [count] words (see |word|).
                  White space between words is counted too.
                  When used in Visual linewise mode "iw" switches to
                  Visual characterwise mode.
Thread Thread
katylava profile image
katy lavallee

hah, i never knew what it said in the help docs. i think i read a blog post once that gave me those mnemonics.

Thread Thread
moopet profile image
Ben Sinclair

Me too :P

Collapse
jay8142 profile image
Sir Broddock

Yes, absolutely. cw combined with search and period (repeat last command) is an incredibly efficient way to change over code to new naming. I use this all the time when copying over boiler plate code that has just a few name changes needed and it saves so many frustration inducing mouse moves!

Thread Thread
citizen428 profile image
Michael Kohl

Depending on how many things you have to replace an ex command may be a better choice, e.g. s/old/new/gc.

That said, I recently did a big refactor on the DEV code base that essentially consisted of a case insensitive search, followed by one of 3 recorded macros (df_ for variables, dtL for classes and df- for CSS classes) and copious amounts of .. The macros (@a, @s and @d in my case) made it easier to switch between the different transformations necessary. So it went something like / @a n . n . n @s n . n @a n . n . etc.

Collapse
shane profile image
shane

VSCode is fantastic for large projects. I need the Intellisense training wheels at all times otherwise I would get nothing done.

Vim is nice for editing one line edits from the terminal or writing out a text file. Can't see myself ever using it for development

Collapse
matthewbdaly profile image
Matthew Daly

Out of the box, Vim isn't an environment that's terribly good for development. It does take some work to get it into a state where it's a genuinely good development environment because that tends to be language-specific.

I mostly do PHP, with some Javascript too, and I have, among other plugins, vim-ale for linting in multiple languages, and Deoplete for autocompletion. I also use PHPActor, which not only integrates with Deoplete to provide reasonably smart PHP completion, but also provides numerous refactoring tools of the sort that used to be the sole providence of IDE's.

In short, it can be done, but it's a very personal choice as to whether you think it's worth it for your own workflow. In my case, I have a degree of RSI from a previous non-coding role and it gets aggravated by using the mouse, so my workflow is very keyboard-heavy, and Vim fits that like a glove. I did migrate to Neovim nearly two years ago, but the experience is virtually identical.

Collapse
vlasales profile image
Vlastimil Pospichal

In the Vim, the size of the project is not limited. He doesn't care if there are 20 files in the directory or 20,000, whether the file has 20 lines or 20 million.

Collapse
n8io profile image
Nate Clark

Both VSCode and Vim are great editors with cult-like followings. Both have a great community built around them. For me it comes down to a few things that might not be of any importance to others. This is only my opinion and you're all welcome to take or leave it. First and foremost, I am not a Vim user nor will I ever be. I'm a strong advocate of pairing and Vim is painful to follow while pairing. I can't say the same for VSCode. If pairing is part of your team's workflow, Vim is a no go. In my experience VSCode just works and it doesn't require your pair to mind map to be efficient. I'll take the "slowdowns" that come with Electron apps in favor of all the built-in efficiencies for source control, debugging, and remote development. While the Vim community is large, it's ancient. Being a full stack engineer, I prefer my editor to stay as up to date as the technologies I'm using everyday. That's my two cents.

Collapse
citizen428 profile image
Michael Kohl

I'm a strong advocate of pairing and Vim is painful to follow while pairing.

I've worked on many teams where people paired in Vim and/or Emacs, what problems did you encounter with that?

For remote pairing I do like VSCode a lot though, Live Share is very nice.

Collapse
n8io profile image
Nate Clark

Each Vim developer had a custom layout and file tree that made it hard to follow during pairing. Again this is just my experience, but I didn't find much consistency between Vim environments either. There's also the fact that I had no indicator of what was going on when the host would start tapping away at key bindings. I think we've all been there when a Vim developer mistypes a command several times just so they can do it the "Vim way". During these times I would tune out or get frustrated with the inefficiency. I've also had several Vim devs tell me that X plugin is not working so they have to do things a little weird, then run linting/formatting outside as a post process to their normal workflow. Not show stoppers by any means, but IMO unnecessary friction points.

Thread Thread
citizen428 profile image
Michael Kohl

Fair points, thanks for taking the time to respond :-)

I sometimes use VSCode when pairing with other people, partly because Live Share is really good, but also because it's a more "neutral" environment. It also has some really good language server implementations, e.g. for Reason/OCaml. The Ruby one on the other hand is IMHO quite horrible, "Format On Save" with Rubocop enabled is extremely slow.

This is why I bought a license for Onivim 2, it really could become the best of both worlds.

Collapse
krishnakakade profile image
krishna kakade

Vscode wins cup🤾‍♂️🏆🥇
all community support extension and from web development perspective it is beast
Collapse
bravemaster619 profile image
bravemaster619

It's camelCase, bro.

Collapse
krishnakakade profile image
krishna kakade

Yes I know but auto typing

Collapse
waynejwerner profile image
Wayne Werner

Linux is my IDE.

In all seriousness, it is. Most IDEs have a way of navigating to web pages, editing text, running commands, attaching debuggers...

You know what Linux lets me do?

Navigate to web pages, edit text, run command, and attach debuggers. And I can configure it exactly how I want it.

But what's even better? Parts of my IDE are available everywhere in the world - even Vim, my usual text editor. But I can also edit text with emacs or nano or ed(browse) or... whatever.

It's definitely worth learning a tool like VSCode, but if you want to avoid vendor lock-in, Linux is the way to go.

Collapse
waynejwerner profile image
Wayne Werner

Also, if you do use something like Visual Studio or VS Code, I highly recommend a macro that will launch a proper editor like vim. Yeah, you can edit code in VS, but I really only find it's useful for composing code. You can edit code much, much, faster in Vim when you're doing anything but the most trivial actions.

Collapse
moopet profile image
Ben Sinclair

I use this on my work Mac:

nnoremap <leader>vs :silent exec "!open vscodium://file/" . expand("%:p") . ":" . line(".") . ":" . col(".")<cr>:redraw!<cr>

That'll open VSCodium to the same line and column the cursor is on in Vim. I do that to make use of the former's debugger, which I find a lot easier to use than Vdebug.

I don't use VSCode on my personal machine, but if I did, I'd change open to gnome-open.

Collapse
moopet profile image
Ben Sinclair

I'm diehard Vim all the way. I think it has the best UX of any editor.

I don't think Vim is an IDE though, and I do think that VScode is a good IDE. In fact, it has one of the best Vim-mode extensions of any IDE I've tried, so it's pretty fun to use. It's not perfect, the Vim-ness isn't that customisable, and it loses out because it's not a console application which is something I value.

Collapse
citizen428 profile image
Michael Kohl

You should try out the NeoVim extension if you haven't yet, it's quite a bit better than the normal one.

Collapse
moopet profile image
Ben Sinclair

Looks interesting. I've always avoided neovim, but I think I might give this a shufty.

Collapse
nazeh profile image
Ar Nazeh

Is there a colemak fork you know of?

Thread Thread
citizen428 profile image
Michael Kohl

You shouldn’t need a fork as this will use your regular nvim config (or another config if you set that up in the preferences). So if that has Colemak friendly bindings they’ll carry over.

Thread Thread
nazeh profile image
Ar Nazeh

Thanks, I will try it this weekend as I am trying to be more efficient with typing and navigation as a new developer!

Collapse
jrop profile image
Jonathan Apodaca

With modern LSP plugins + fuzzy finders, I feel that I get the best combination with NeoVim, and I can edit code in Docker containers + Servers with IDE-like functionality. My dotfiles bootstrap NeoVim and install everything I need, so taking over a container to debug it is relatively painless :D

Collapse
ryansmith profile image
Ryan Smith

I think the key with any editor/tool is to learn it well to be more efficient. VSCode is easy to use so it doesn't necessarily force you to learn the hotkeys and get good with it. Vim has a learning curve in order to use it, so it is very much learning by doing and forcing you to get better with it. Customizing an editor like Vim may not be worth the investment in time saved typing, but it may be preferred or a fun hobby for some.

When I code, I am usually not furiously typing away, I'm thinking more about what I want to do and then entering it. I don't believe the editor or using the mouse is slowing me down, I would still want to take my time. Learning the default hotkeys and features is enough for me, so I prefer VSCode.

Not specifically VSCode/Vim, but I'm also a big mouse user (probably due to my PC gaming background), but there is more and more "mouse shaming" that I see going on in the developer community. It has equal priority to the keyboard for me. Sometimes there just isn't a good keyboard shortcut to get to something on the screen which is frustrating and inefficient for me. Tabbing through a webpage is kind of like iterating through all items in an array (O(n)), but clicking on the exact link is like accessing a specific array index (O(1)). At least that is how I think of it. 🤷‍♂️

Collapse
ahferroin7 profile image
Austin S. Hemmelgarn

One big thing which seems to be forgotten by a lot of people on both sides: vim is tiny by modern standards for how many features it provides. VSCode quite simply cannot compete here because it uses Electron and has all the baggage that comes with that.

Collapse
simonhaisz profile image
simonhaisz

If that matters to you, sure. These days the smallest amount of RAM I have to work with is 16GB and I know I'm not the only one. From an absolute standpoint VIM uses a lot less resources but from a % standpoint they are both so low that their impact is effectively equivalent so I can compare them directly on ease-of-use, functionality, etc.

Collapse
krio profile image
Kevin Rio

I get a ton more battery life on vim than I do on vscode and the JetBrains ides. Even when I load up vim with a ton of plugins. Sublime is also better than vscode, so thats a consideration if you like to work and not carry a brick with you. I do agree that for the most part the majority of us with modern computers the ram/cpu is a wash.

Thread Thread
simonhaisz profile image
simonhaisz

That is a much stronger point. To me this factor is still a wash because a) 95% of my development is done on a power cord and b) even if I'm out-and-about on my laptop what kills my battery is other intensive programs (aka FireFox) or running the program I'm working on rather than the editor itself. But I totally get that there are people who need to get more than a few hours out of their laptop at a time and will adjust their tools accordingly.

Collapse
jacoby profile image
Dave Jacoby

I've gone hog-wild for VS Code, but I've used vi(m) since the 1990s and it's still in my fingers.

The primary reason I would use vi over code these days is when I'm editing code on a remote host I haven't mounted, which I sometimes do from my mobile devices, although as a Perl guy, perltidy uses perl, which I don't have installed in Windows, so, when I want formatted code (and I'm not using Remote-WSL), I use vi in WSL to tidy it.

Collapse
thetinygoat profile image
Sachin Saini 🦄

I have been irritated by the sluggishness of electron apps for a while, and while vscode is the best electron app there is, it's still electron. I finally made the switch to vim and I love it. It will take while to get used to the key bindings but I'm willing to put in the work. And man configuring vim is so much fun!

Collapse
ferricoxide profile image
Thomas H Jones II

Always been a touch-typist and started using text editors before VIM existed (those old Suns, NeXTs, etc., if they offered you a choice at all, only really had ed/vi and EMACS). Too many decades of finger-memory (and bounce too frequently across new systems) to think about stuff that isn't "just there". These days, that's VIM.

Collapse
jay8142 profile image
Sir Broddock

I love vim on xfce. I have a workspace for every function key, 12 in all. Then, I use window snapping and when I am working locally i typically fill out all the 4 corners. Whew, that's a lot of windows but it really helps my workflow especially when each of them is tagged for certain purposes. I try to keep 1 set of function keys tied to a single project. Then on f1 I will have db windows, command line stdout app running, etc. Utility screens. f2 is reserved for website previews and debugging on the server. f3 is backend files and f4 is front end files. Bigger projects I'll go into a second set of functions and then the purpose gets more muddy.

Ultimately this has been fantastic and it is so speedy. All these are opened on a virtual machine and if it ever runs out of memory it isn't because of vim! Amazing!

Collapse
gayanhewa profile image
Gayan Hewa

Both are really good. I have ventured across all three lands including emacs, vim and vscode. The amount of time we can kill optimizing the configuration with vim and emacs is just 🤯 (both in a good and bad sense at the same time). Now while I get older, I realized that I don't have the time to tweak stuff until wee hours in the night. Having to manage time between work, family and my self. So these days , what ever gets me productive soon is my tool of choice. I might use vim to edit files and have a basic configuration that work out of the box. VSCode for majority of the other work purely because I work across PHP, Typescript, JavaScript, Ruby, Go and with Terraform. It just saves the time I have to configure the editor.

So this is just my circumstances and how I opt to use the little time I have available. It was a completely different ball game a decade ago for me.

Collapse
katylava profile image
katy lavallee

I didn’t find VSCode to be that great without a similar amouint of configuration.

Collapse
gayanhewa profile image
Gayan Hewa

Possible. But most of the extensions work pretty fine out of the box.

Collapse
talk2megooseman profile image
Erik Guzman

I love VIM and saved my computers but when IDEs would chew up resources. But, I also love VSCode for the number of extensions, features, and constant improvements.
But in the end... Why not both? I used VSCode with the VIM extension so I can have keyboard shortcuts to fly around my code with the need for a mouse.
I do admit I don't use VIM to its full potential but I feel like it's not an all or nothing thing.

Collapse
aligoren profile image
Ali GOREN

I prefer to use Vim. It is really lightweight for my old computer.

https://dev-to-uploads.s3.amazonaws.com/i/dbvayc6c2joi74llq4mu.jpeg

Collapse
janpauldahlke profile image
jan paul

:wq!

Collapse
bravemaster619 profile image
bravemaster619

Yet more powerful is :w !sudo tee %.

Collapse
janpauldahlke profile image
jan paul

glad to learn a new line, ty bro ;-)

Collapse
fultonbrowne profile image
Fulton Browne

I recently switched from heavy IDEs and vscode to vim an I have found that can do everything inellij or vscode can do if the correct extensions. if your willing to put in the time to learn the key bindings and install the extension I think vim is by far the better choice. :]

Collapse
iamsivav profile image
Sivaraj Velayutham

I am all in for VSCode. I was a Jerbrains guy and started using vscode since 2018 and loving it. I am a Polyglot, and VSCode works and supports all programming languages I use. Nowadays, I use IntelliJ ( only Java ) and VSCode ( rest ).

Collapse
jrop profile image
Collapse
jakesweb profile image
Jacob Colborn

I never used VIM as a full-blown editor. Back when I started using Linux I would use it to modify config and text files or write shell scripts. Back in those days, I was only learning programming at a very basic level (I was young). I would use the Python IDE when I first started learning because I used Python. When I tried to learn C++ I was able to use Code::Blocks, which was relatively new at the time. I abandoned programming after that.

By the time I started development again, it was already 2016. I started with learning game development using Unity. This came bundled with MonoDevelop which I enjoyed using for a month or two before an online tutorial used Visual Studio and I switched. When I took up web development a few years after that, I just naturally fell into VSCode. I'm so used to all of the shortcuts and the commands that come wrapped in VSCode and that I have created. The idea of switching to anything else is almost exhausting.

Collapse
mattjbones profile image
Matt 🦕

It doesn’t have to be an either or. I’m quite happy using the vim plugins that are available in most IDEs, VSCode has a great vim plugin which does a good job of supporting the broad set of features I use (I guess I’m not a power user of vim).

I would be curious to see the difference in productivity between vim / emacs and plain IDE (with intelisense etc) at what point does vim make a difference?

Collapse
brightone profile image
Oleksii Filonenko

I started using Vim 6 years ago, and spent 2 quality years with it. I had a heavily modded config with tons of plugins for everything. At some point, I wanted to do my own customisations, and VimScript didn't strike me as an amazing language (at least back in the day).

Then I went from Spacemacs to Doom Emacs, and I'm currently switching between Doom Emacs on Linux and VS Code on Windows.

Emacs gave me the degree of freedom I wanted from my editor, and for some of the plugins (like Magit <3), I can't find a replacement anywhere.

For me, VS Code wins in terms of LSP support (rust-analyzer works amazingly well with it) and how easy it is to get going with on a new machine (yay Preferences Sync!), but there's still a lot to be desired.

And of course, Vim bindings everywhere, that's out of the question.

Collapse
herawais profile image
Muhammad Awais

vs code with vim extension <3

Collapse
sirseanofloxley profile image
Sean Allin Newell

VSCode has the best 'install and go' DX I've ever experienced. Even better than sublime, n++ - it just installs, starts, and goes really quickly with intellisense for TS/JS out of the box, and installing extensions is suggested and can be done without even reloading the editor.