tags:

views:

1423

answers:

4

Hi,

How do you convert all text in vim to lowercase? Is it even possible?

Thanks, Kenneth

+6  A: 
  1. If you really mean small caps, then no, that is not possible – just as it is’t possible to convert text to bold or italic in any text editor (as opposed to word processor). If you want to convert text to lowercase, create a visual block and press u (or U to convert to uppercase). Tidle (~) in command mode reverses case.

  2. If you want to see all text in Vim in small caps, you might want to look at the guifont option, or type :set guifont=* if your Vim flavour supports GUI font chooser.

zoul
right, i actually meant lowercase. thanks!
ksuralta
I think it's worth mentioning that you don't necessarily have to create a visual block to lowercase a block of text. `guu` will lowercase a line, and `gu[motion]` will lowercase that motion's worth of text. Likewise, `gUU` and `gU[motion]` work the same way, only for uppercase.
Zachary Murray
+10  A: 

I assume you want lowercase the text. Solution is pretty simple:

ggVGu

Explanation:

  1. gg - goes to first line of text
  2. V - turns on Visual selection, in line mode
  3. G - goes to end of file (at the moment you have whole text selected)
  4. u - lowercase selected area
depesz
or ggguG if you want to do it without visual selection.:help gu
Al
A: 

If you are running under a flavor of Unix

:0,$!tr "[A-Z]" "[a-z]"
ojblass
The square brackets are superfluous, and once you remove those, the quotes aren't necessary either. `:%!tr A-Z a-z`
ephemient
A: 
mangledorf