Barbarian Meets Coding

presents

Boost Your Coding Fu With VSCode and Vim
Chapter 3.Table of ContentsCheatsheet

Introduction

Visual Studio Code is superb. It offers an unparalleled user experience with great support for many languages and development ecosystems. It comes with great defaults and is super easy to use and to get started with.

Vim is awesome. Its modal nature and text editing features make it unique amongst other editors. Vim offers a complete different level of text editing proficiency, speed and accuracy from anything else out there.

The combination of both couldn’t be anything less that amazingly superbsome (yep, I just did that).

In the upcoming days, and as you read these pages and practice, you will boost your Visual Studio editing skills incredibly. You’ll become better by bringing in lots of useful tools from the Vim editor right inside the comfort of your favorite editor: Visual Studio Code.

Here is what we’re going to cover in this book:

  • What is Vim? And Why Use Vim in VSCode?
  • How to Install Vim in VSCode?
  • Basic Surviving Skills in Vim
  • Moving Blazingly Fast with Core Vim Motions
  • Editing at The Speed of Thought With Vim Operators and Motions
  • Vim’s Secret Language
  • Inserting Text a la Vim
  • Selecting Text in Visual Mode
  • Copy and Pasting Taking Advantage of Registers
  • Surrounding Things with Vim Surround
  • Moving Even Faster with the Sneak and EasyMotion Plugins
  • Creating Custom Shortcuts to Make You More Effective
  • Supercharging Multiple Cursors With Vim
  • Creating Reusable Editing Units With Macros
  • Integrating VSCode with Neovim For Maximum Awesomeness

At the end of this book you’ll be capable of fine grained text manipulations and powerful text transformations that were previously unreachable to you. And over time, and as you practice and get comfortable with the different Vim commands, you will become faster and more proficient at editing than you were before.

What is Vim?

Vi is an ancient text editor. Old even before the first age of the world. It was designed to work on contraptions called terminals with the very uncommon yet inspired characteristic of functioning in a modal fashion. That is, it has a mode for inserting text, another for editing text, a different one for selecting text, and so on.

Vi’s latest and most celebrated incarnation is Vim (Vi IMproved and formerly Vi IMitation) which works both with text and graphical interfaces, comes with a plethora of improvements over vi and is supported on every platform known to humankind.

But the impact of Vim doesn’t stop with Vim, Vim’s ideas are so very remarkable that they have transcended the Vim editor itself and propagated into other editors. Today you can find Vim-like modes in almost any editor and IDE that you can imagine. Like, for instance, in Visual Studio Code.

Why Vim? Isn’t Visual Studio Code Enough?

Why should you care about learning about an ancient editor in this day and age? Does it really make such a big difference to my Visual Studio Code setup?

The truth is that Vim provides a different way of interacting with text from anything I’ve ever seen. A way that gives you a completely different level of control and fluency when editing code.

At the hands of an experienced user, editing text with Vim seems like magic:

  • Vim makes you faster.
  • Vim makes you more precise
  • Vim unlocks a completely different level of control in text editing
  • Vim thins the interface between your brain and the computer
  • And it is awe-striking to behold when doing presentations :D

Awesome! That sounds very good and all that… But… How can Vim achieve all this?

Vim’s modal nature empowers your keyboard to control every aspect of your editor. Every mode is a clean slate that gives your keyboard new powers, to edit text at lightning speed, navigate at the speed of thought, select and move text to your heart’s content, and more.

With Vim, you’re no longer limited to inserting text nor subject to the tyranny of the mouse to click, navigate or select text. No. After using Vim for a while, you’ll be like a code surgeon that makes expert incisions with surgical precision whenever and wherever it is required, navigating through your code and codebase with the lightning speed and accuracy of a entirely keyboard driven workflow.

So Why would you want to learn Vim in this day and age? Paraphrasing the mighty Drew Neil author of Practical Vim and master of the most obscure Vim arcana:

Vim is for programmers who want to raise their game. In the hands of an expert, Vim shreds text at the speed of thought.

And who wouldn’t want that?


Jaime González García

Written by Jaime González García , Dad, Husband, Front-end software engineer, UX designer, amateur pixel artist, tinkerer and master of the arcane arts. You should follow him on Twitter where he shares useful stuff! (and is funny too).Jaime González García