Combining Vim commands

Mike Hartington
InstructorMike Hartington
Share this video with your friends

Social Share Links

Send Tweet
Published 8 years ago
Updated 4 years ago

We've gone over some of the basic Vim key commands, but what else can you do with them? We'll go over how you can compose them and to create more powerful commands

[00:00] In our last video, we looked at some built-in key commands that VIM provides to edit text while in normal mode, commands like E-W to delete a word and remain in normal mode, and commands like C-W to change a word, but then be put into insert mode.

[00:16] While these commands are powerful on their own, we can build on them to make them even more effective. In most cases, VIM commands are built up in three parts -- and action, a location, and then a second location that acts as context. For this div, we have "hello world" inside, but I want to replace that with something else.

[00:37] We can use the key combo of C-I-T to delete all the content and be put right into insert mode. This works because VIM doesn't treat text as just a collection of letters, but as an object that can be manipulated.

[00:52] Let's look at another example with this function. With HTML, we have specific keys for inner tags, I and T, but for this function, we can use C-I, and then curly braces. VIM knows not only where it should start to delete content, but where it should end, in this case with the closing curly brace.

[01:13] This same idea can go with words inside of quote marks, too. Here we can type C-I, and then the double quotes, and VIM will automatically delete the words and put me into insert mode. Now it knows to delete the words inside the quotes, but also not to delete the closing quote mark

~ 14 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today