Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (2024)

/ #Vim
Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (1)
Simon Späti
Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (2)

Throughout my time as a developer, I've used VS Code, Sublime, Notepad++, TextMate, and others. But shortcuts like cmd(+shift)+end and jumping with option+arrow-keys from word to word needed to be faster at some point.

I was hitting my limits. Everything I was doing I did decently fast, but I didn’t get any faster.

I've since learned that Vim is the only editor that you get faster using with time.

Vim is based solely on shortcuts. When I discovered that and played around a bit, I felt numb and a little stupid, having not learned the shortcuts (called Vim language) much earlier in my career.

I realized there was a keystroke to get to any specific position I wanted to jump. It was like a game, seeing if I could use fewer shortcuts to accomplish a particular edit. It’s where many Vim users get a lot of pleasure from coding and writing. It felt liberating, moving my cursor with the precision of a surgeon.

Although speed is a smaller benefit, it got me started when I saw others navigating in Vim. After climbing the steep learning curve, it’s still one of the most powerful skills I've ever learned in my career, working for a living on a computer.

Let’s debunk the myth of Vim and learn how it’s possible to remember all the shortcuts using the specific Vim language. We'll see how to move with vim motions, and I'll share what I’ve learned so far, and why you might give Vim a try as well.

Learning the Vim Language

Lots of things have been said about Vim – how fast it is, how only Linux nerds use it, and that it’s impossible to exit Vim.

For myself, I fell in love with the “Vim language”. You see, I’m bad at remembering anything and thought that Vim was not for me. But this wasn't the case for one specific reason: Vim motions and its language.

I learned that there’s a grammar behind the editor. With it, you express what you want to do first, how many times, and then what you want it to apply.

Let’s get deeper into Vim and the language behind it.

How the Vim Language and Motions Work

Vim has a terrific language or grammar behind its shortcuts. Instead of remembering a thousand shortcuts, you can learn a couple and combine them.

These are often called the Vim language or Vim motions for moving around. This has nothing to do with the editor yet – these are universal and available in other editors as well.

For example, there's VSVim for VSCode, IdeaVim for the JetBrains products, Vintage Mode for Sublime, and so on. But there are also Browser extensions like Vimium or Firenvim, and Gmail even adapted some of Vim's shortcuts for navigation (j, k for moving, g for jumping).

Everyone who types on a computer eight hours a day should learn the Vim language. Yes, it’s hard in the beginning, but that’s the case with everything new and different. But getting better every day and having more fun coding or writing should be motivation enough. You're not too busy to learn - you'll learn as you go.

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (3)

Vim Grammar

Just as spoken language grammar has verbs, subjects, and objects, so does the Vim language. The grammar has different verbs to begin with. Copying (or yanking) in Vim with y, deleting with d, pasting with p, changing with c, and so on.

For example, the easiest shortcut is copying a line with yy. In this case, yank is the verb and the second y is a synonym for y_. The y is doubled up which makes it easier to type since it's a joint operation.

Next, we can add movements. Each verb takes a subject for their movements. There are lots of movements (more in the next section) – the easiest is with numbers.

For example, to copy three lines, you add a 3 in front, such as 3yy. You can do that with all verbs, like deleting three lines is 3dd. Another would be { and } to move to the beginning or end of the paragraph, respectively.

In addition to verbs and subjects, the Vim language also has objects. For example, we can save text into different clipboards (called a register in Vim) with "ay. Here, we copy it into register a, which would be the object. We can paste it again by doing the same but using the verb paste instead of yank "ap.

There are even adjectives and adverbs with prefixes. Usually, you use a verb and an object. But instead of going down three lines with 3J, which joins the following three lines, you could add d5}, which means “delete from the current line through the end of the fifth paragraph down from here.”

For me, the most magical thing about Vim is how you navigate and edit text – and it still has nothing to do with the editor.

Sure Vim was the one that introduced and perfected these actions, but again – you can get them anywhere else. This goes deep into the Vim language, yet we still need to touch on the editor. This is important to know.

I hope you've started seeing the power of such patterns, though. With a couple of verbs and objects, you can already know hundreds of combinations without memorizing each one individually.

