How do I visually select an entire sentence in Vim?
Answer
vas
Explanation
The vas command visually selects the current sentence, including surrounding whitespace. It uses the as (around sentence) text object, which is one of Vim's built-in text objects for prose editing.
How it works
v— enter characterwise Visual modea— select "around" (includes surrounding whitespace/punctuation)s— the sentence text object
Vim defines a sentence as ending with ., !, or ? followed by a space, tab, or end of line. as selects from the start of the sentence to the end including the trailing space. Use is (inner sentence) to select without trailing whitespace.
Example
The quick brown fox. |The dog jumped. A new sentence here.
With cursor on "The dog jumped", pressing vas selects:
The quick brown fox. [The dog jumped. ]A new sentence here.
(brackets show the selection — includes trailing space)
Tips
vis— inner sentence (no trailing space)das— delete the whole sentence including trailing spacecas— change the sentence (delete and enter Insert mode)yas— yank (copy) the sentence to the default register- Pair with
(and)motions to navigate between sentences - Useful for prose editing, markdown, and documentation files