FANDOM


 
(Clean and reword.)
Line 1: Line 1:
{{review}}
 
 
{{Tip
 
{{Tip
 
|id=49
 
|id=49
Line 9: Line 8:
 
|rating=102/51
 
|rating=102/51
 
|text=
 
|text=
To switch the case of one or more characters use the "~", "gU" or
+
You can change the case of letters:
  +
:Toggle case "HellO" to "hELLo" with '''~'''.
  +
:Uppercase "HellO" to "HELLO" with '''gU'''.
  +
:Lowercase "HellO" to "hello" with '''gu'''.
   
"gu" commands.
+
== Examples ==
   
  +
; ~
  +
: Toggle case of the character under the cursor, or all visually-selected characters.
   
  +
; 3~
  +
: Toggle case of the next three characters.
   
Examples:
+
; g~~
  +
: Toggle case of the current line.
   
  +
; U
  +
: Uppercase the visually-selected text.
  +
: First press v or V then move to select text.
  +
: If you don't select text, pressing U will undo all changes to the current line.
   
  +
; gUU
  +
: Change the current line to uppercase.
   
~ - switch case of character under cursor
+
; u
  +
: Lowercase the visually-selected text.
  +
: If you don't select text, pressing u will undo the last change.
   
(in visual-mode: switch case of highlighted text)
+
; guu
  +
: Change the current line to lowercase.
   
  +
; gUaw
  +
: Change current word to uppercase.
   
  +
; guaw
  +
: Change current word to lowercase.
   
3~ - switch case of next three characters
+
== References ==
  +
{{help|case}}
   
 
 
g~~ - switch case of current line
 
 
 
 
U - in visual-mode: make highlighted text uppercase
 
 
 
 
gUU - make current line uppercase
 
 
 
 
u - in visual-mode: make highlighted text lowercase
 
 
 
 
guu - make current line lowercase
 
 
 
 
gUaw - make current word uppercase
 
 
 
 
guaw - make current word lowercase
 
 
 
 
For some more examples refer to
 
 
 
 
[http://vimplugin.sf.net/cgi-bin/help?tag={{urlencode:~}} :help ~]
 
 
 
 
See also:
 
 
 
 
:help simple-change
 
 
}}
 
}}
   
 
== Comments ==
 
== Comments ==
Not exactly case related but something I really like.
 
 
g? does rot13 "encryption"
 
 
 
harri.haataja--AT--cs.helsinki.fi
 
, May 7, 2002 6:40
 
----
 
Instead of g~~, i prefer V~
 
 
uws--AT--xs4all.invalid
 
, July 8, 2003 4:25
 
----
 
<!-- parsed by vimtips.py in 0.438499 seconds-->
 

Revision as of 11:07, June 27, 2007

Previous TipNext Tip

Tip: #49 - Switching case of characters

Created: March 14, 2001 9:24 Complexity: basic Author: Anonymous Version: 5.7 Karma: 102/51 Imported from: Tip#49

You can change the case of letters:

Toggle case "HellO" to "hELLo" with ~.
Uppercase "HellO" to "HELLO" with gU.
Lowercase "HellO" to "hello" with gu.

Examples

~
Toggle case of the character under the cursor, or all visually-selected characters.
3~
Toggle case of the next three characters.
g~~
Toggle case of the current line.
U
Uppercase the visually-selected text.
First press v or V then move to select text.
If you don't select text, pressing U will undo all changes to the current line.
gUU
Change the current line to uppercase.
u
Lowercase the visually-selected text.
If you don't select text, pressing u will undo the last change.
guu
Change the current line to lowercase.
gUaw
Change current word to uppercase.
guaw
Change current word to lowercase.

References

:help case

Comments

Community content is available under CC-BY-SA unless otherwise noted.