You can watch a video on Mastering the Vim Language or read a full exposition of the Vim language on this terrific StackOverflow comment.

Vim Motions

Vim motions are how you navigate, whether you navigate to the end of the word or back to the start of the document – these are all motions.

These are the first things you start learning (and hating) when learning Vim. They're extra hard to figure out initially, but they're something you'll want to use everywhere when you get used to them.

Instead of using arrow keys, Vim uses jk to move down and up and hl to move left and right. The main idea is to use the keys your right hand naturally rests on. You do not need to move your hands or even fingers for navigation.

Again, this seems like a small thing, but once you've learned it, you know why everyone is telling you about it.

Some common motions are:

h,j,k,l - left, down, up, rightw,W - to start of next word or WORDb,B - to start of previous word or WORDe,E - to end of word or WORD$ - to end of line^ - to start of line

You can find the most important motions to start with in this cheatsheet:

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (4)

How to Use Vim Modes (normal, insert, visual, and command)

Modes are another thing that might get you confused at the beginning.

When you launch Vim, you are not typing what you click on your keyboard as you are not in the “insert” mode that you're likely familiar with from other editors. Instead, the normal mode you are in lets you do the commands explained in the above Vim language and motions.

Vim is the only editor that optimizes editing text instead of writing from a blank page.

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (5)

That’s another reason Vim makes you so efficient: you have different modes for each phase of your current work or task.

  • Normal mode is for reading code and navigating quickly.
  • Insert mode is for when you want to add some code or text.
  • Visual mode is unique, the same as highlighting text with the mouse, but with the above Vim motions.
  • And command mode is the powerhouse, where you can type Linux commands such as formatting a JSON file with :%!jq (whereas jq is a command line tool installed on your machine) and execute them within Vim. This is also where you can use Vim commands such as :sort for sorting your files.

I could go on here, but I want to dive into the editor itself now and explore why I learned it initially and how to get started.

Introduction to Vim the Editor (Neovim, Lunarvim, and Helix)

So what is Vim the editor, then? It started with the simple vi editor, a basic editor that implements the Vim language and can edit text. It's a little like Notepad++, which you might use on Windows, but without a mouse and context menu.

Vim is simply an improved version of Vi with more features.

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (6)

Today there is even a newer version of Vim called Neovim. This version is super popular, and I’ve started using Neovim as well. Compared to Vim, Neovim uses Lua, an actual programming language, to configure and extend the editor. This makes writing plugins and configuring Neovim easier compared to Vim's native Vimscript.

Neovim is a great place to start learning Vim today, as it has so many awesome plugins. Neovim also won the most loved IDE on the StackOverflow survey a couple of times, last in 2022.

There is also an editor called Helix built in Rust, but it has minor deviations from the Vim language, which make it a less optimal place to start.

If you want to get started without needing to know anything about Neovim and spending hours on configurations, you can begin with LunarVim. It's a distro with all the features you know from VS Code already included.

Suppose you are comfortable with the terminal and realize you want to change the editor to your liking. In that case, you can kickstart your journey with a simple single-file configuration with many explanations that will work out of the box. You can also learn each config by opening the single config file.

Why I Learned Vim

Using the standard input method we use in our editors daily, we will eventually stagnate at a certain level. Sure, you can use cmd+arrow-keys (on a Mac) to jump to the beginning of a line or option+arrow-keys to jump between words instead of characters.

But what happens once you've mastered that? What if you need to change something in the middle of a sentence? There is no other way to jump several times with this option, or you move your hands away each time to reach the mouse to click on the exact spot.

One day, I saw a coworker work in Vim, and everything clicked. The Vim language and motions were the things I needed all along. So I installed the VS Code plugin, watched a couple of YouTube videos, and started my journey to learn the basic movements.

I also love learning new things and, even better, I'm always looking for ways to make me more productive 😉.

But as many of you might have experienced, the hardest part of learning Vim is getting started. The initial learning curve is very steep. Below is an illustration that shows this :).

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (7)

It took me also two or three times trying to start learning Vim until I fully grasped it. I switched back and forth. As well as having to get work done, it is sometimes hard to switch entirely from one day to another. But I just loved learning all the movements, and I knew it would make me faster after a short time.

Why I Love Vim

