Text objects — inner versus outer
To edit efficiently in Vim, you must think beyond individual characters. Expert Vimmers think in terms of words, sentences, paragraphs, and blocks of code. In Vim, each of these higher-level constructs is called a text object.
Like operators, there are many text objects available in Vim, and you can even create your own.
”Inner” and “outer” text objects
The built-in text objects in Vim take two forms: inner and outer. Inner text objects begin with i, and outer text objects begin with a. The difference between them is subtle, but important.
Generally speaking, inner text objects capture the inner content of the given construct, whereas outer text objects capture both the inner content and the surrounding context.
To illustrate the difference, let’s think about the i" and a" text objects. These are useful when you want to operate on a quoted string. Which one you should use depends on what you’re trying to achieve.
There’s a quoted string in the editor. To understand the difference between inner and outer text objects, place your cursor within the quotes and type vi". Then try re-entering normal mode and typing va". You’ll notice that vi" captures the content within the quoted string, and va" captures everything within the quotes including the quotes themselves (and any preceding whitespace).