Block Text Objects

In many ways blocks extend the concept of quotes. Just as specific chunks of text can be surrounded by quotation marks, they can also be surrounded by parentheses, brackets, etc. In Neovim, these section are called blocks:

block
sequences of text contained within {}, [], <>, or ()

While parenthesis are common in prose, the various types of brackets are common in programming language, and convey different meanings depending on the language. In any case, Neovim has the ability to isolate those blocks of text. As a simple example, let's look at the following snippet of Python code:

Initial Condition
the_list·=·[
····"one",
····"two",
]
NORMAL
Top
1:1
 
Select Block
vi[
the_list·=·[
····"one",
····"two",
]
VISUAL
60%
3:11
 

In this example, the cursor starts at the top of the buffer, which contains the opening bracket [. In Step 1 we instruct Neovim to select the contents of that block with the command vi[. Similar operations can be use to work with each of the other types of blocks.