I have been using Vim for only eight months, and coding with Python for around six years. I've been using other code editors since my career started in 2003. Each editor I used had its strengths and its appeal. But I never experienced such efficiency gains as I have with Vim.

In the end, use the editor that works best for you. Personally, I want my editor to help me work as fast as possible, especially since I use it daily. Investing a bunch of time learning Vim is necessary, but it pays off over time. That’s the whole point with Vim and especially the Vim language.

An underrated skill in general among programmers is using the terminal. By learning your editor, especially with Vim, you will naturally learn more about the terminal and improve your Linux skills (reverse search, lazy git, Tmux, and many more).

Before Vim, I only used the terminal if I had to. I googled everything, and today, I use the terminal with its helpful manuals whenever I can.

Sometimes I’m surprised by myself as well, and it’s super nerdy – but it’s so effective. I’ve become a much better developer since starting to get comfortable with Vim.

Tweaking and optimizing Vim can take hours and days, and it's unavoidable in the beginning. But after a while, your dotfiles mature, and you start changing things less. You will also get much faster at trying out a new plugin or adding a remap.

Also, Vim is fun! Working in Neovim is one of the highlights of my everyday work. Improving your text editor and making it your own – maybe in ways no one else has optimized – is awesome.

For example, I write a lot, so I optimized for writing markdown and programming in Python. That’s what adds a lot to my happiness as a coder.

Because of all this, TJ DeVries calls Neovim a PDE (Personalized Development Environment), not “just” an IDE. You can learn more about this in ThePrimeagen’s truly inspiring Vim videos and learn why he used Vim in 2022.

Vim also manifested minimalism more in me. I used the terminal instead of fancy GUIs and plain text files for clarity, freedom, blazingly fast shortcuts, no vendor lock-in, and staying in the Flow with the content in front.

Vim changed not only my workflow but how I was able to edit at the speed of thought. Instead of thinking, “I want to edit that word”, my fingers jump to that word and change it with a few keystrokes.

Vim for Data Engineering

My data engineering workflow uses Neovim with the LSP (Language Server Protocol) pyright installed with mason. There's much more with Tmux, but you can find all the details on dotfiles/nvim.

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (8)

Vim for Writing

I’m still using Obsidian a lot more for writing (see more on my PKM workflow) due to its additional features of supported images, backlinks, graphs, and plugins specified for note-taking, such as ReadWise (syncing my highlight from books, and tweets), Dataview (using notes as a database), Excalidraw (drawing with Markdown format), Templates, and so on.

Nevertheless, I write more and more in Neovim. For now, I use ZenMode (for centering the text), Grammarly (for linting grammar), write-good (linting grammar), and specifically Obsidian.nvim (follow backlinks, and so on.). You find all details in my dotfiles.

In Obsidian, I use the Vim mode Obsidian .vimrc and map most hotkeys to my Vim settings. At the same time, I've been writing more and more in Neovim and have been progressively moving over to full Neovim.

Plugins such as Telescope and simple grep features that I use for coding work very well with Markdown. Here are some clips showing what is possible in an excellent talk about Writing, Editing, and World-Building at the speed of thought with Vim.

Why You Should Learn Vim, Too

When I heard about Vim, I thought that it was only for software engineers and Linux nerds 😅. I never thought I was going to use it as well. But how did I get into it?

I've already shared some reasons why I love Vim. But it really changed all my workflows, not only as a developer but also how I surf the internet, write, navigate, and use tools. I search for a Vim mode in any application I use.

But if you don't enjoy fiddling and optimizing your workflow, and if you don't write or code for a living, Vim might not be for you. Start with your current editor and activate the Vim mode before you do anything with Vim. It will save you a lot of frustration, trust me 😅.

How to Get Started Using Vim

There are many good resources that'll help you get started with Vim. The easiest is to type vimtutor into your terminal, which is an interactive tutorial for Vim.

I've already linked a few YouTube videos above – especially check out ThePrimagen starting with Vim As Your Editor or Why even bother with Vim or Neovim in 2022.

I started with Ben Awads’s Vim tutorial back then. An excellent Lecture: Editors (Vim) (2020). Mastering the Vim Language. I also collect a small playlist on YouTube with Vim content. A big inspiration also dev workflow using Tmux and Vim from Takuya.

