How do I select the text inside quotes?
Answer
vi"
Explanation
The vi" command visually selects all text inside double quotes, without including the quotes themselves. This uses Vim's text object system where i" means "inner quotes."
How it works
venters visual modei"selects the inner content of the surrounding double quotes
The cursor can be anywhere inside the quoted string — Vim automatically finds the enclosing quotes on the current line.
Example
Given the text:
name = "John Doe"
With the cursor anywhere between the quotes, vi" selects John Doe.
Tips
- Use
vi'for single quotes,vi`for backticks - Use
va"to select including the quotes themselves - Combine with operators:
di"to delete inside quotes,ci"to change inside quotes,yi"to yank - Also works with parentheses (
vi(), brackets (vi[), braces (vi{), and tags (vit)