After Github was acquired by Microsoft, a significant feature update was introduced to Github called Codespaces.

With it, you can write code directly in your repository instead of programming locally on your own computer. You can control a super fast server running VSCode from your browser to run code, service it, and update it.

Vim used to be the most portable text editor out there, because you could find it on almost any server machine and use it on your terminal via SSH.

Now VSCode has some of this functionality as well.

Not only can you run VSCode on Github, but Microsoft also provides a self-serving version of VSCode called Open VSCode Server. You can use it to install VSCode on a server and serve your application on any port you want. You can then access the server address in your browser and use VSCode in the same way as Codespaces, but free of charge.

1. Microsoft goes open source

Microsoft’s xterm.js (for VSCode’s own terminals) was released as Microsoft’s own open source project, and it spawned a whole bunch of browser-based terminals; You can now find a terminal on almost every server hosting site.

The company has long opposed the open source model, but now it has embraced the open source world. In the world of Web development, they are dominating. Microsoft has Ubuntu, Github, npmjs.com, and I rarely see a developer who doesn’t use VSCode.

When they started making VSCode so portable, even I started trying Open VSCode myself. I wanted to see if I liked the feel of writing code remotely and could appreciate the benefits of its not-so-crisp GUI.

After running binaries on my cheap £5-a-month server, it crashed almost immediately and I had to reboot.

2. Vim is still better

Vim has an advantage over any GUI editor for obvious reasons. It’s light and fast, you can write code over SSH on the server, and everything can be done on the terminal. It is widely used and has excellent portability and configurability.

You’ve probably heard all about these reasons, so I’d like to talk about some personal reasons I like it, and some areas where VSCode might be better at it.

It’s hard to use?

When I first mentioned that Vim was difficult, “Muggles” were shut out — I was joking.

In fact, learning Vim is much easier than learning an instrument, but many people can learn to play an instrument; It’s also much easier than learning to read and write, which is a very difficult thing to do, but almost everyone can do it.

The fact that it is difficult to use should not be a barrier to programmers using it. Learning all kinds of difficult things is what we are made for.

There are benefits to learning something difficult, but those benefits are not directly related to what you’re learning. You can gain some meta-skills along the way.

My son Yuri recently learned to ride a bike, which was difficult for him because riding a bike is not something you can learn little by little. There is a leap of faith moment when you learn to ride a bike. You have to take action before you are mentally ready and risk falling off the bike.

There’s another thing that makes it harder: a bike is useless to you until you learn how to ride it. So he used to like walking around on his scooter because it was so much easier and more fun to learn.

But Yuri hasn’t touched his scooter since he learned to ride because it’s too slow and not much fun. Although he didn’t realize it, he learned some meta-lessons along the way.

First, sometimes learning something requires a leap of faith, and you have to take a risk to take that step. Also, some things are useless until you learn…… And then all of a sudden they’re so fascinating.

VSCode is like a scooter in a text editor, and Vim is like a bike.

Vim is not asynchronous

Why is this an advantage? Well, that’s why it’s so fast. Vim only takes up about 7MB of space and only does one thing at a time.

It doesn’t scan your directory for function definitions, it doesn’t walk through syntax trees to give you complex auto-complete suggestions, it doesn’t calculate the context of your cursor and make requests to the document API, it doesn’t do git blame on every line of code, and it doesn’t automatically download the syntax for every file.

But Vim can do all these things…… As long as you let it do it.

It only does what you tell it to do

Some people like automatic features because everyone wants their life to be easier. Or, maybe you don’t have the time or energy to take care of the little things.

I guess it depends on how you feel about your level of work, whether you have the energy to use terminal commands to lint your files, or read :help to find out how to configure your.vimrc files (I never used :help when I started using Vim, Internet resources were definitely your best friend at first).

But to be honest, a lot of people I know waste their time in less fun ways, like mindlessly scrolling through Facebook or re-watching a few episodes of Friends on Netflix.

Sometimes I want to do something more interactive rather than writing code all the way through. If I was tired after work or on the weekend, I used to play music or computer games. Now I fix things at home or tinker with Vim.

I would think about small features that could be written in Vimscript, or integrate a useful command line tool, or even just read something I’d never seen before: Help… Just give me something to do, not something I have to do, but it’s not a total waste of time.

Vim makes code feel like a game

Once I got to know Vim, I stopped playing computer games completely, because the controls were almost like games. Vim has a modular structure that allows you to operate with a combination of commands. It’s a lot like how you would do combos in a fighting game.

Most commands have two, three, or four parts. One version of the three-part structure looks like this: operator – text object – motion.

The operators include delete, change, Visual Select, and replace, one at a time.

Text objects are either inside or around.

There are many kinds of actions, which we will discuss in detail later, but for now we can think of actions as a kind of target of commands. For example, I can press dib, which means delete inside block.

The operator is delete, the text object is inside, and the action is block. This removes everything inside a (parenthesis) block.

There are many possible combinations:

  • Di ‘– delete the contents of “inside” quotes.

  • Da “– Deletes the content around the” double quotes “.

  • Dit — Removes the content within the HTML tag.

  • Ci [– change the contents of [square brackets].

As I said earlier, there are many action commands to choose from, and they behave differently depending on whether you use them in a three-part combination (as described above) or in a two-part combination (where the text object is removed and the command runs backwards from the cursor position).

Below is a list of related actions you can use in the above three-step combination.

These commands allow you to quickly and easily change the arguments to a function, the contents of a string, or the contents of an if block. Once you learn these commands, you’ll want to use them everywhere.

Other text editors are cumbersome and clunky, and you’ll install “Vim mode” in every environment you can find.

More information on action

Actions are the type of keystroke commands you use most in Vim, because they can be used alone to move the cursor. Some actions can be used alone, while others only work when used as part of a combination.

For example, the W (forword) key will move the cursor forward one word at a time, but the ‘single quotation mark’ is not a separate action, and what it does is something else entirely.

Some actions become different types depending on whether they are used in combination or individually. For example, in the three-part combination above, the B key means block, but when you use it alone, it means back and moves the cursor back one word at a time.

Vim’s commands are context-aware and modular. Different keys mean different actions, depending on when you use them and where the cursor is located.

Much like a language, you can think of these commands as a sentence: Delete inside these ‘single quotes’.

PS: In case you can’t find this article, please click “like” to browse and find it