Wrapping Up

We have learned that Vim is a powerful text editor popular among developers. It's based on shortcuts, called the Vim language, which can make coding and writing faster and more efficient.

With Vim, you can jump to any specific text position and rapidly make precise edits. While learning Vim can be challenging, it is well worth the effort in the long run as it will improve your productivity and bring joy to your coding experience.

If you want to go further, try Tmux, which plays well with Vim. You could even go one level deeper, which is a dedicated keyboard layout such as Dvorak or Halmak (which I started learning at some point). Or buy a fancy ergonomic keyboard or build one yourself.

Thanks for reading this far. I hope you enjoyed this article. I'm looking forward to hearing your comments and experiences.

You can read more of my other tutorials at www.sspaeti.com.

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

ADVERTIsem*nT

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (9)
Simon Späti

I’m a dedicated, empathetic, entrepreneurial data engineer with 20+ years of experience. I enjoy maintaining awareness of new innovative and emerging open-source technologies on sspaeti.com.

If you read this far, thank the author to show them you care.

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

ADVERTIsem*nT

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained (2024)

FAQs

Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained? ›

Vim is the only editor that optimizes editing text instead of writing from a blank page. That's another reason Vim makes you so efficient: you have different modes for each phase of your task—normal mode for reading code and navigating quickly. Insert mode when you want to add some code or text.

Why Vim is superior? ›

VIM (or more exactly, the VIM motions) is far superior to a normal text editor. It gives you the power to edit code by it's properties. You can move by lines, words, paragraphs, parentheses, you name it. You use syntactic logic to move, edit, jump to definitions, you name it.

Why Vim is so powerful? ›

It's based on shortcuts, called the Vim language, which can make coding and writing faster and more efficient. With Vim, you can jump to any specific text position and rapidly make precise edits.

What are the advantages of using Vim editor? ›

With Vim, you can navigate, edit, and perform commands with unparalleled speed, effortlessly moving through code or text using customizable keybindings. By minimizing physical strain and optimizing hand movement, Vim promotes a more ergonomic and efficient editing experience. 2.

Why is Vim editor so popular? ›

Customization. Vim is highly customizable and extensible, making it an attractive tool for users who demand a large amount of control and flexibility over their text editing environment. Text input is facilitated by a variety of features designed to increase keyboard efficiency.

What is the disadvantage of vim? ›

Since it is so customizable, the user needs to maintain his or her development setup over time and make sure all the plugins work well together. This can be more challenging if many plugins and customizations are used. Once you learn Vim well, any text entry field that doesn't use Vim keybindings will feel broken.

Is vim overhyped? ›

