1

From the vim-as-language article:

Vim’s "verbs" mostly fall into 2 main categories. Some of them act on a single character, and others act on a "motion" or "text object".

And from the vim wiki for switching the case of characters:

Toggle case "HellO" to "hELLo" with g~ then a movement.
Uppercase "HellO" to "HELLO" with gU then a movement.
Lowercase "HellO" to "hello" with gu then a movement.

In this case, it seems like Lowercase is the action. Would "the current line" be considered a movement or text object?

For example given the line (with my cursor at the |):

pgp - Pretty Good Privac|y

I'm wondering use the action-movement pattern to "downcase the current line" works in this case. I used gu0 which worked.

But what if the cursor is in the middle of the line like:

pgp - Pretty Go|od Privacy

Then, gu0 followed by gu$ will work, but it seems "the current line" should be a text-object. I also used guk or guk which works but I'm not sure if I'm thinking about the pattern the right way.

1

You can use gugu or guu for making current line lowercase. There's no a text object for current line

You can also use guip or guis which stand for paragraph and for sentence text objects

  • why does gugu and guu work? – mbigras Mar 16 '17 at 22:38
  • 3
    Repeating the command to make it act on the entire current line is a common idiom in vim. yy, dd, etc. all work this way. – Karl Bielefeldt Mar 16 '17 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.