The structure of Vim’s command language
As we mentioned in the previous section, there are three components:
- operators
- text objects
- motions
We’ll explore what each of these are in the coming sections, but for now, we should understand that the basic structure of Vim’s command language is:
[count]{operator}{text object/motion}
That means, in normal mode:
- we can start our request with an optional count
- we then specify an operator
- we then specify either a text object or a motion
When we perform such an action in normal mode, we perform the given operator count times over the range of characters specified by either the text object or motion.
Let’s try an example to kick us off. We need to know about the d operator and the ap text object (we’ll learn exactly what is meant by ‘operator’ and ‘text object’ next). The d operator is one of the simplest, used for deleting text. The ap text object corresponds to a paragraph. Therefore, dap says to Vim ‘delete a paragraph’ — the paragraph being the one which the cursor is placed on.
Try it in the editor.