vimtricks.wiki Concise Vim tricks, one at a time.

How do I quickly change an entire sentence in Vim?

Answer

cis

Explanation

The cis command deletes the entire sentence under the cursor and drops you into insert mode, ready to type a replacement. It uses Vim's built-in sentence text object, which understands punctuation-based sentence boundaries — a feature most Vim users never discover.

How it works

  • c is the change operator (delete and enter insert mode)
  • is is the "inner sentence" text object
  • Vim defines a sentence as text ending with ., !, or ? followed by whitespace or end-of-line
  • is selects the sentence content without trailing whitespace, while as ("a sentence") includes the trailing whitespace

Example

Given the text with the cursor anywhere on the second sentence:

Vim is powerful. It has many features. Learn them all.

Pressing cis deletes It has many features and enters insert mode:

Vim is powerful. |. Learn them all.

Type The dot command is essential and press <Esc>:

Vim is powerful. The dot command is essential. Learn them all.

Tips

  • Use das to delete a sentence and the trailing whitespace, cleaning up spacing automatically
  • dis deletes the sentence without entering insert mode
  • yis yanks (copies) the current sentence
  • vis visually selects the sentence so you can see what will be affected before acting
  • The ) and ( motions move forward and backward by sentence — useful for navigating prose
  • Sentence text objects work best with properly punctuated text; they may behave unexpectedly with code that uses dots in identifiers like object.method
  • Pair with . to repeat: after cis, type your replacement, press <Esc>, navigate to another sentence, and press . to replace it the same way

Next

How do I edit multiple lines at once using multiple cursors in Vim?