From the course: Learning Vim

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Visual selection

Visual selection - vi Tutorial

From the course: Learning Vim

Start my 1-month free trial

Visual selection

- [Instructor] Vim has many great movement commands. However, sometimes you'd like to see what is the part of the text you're selecting. To do this, Vim has a visual mode. In this mode, you select lines and Vim will highlight them for you. Let's open light.txt. Vim light.txt. To enter visual mode use shift + v. You can see the status bar at the bottom changes to visual line. Shift + v selected one line. And now we can extend the selection using motion commands. For example, let's use j to select another line. Once you're happy with the selection you can decide what to do with it. Let's delete these two lines with d. Shift + v selects lines. You can also use control + v to select blocks. Let's undo with u. And now control + v. You can see the status bar below changing to visual block. Extend the block one column to the right, using l. And now four more lines using four + j. Once you've selected the block you can decide what to do. Let's delete the white space with d. Very handy. I…

Contents