Visual Studio Vim Plugin



  • I tend to prefer an IDE with a vim plugin to just Vim itself. Regular Vim loses a lot of the IDE's extra features (language-aware autocomplete, etc). Netbeans + jVi plugin is so much better than just Netbeans or just Vim. Though regular Vim works great for languages w/o any good IDE. – Herms Apr 6 '09 at 18:43.
  • Vimrc/vim plugins/etc are supported (few plugins don't make sense with vscode, such as nerdtree) Requirements. Neovim 0.5.0-nightly or greater. Visual modes are not producing real vscode selections (few versions had this feature previously, but it was implemented through ugly &.

Open current file in vim. To activate this extension, open the Command Palette (Ctrl+Shift+P on linux or ⇧⌘P on mac) and search for 'Open in Vim'. Alternatively, you can assign a keyboard shortcut of your choosing. Support for Windows is currently experimental. Vim-prettier is a Prettier-specific Vim plugin. Neoformat, ALE, and coc-prettier are multi-language Vim linter/formatter plugins that support Prettier. For more details see the Vim setup guide. Sublime Text support is available through Package Control and the JsPrettier plug-in. JetBrains WebStorm, PHPStorm, PyCharm.

To get the most out of Prettier, it’s recommended to run it from your editor.

If your editor does not support Prettier, you can instead run Prettier with a file watcher.

Note! It’s important to install Prettier locally in every project, so each project gets the correct Prettier version.

Visual Studio Code

prettier-vscode can be installed using the extension sidebar – it’s called “Prettier - Code formatter.” Check its repository for configuration and shortcuts.

If you’d like to toggle the formatter on and off, install vscode-status-bar-format-toggle.

Emacs

Check out the prettier-emacs repo, or prettier.el. The package Apheleia supports multiple code formatters, including Prettier.

Vim

vim-prettier is a Prettier-specific Vim plugin. Neoformat, ALE, and coc-prettier are multi-language Vim linter/formatter plugins that support Prettier.

For more details see the Vim setup guide.

Sublime Text

Sublime Text support is available through Package Control and the JsPrettier plug-in.

JetBrains WebStorm, PHPStorm, PyCharm...

See the WebStorm setup guide.

Visual Studio

Install the JavaScript Prettier extension.

Atom

Atom users can install the prettier-atom package, or one of the more minimalistic mprettier andminiprettier packages.

Espresso

Espresso users can install the espresso-prettier plugin.

I started using Vim as my main editor around six months ago and I can say it hasbeen a worthwhile experience because it has pushed me to think in a moreefficient way when it comes to editing text.

Visual Studio Vim Plugin Downloads

This article explains my rationale for switching to Vim so, hopefully, it helpsyou make a decision on whether investing in learning Vim is justifiable for youtoo.

My history with text editors

I have tried a number of text editors since I first learnt to code just overthree years ago and I’ve had good experiences with each one for the most part.

I want to write a bit about those experiences so you can see where I’m comingfrom and understand how I came to using Vim eventually.

Sublime Text

The first editor I used was Sublime Text 3. Ichose it because it seemed to be really popular at the time amongst webdevelopers and most tutorials recommended it as a beginner friendly option.

Vim In Visual Studio

At this point, I was only just learning to code so I only made use of its mostbasic features, although I did learn how to install plugins for addedfunctionality. Emmet was one of my favourites as it helpedme write HTML faster and that was just awesome.

I used Sublime for well over a year and even completed the Front-End certificateon freeCodeCamp doing all my projects within it. To be honest, I didn’t have anyreal problems with Sublime save for the popup that shows up every now and thenencouraging me to purchase the full version of the product.

To be sure, the free version is unrestricted in its feature set, but you justhave to deal with that popup and it can be annoying sometimes. As I didn’t have80 dollars to spend on a text editor, I began to look for alternatives.

First stint with Vim

Around this period, I decided to give Vim a go for the first time since it was always part of the conversation when you look at text editors for programmers and was favoured by many.

Vim was definitely more difficult to start with and although I was able to learn the basics, I just didn’t see why everything had to be so complicated.

I wasn’t productive at all so I gave up on Vim after messing with it for a while and decided to take a look at Atom instead which was closer to Sublime in terms of interface and workflow.

Atom

Switching from Sublime to Atom wasn’t difficult because Atom is largely inspiredby Sublime so they had a lot in common which made it really easy for me to startusing it.

All the plugins I used or an equivalent were available on Atom so I was prettymuch good to go from the start. As a result, I was able to get my work donewithout much fuss.

Vscode best vim extension

However, being built on Electron, Atom was having a huge impact on my RAM andCPU. As I had only 4GB of RAM at the time, this was significant to me andnecessitated an upgrade in that department which I effected by installing anadditional 4GB on my computer.

With Atom, performance was not as good as Sublime from the start. I was notsurprised by this since basically all other Electron apps I had tried had moreor less the same issues. Startup time on my PC was slow, but once it loaded up,it wasn’t too bad.

Overtime, I became frustrated at the lack of improvement in this area despitereceiving regular updates. So I sought a change all over again.

Visual Studio Code

Around this time, Visual Studio Code wasgenerating a lot of discussion in programming forums and had a lot of good presson various blogs. Since it was also built on Electron, I wasn’t expecting toomuch difference from Atom in terms of performance, but I gave it a whirl anyway.

I wasn’t too impressed at first; it didn’t seem to offer anything that I wasn’talready getting from Atom and performance wasn’t significantly better. So Iuninstalled it and stuck with Atom.

Visual Studio Vim Plugins

However, with each monthly release, there would be some hype, and I woulddownload it again and try it out. It always seemed to get better while Atom, incontrast, was stuck in a rot especially on the performance side.

Eventually, VS Code became clearly superior in feature-set and performance so Iswitched to it full-time. At this point, I deleted Atom from my Computer and VSCode reigned supreme.

Switching to VS Code from Atom was not as seamless as the switch from Sublime toAtom. This was partly because the interface was a little different and it tookme some time to adjust.

The default key bindings were also so much different from what I was used tocoming from Atom. This issue was easily solved by installing an extension thatremapped the key bindings to Atom’s so that eased my transition a bit.

VS Code is probably the best text editor for developers who write a lot ofJavaScript and TypeScript due to its comprehensive out-of-the-box support forboth languages. However, other languages are also well supported. It was reallyeasy to work with Rust for example, which Idabbled in sometime last year, with the help of some plugins.

In the months in which I used VS Code, I didn’t have much to complain about.Although performance wasn’t as good as Sublime, it was much better than Atom andcontinued to improve.

Despite this, I still had an eye on learning and using Vim. Any time I readabout text editors in a discussion forum like Reddit or Hacker News, someone isbound to sing the praises of Vim and mention how much it can improve personalproductivity.

When one of my friends switched toVim and soon after was singing thesame song, that did it for me. I just had to get what was so good about Vim.

Trying Vim for the second time

Vscode Vim Plugin

Since I didn’t have much going at the time, haven just released StellarPhotos, I decided to switch to Vim cold turkeymeaning I didn’t retain any other text editor on my computer during thistransition process in a bid to force myself to use Vim exclusively.

It certainly wasn’t as difficult as when I tried it the first time. I usedvimtutor to remind myself of the basic commands and just went from there.

Vim is bare bones and doesn’t come with all the features I had taken for grantedin other text editors, but in most cases, I could add the functionality I neededusing a plugin.

That said, this became problematic to some extent as it led me to install morethan what I actually needed and my .vimrc file was populated with a lot ofstuff that I didn’t understand.

So I took a step back and stopped trying to make Vim work like the other texteditors I had used and instead, learn the features it has that makes it sounique and special. It quickly dawned on me that Vim can actually do a lot onits own without plugins.

Where necessary, I could still add plugins but, by not using them to scratch myevery itch, I was forced to learn the Vim way of doing things which was, in mostcases, better than what I was used to.

Working with just the keyboard has been a real eye-opener to just how fast onecan be without touching the mouse. Everything can be achieved with just a fewstrokes, and due to Vim’s modal nature, each key combination has a differentmeaning in each mode. That may sound complicated on first thought, but it’sactually really intuitive once you get used to it.

I have adopted the mindset of preferring to just use the keyboard in other areasas well like using jumpapp for switchingbetween applications and using Saka Keyfor navigating quickly in my browser.

Update: I now use Surfingkeysinstead of Saka Key and Run or raisefor GNOME on Wayland.

One of the things I love about Vim is that each change can be repeated manytimes using the dot command or macros which does save me a lot of time whenediting code. It may just be seconds saved here and there but it adds up.

The one thing I’ve found significantly worse in Vim compared to other editors isthe colour and font quality, but I suspect this has more to do with my terminalemulator (I use Terminator).

I know its possible to make Vim look really good in the terminal as I’ve seenscreenshots of other setups on r/Unixporn,but I’ve not been able to create something I’m entirely happy with thus far soI’m currently exploring what Gvim (Vim GUI) has to offer.

Conclusion

Visual Studio Code Vim Plugin

Vsvim

Vim Keybindings Visual Studio

Having spent six months using Vim as my main editor, I can say it has definitelybeen a worthwhile experience and I don’t see myself switching over to some othereditor anytime soon.

Right now, I’m looking to improve my mastery of the editor, and learn someadvanced flows to become even more efficient. To that end, I’m currently readingPractical Vim by DrewNeilwhich appears to be one of the best books on the subject.

If you already have a productive setup in your current editor, I don’t thinkit’s necessary to switch to Vim abruptly like I did. It may not even berealistic depending on your work situation.

Having said that, I think it is still useful to learn the Vim way of editingtext and you don’t need to use Vim itself to do so. Most editors have a pluginthat emulates Vim key bindings so you can easily experience the Vim way withoutthrowing away your existing workflow.

Here are the ones for Sublime,Atom, and VSCode.

I will keep sharing what I learn on this blog, so if you’re interested inchecking out Vim, don’t be afraid to try it. You might just like it.