Learn Vim right within VSCode. Use this extension to learn and practice your Vim skills and become a more awesome developer. Features
This plugin adds a command that sets VSCode up as an environment for learning Vim:
RequirementsThis plugin is best used in conjuction with VSCodeVim. Known IssuesThis extension is still a work in progress. I just got so excited about putting this in your hands that I couldn't stop myself. Hope you'll find it valuable despite the kinks. For more informationEnjoy! AcknowledgementsCredit where it's due for the icons used in this extension: Massive kudos to the team of VSCodeVim for bringing a great Vim experience into VSCode. Release Notes0.0.27 - Registers
0.0.26 - Even More World domination with more copy/paste
0.0.25 - More World domination with more copy/paste
0.0.24 - World domination with copy/paste
0.0.23 - gn...
0.0.22 - Completely Visualized
0.0.21 - Visualize Victory
0.0.20 - Insert has been inserted
0.0.19 - A Little Step for Insert
0.0.18 - Fix Embarrassing Typo
0.0.17 - Insert Moar
0.0.16 - Secrets
0.0.15 - Operators operated
0.0.14 - An extra serving of whimsical exercises
0.0.13 - The Text Objects Strike Back
0.0.12 - README Feng Shui
0.0.11 - README!!
0.0.10 - README
0.0.9 - Editorial Corrections
0.0.8 - Combinatorial Explosion
0.0.7 - On florkins, blurkins and flerkens
0.0.6 - Operation operators
0.0.5 - I like to move it, move it
0.0.4 - Typos and Things of Lesser note
0.0.3 - Motions
0.0.2 - Softening the Start
0.0.1 - A New Hope
|
Hot tips to bring the awesomeness of Visual Studio Code to Vim.
Vim visual-studio-code vscodevim. Follow edited Aug 23 '20 at 9:44. 39.4k 6 6 gold badges 37 37 silver badges 73 73 bronze badges. Asked Nov 26 '17 at 23:59. 702 9 9 silver badges 18 18 bronze badges. Add a comment 2 Answers Active Oldest Votes. Description In this video, I go over why you should use Vim commands in VSCode and help you get started with the Vim extension. Socials Twit. Pros of Vim Pros of Visual Studio Code 343 Comes by default in most unix systems (remote editing).
Front-Matter
I want to start by saying, this is not an editor-shame article. You can use whatever text editor you want. It really doesn’t matter. I’m only writing this because I found a level of productivity in Vim that I haven’t had in any of the editors I used before (Sublime Text, Atom or VSCode).
If you’ve heard about Vim, and want to try it out, I hope this article can provide a bit of familiarity you’d find from VSCode.
Why Vim?
There are lots of reasons to use Vim, so here’s a few of mine.
Keep your hands at 10 and 2
When you are solely using the keyboard, there is going to be an inherent speed boost just from not having to physically move your hands. And hey, maybe you’re a black belt in mouse movement, and you can move back in forth with a speed invisible to the naked eye. For the rest of us simple humans, it takes time.
Let’s do some quick math.
It takes 600ms to move my hand from the “home keys” to the mouse. On average, for sake of argument, I do that once a minute while I’m writing code. Whether that be to scroll, navigate to a new file, or something similar.
600 (wasted time in ms) x 60 (times per hour) x 5 (hours I am actually coding) = 180,000ms wasted =
Visual Studio Vim Settings
3. Minutes. Every. Day.
Yeah, okay, maybe that doesn’t sound so bad, but, those 3 minutes could be spent writing a function, or refactoring code, not flailing your hand about like you're Harry Potter!
Speed
My favorite quote that describes what it’s like to code in VIM:
“Code at the speed of thought”
Vim is built around the idea that you are directly communicating with your computer. You tell it what you want, and it does it for you. The biggest eye-opener for me was this little tidbit:
To delete everything in between two objects (parentheses, quotes, etc), it's as simple as:
di'
That’s just the surface of amazing shorthand things you can do with Vim.
I’m a real programmer!
Part of the journey of learning VIM is exposing yourself to how UNIX works. I’m under the impression that the more you expose yourself to things like bash, the better programmer you are going to be.
Chances are, you have a pretty sweet command line setup. Wouldn’t it be nice if your code editor and your command line worked in concert?
How do you exit Vim?
Probability is high that you’ve ever edited a file on a Linux server, and couldn’t figure out how to exit the file. Let’s say, for example, changing an SSH key on Digital Ocean. If you know VIM…you don’t have to worry about that!
The real reason I switched to Vim
Honesty time. The real catalyst for wanting to switch to Vim was watching Kyle Mathews (creator of Gatsby.js) using it during a demo.
VS Code Features and their equivalents
Convinced? Cool, here’s some tools!
Plugin System
Vim by itself is pretty barebones. In order to add plugins, we have to have a mechanism to manage them. Enter Plug:
Note: There are a few plugin managers out there. I landed on Plug for no particular reason. I like it, and I’ve had no issues with it. FYI, Vundle is deprecated.
File Search
There has been a bunch of solutions for file searching over the years, as indicated by the multitude of answers in forums. I tried a couple of different ones, but landed on this combination:
Fuzzy Finder(fzf) + Ripgrep
Fzf is a really well built/maintained fuzzy search that works in both the command line and vim.
Note: You may see Ag(Silver searcher) in a lot of articles, however the Ag related vim plugin is no longer maintained, so it's suggested to use RipGrep.
Intellisense
The auto-completion system (Intellisense) in VSCode is arguably its best feature. Lucky for us, it’s been ported over to Vim!
CoC has its own extension system, that mirrors that of VSCodes. It's easy to use and well-documented (the most important part).
Note: You may see some old articles talking about YouCompleteMe, but as far as I can tell, that isn’t maintained anymore.
File System Explorer
VSCode, like most modern text editors, comes with a file explorer. Vim’s native netrw
is alright, and I’ve seen quite a few articles saying you don’t need anything else, like here. However, I find NERDTree is too useful to not use.
Git integration
I gotta be honest here, I do most of my git stuff straight in Iterm. However, VSCode has an incredibly nice Git Diff split screen. To get that level of git integration, check out this plugin:
Additional plugins that you may want
This is some of the stuff I used in Visual Studio Code, that I wanted to bring into Vim.
Autocomplete Brackets
This nice little package will auto close those pesky brackets.
File Icons
This will add icons to stuff like NERDTree.
Prettier
Wouldn’t you know it, but the official prettier team has a vim plugin. How nice! Also, incredibly simple to set up.
Get it to work on autosave, check out this article.
Snippets
Wouldn’t you know it, using the Conquer of Completion, you can import VSCode snippets!
Check this out to show you how to do that:
Here is the React snippets package I’m using.
Additional Stuff
THE home for Vim plugins is Vim Awesome.
Great place to watch people use Vim:
Visual Studio Vim Commands
Dotfiles
I have a few remapped keys to make things easier. Check out my dotfiles for all those.
Final Thoughts
My Journey
Visual Studio Vim Bindings
I solely use Vim now, after spending about a year to learn it. Initially, I was using it just for my personal projects, because my productivity level was low. I had to keep stopping to look up how to do something. However, I dropped VSCode completely about 4 months ago, and I don’t plan on going back.
It takes discipline
Learning Vim can seem daunting, and frankly, it is. It requires self-imposed discipline. However, doesn’t everything in development? There is no tool/language/framework I’ve ever learned that didn’t require some level of deliberate practice.
Vim is a lifestyle choice. It will take a while to get used to it, and it WILL be frustrating at times. However, if you stick to it, I guarantee it’ll improve your workflow. If you have any additional tips or questions, please drop them below. As always, happy coding!