From the course: Learning vi

Unlock the full course today

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

Changing text

Changing text - vi Tutorial

From the course: Learning vi

Start my 1-month free trial

Changing text

Now I'll talk about vi commands that change text. The command r changes the current character, which is to say the character the cursor. The command s also changes the current character. The difference between r and s is that if you type r and then another character, the new character that you just typed replaces the current character, but you're still in command mode. Whereas if you type s and then another character, the new character replaces the current character at the cursor, but now you're in insert mode. So, r leaves you in command mode, s leaves you in insert mode. The rest of these commands leave you in insert mode. cc changes the current line, which is to say, it deletes the contents of the current line and leaves you in insert mode. cw changes the current word, which is to say, it deletes the current word and leaves you in insert mode. Unlike the w command, the cw command actually only changes to the end of the current word, it's exactly the same as ce. You can use c^ to…

Contents