It might be overhyped as a programming tool (you won't write 2x the same amount of lines in a day; you will not be 5x more productive), but as an editor, it deserves every single bit of hype that it has. No other editor stands next to vim.

Why is Vim still popular? ›

Vim is always available. Any Linux machine has it. Vim has a small footprint, low latency, fast startup, allows for more screen space, customizable and most importantly, once the muscle-memory has been ingrained, it's nearly impossible to switch to something else.

Why do competitive programmers use Vim? ›

VIM is a text-object oriented editor… its not that hard to learn.. And as a developer you can learn VIM because it is fast and lightweight. It is a very simple and useful text editor. Though you write a big amount of code, its lightweight.

Does Facebook use Vim? ›

Facebook engineers have written millions of lines of code. There is no mandated development environment. Some developers use vim. Some use Emacs.

Do professionals use Vim? ›

People who are professional & actually enjoy using VIM and have used it for a long period of time are those who are comfortable using VIM but if you're not one of those people then they aren't forcing you to use it, and they won't even persuade novice programmers to use it in their first semester.

Why should I use Vim instead of Vscode? ›

Vim's still better and here's why.

There's some obvious reasons why Vim has an advantage over any GUI editor. It's light and fast, you can code over SSH on a server, it keeps you in your terminal, it's widely available, hugely portable and highly configurable.

Can Vim be used as an ide? ›

Vim is a powerful text editor that can be extended with plugins to provide IDE-like features. However, it is also possible to use Vim as an IDE without installing any plugins, by making use of the editor's built-in features and commands.

What percent of programmers use Vim? ›

Microsoft Visual Studio (32%) IntelliJ (28%) Notepad++ (28%) Vim (23%)

Why NeoVim is better than Vim? ›

Vim's plugin API is restrictive and cumbersome. The plugin architecture of NeoVim is a lot better than Vim. Apart from plugin implementation in Vimscript (VimL), we can also use the Lua programming language. In addition, NeoVim has a lot more powerful plugins, which are not compatible with Vim.

Is there any point to using Vim? ›

Another small but still impactful benefit that fits within the portability benefit is the ability to edit things like config files directly on servers that you're accessing via SSH. With Vim, you can quickly navigate and edit files when working in a GUI-less environment.

Is vim still the best? ›

Vim is still the most efficient way to edit text.

Another reason to come back to Vim, even in 2023, is that it's still one of the most efficient available options to edit text. While sophisticated editors like Visual Studio Code (VS Code) have come a long way, there's still no great replacement for Vim.

Do professionals use vim? ›

People who are professional & actually enjoy using VIM and have used it for a long period of time are those who are comfortable using VIM but if you're not one of those people then they aren't forcing you to use it, and they won't even persuade novice programmers to use it in their first semester.

Why vim is better than vi? ›

Some of the features that are in vim but not in vi are windows splitting and tabs, code highlighting, macros, undo and redo multiple times, command line history, pattern matching, and word completion. All these features help developers and writers boost their productivity.

Why is vi editor powerful? ›

Advantages of the vi editor include ease of use and user-friendly UI. It is a text editor that programmers and system administrators widely use. The vi editor is easy to learn and use and provides various features that make it a powerful tool for editing text files.

Top Articles
Key Account Management (KAM) - The Complete Guide
The Essential Guide to Modern Restaurant Accounting
Kostner Wingback Bed
Victor Spizzirri Linkedin
Tlc Africa Deaths 2021
Busted Newspaper Zapata Tx
Ffxiv Shelfeye Reaver
Gomoviesmalayalam
When is streaming illegal? What you need to know about pirated content
Tribune Seymour
Slay The Spire Red Mask
Obituary Times Herald Record
Iron Drop Cafe
10 Great Things You Might Know Troy McClure From | Topless Robot
Hope Swinimer Net Worth
Wgu Admissions Login
Foodland Weekly Ad Waxahachie Tx
National Weather Service Denver Co Forecast
Bfg Straap Dead Photo Graphic
Louisiana Sportsman Classifieds Guns
Paradise leaked: An analysis of offshore data leaks
Commodore Beach Club Live Cam
Erica Banks Net Worth | Boyfriend
China’s UberEats - Meituan Dianping, Abandons Bike Sharing And Ride Hailing - Digital Crew
Mj Nails Derby Ct
Bjerrum difference plots - Big Chemical Encyclopedia
Minnick Funeral Home West Point Nebraska
Talk To Me Showtimes Near Marcus Valley Grand Cinema
Uncovering The Mystery Behind Crazyjamjam Fanfix Leaked
1 Filmy4Wap In
Danielle Ranslow Obituary
New Stores Coming To Canton Ohio 2022
Expression Home XP-452 | Grand public | Imprimantes jet d'encre | Imprimantes | Produits | Epson France
Wheeling Matinee Results
R/Sandiego
Redding Activity Partners
Napa Autocare Locator
6465319333
Wake County Court Records | NorthCarolinaCourtRecords.us
Sephora Planet Hollywood
20 Best Things to Do in Thousand Oaks, CA - Travel Lens
Puretalkusa.com/Amac
Academic Calendar / Academics / Home
Chubbs Canton Il
Lorton Transfer Station
6463896344
Tìm x , y , z :a, \(\frac{x+z+1}{x}=\frac{z+x+2}{y}=\frac{x+y-3}{z}=\)\(\frac{1}{x+y+z}\)b, 10x = 6y và \(2x^2\)\(-\) \(...
Lsreg Att
Download Twitter Video (X), Photo, GIF - Twitter Downloader
Cool Math Games Bucketball
Latest Posts
Article information

Author: Delena Feil

Last Updated:

Views: 6372

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.