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