Quote Text Objects

Now that we have reviewed the common components of prose, let's look at the remaining text-objects, which allow us to pin-point specific groups of text within sentences and paragraphs, as well as within programming code. In the first example, we look at quotes.

quotes
sequences of text contained within quotes "", ', or `

Quotes are common in prose, as well as in programming languages, so the ability to pin-point those areas of text can be very convenient.

Let's take a look at a few examples to see how these work:

Initial Condition
that·it·has·come,·let·me·leave.·For·a·long·time,·I've·been·waiting·for
this·hour;·for·a·long·time,·I've·been·Vasudeva·the·ferryman.·Now·it's
enough.·Farewell,·but,·farewell,·river,·farewell,·Siddhartha!"
 
Siddhartha·made·a·deep·bow·before·him·who·bid·his·farewell.
 
"I've·known·it,"·he·said·quietly.·"You'll·go·into·the·forests?"
 
"I'm·going·into·the·forests,·I'm·going·into·the·oneness,"·spoke
NORMAL
70%
7:5
 
Select Quotes
vi"
that·it·has·come,·let·me·leave.·For·a·long·time,·I've·been·waiting·for
this·hour;·for·a·long·time,·I've·been·Vasudeva·the·ferryman.·Now·it's
enough.·Farewell,·but,·farewell,·river,·farewell,·Siddhartha!"
 
Siddhartha·made·a·deep·bow·before·him·who·bid·his·farewell.
 
"I've·known·it,"·he·said·quietly.·"You'll·go·into·the·forests?"
 
"I'm·going·into·the·forests,·I'm·going·into·the·oneness,"·spoke
VISUAL
70%
7:15
 
Move Cursor
<ESC>fd
that·it·has·come,·let·me·leave.·For·a·long·time,·I've·been·waiting·for
this·hour;·for·a·long·time,·I've·been·Vasudeva·the·ferryman.·Now·it's
enough.·Farewell,·but,·farewell,·river,·farewell,·Siddhartha!"
 
Siddhartha·made·a·deep·bow·before·him·who·bid·his·farewell.
 
"I've·known·it,"·he·said·quietly.·"You'll·go·into·the·forests?"
 
"I'm·going·into·the·forests,·I'm·going·into·the·oneness,"·spoke
NORMAL
70%
7:24
 
Select Quotes
vi"
that·it·has·come,·let·me·leave.·For·a·long·time,·I've·been·waiting·for
this·hour;·for·a·long·time,·I've·been·Vasudeva·the·ferryman.·Now·it's
enough.·Farewell,·but,·farewell,·river,·farewell,·Siddhartha!"
 
Siddhartha·made·a·deep·bow·before·him·who·bid·his·farewell.
 
"I've·known·it,"·he·said·quietly.·"You'll·go·into·the·forests?"
 
"I'm·going·into·the·forests,·I'm·going·into·the·oneness,"·spoke
VISUAL
70%
7:34
 
Move Cursor
<ESC>fg
that·it·has·come,·let·me·leave.·For·a·long·time,·I've·been·waiting·for
this·hour;·for·a·long·time,·I've·been·Vasudeva·the·ferryman.·Now·it's
enough.·Farewell,·but,·farewell,·river,·farewell,·Siddhartha!"
 
Siddhartha·made·a·deep·bow·before·him·who·bid·his·farewell.
 
"I've·known·it,"·he·said·quietly.·"You'll·go·into·the·forests?"
 
"I'm·going·into·the·forests,·I'm·going·into·the·oneness,"·spoke
NORMAL
70%
7:43
 
Select Quotes
vi"
that·it·has·come,·let·me·leave.·For·a·long·time,·I've·been·waiting·for
this·hour;·for·a·long·time,·I've·been·Vasudeva·the·ferryman.·Now·it's
enough.·Farewell,·but,·farewell,·river,·farewell,·Siddhartha!"
 
Siddhartha·made·a·deep·bow·before·him·who·bid·his·farewell.
 
"I've·known·it,"·he·said·quietly.·"You'll·go·into·the·forests?"
 
"I'm·going·into·the·forests,·I'm·going·into·the·oneness,"·spoke
VISUAL
70%
7:62
 

We start with the cursor on the e of I've, then in Step 1 selected the quoted text. Note that Neovim was smart enough to extend past the apostrophe in I've and select the entire quoted chunk of text. In Step 3 we move the cursor to between the two quoted chunks of text, and select again. In this case, Neovim selected all of the text between the two chunks of quoted text. Finally, after moving the cursor into the second chunk of quoted text in Step 4, the text inside of the second chunk of quoted text is selected in Step 5.

Note

As we will learn shortly Text objects come in two flavors, inner and around. We are using the "inner" text-objects to select the text inside the quotes. The "around" text-objects do the same thing, but would include the quotation marks. For now, just be aware that both options are available.