UNIX vi editor

Playing with case of characters in vi


Switching case of characters

You can change the case of text:

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.

Alternatively, you can visually select text then press ~ to toggle case, or U to convert to uppercase, or u to convert to lowercase.


Toggle case of the character under the cursor, or all visually-selected characters.
Toggle case of the next three characters.
Toggle case of the next three words.
Toggle case of the current word (inner word – cursor anywhere in word).
Toggle case of all characters to end of line.
Toggle case of the current line (same as V~).

The above uses ~ to toggle case. In each example, you can replace ~ with u to convert to lowercase, or with U to convert to uppercase. For example:

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.
Change the current line to uppercase (same as VU).
Change current word to uppercase.
Lowercase the visually-selected text.
If you don''t select text, pressing u will undo the last change.
Change the current line to lowercase (same as Vu).

If you like dEexams.com and would like to contribute, you can also write your article here or mail your article to admin@deexams.com . See your article appearing on the dEexams.com main page and help others to learn.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Python if , elif and else

Python Conditions and If statements

  • 0
Python for beginners

Learning Python Part 1

  • 3
Struct Alignment and Padding

Struct Alignment and Padding in C++ And C

  • 0
Friend function

Friend function C++

  • 0

C++ Pointers

  • 0

C++ Structures

  • 0
Types of Inheritance in C++

Inheritance and access specifiers C++

  • 0
Java date pattern

Java Date Pattern Syntax

  • 0
Java Date and Calendar

Java Date formats

  • 0
JAVA Data Type

Data types in Java

  • 0
Java unreachable code

Unreachable Code Error in Java

  • 0

Post Comment





Forgot Password

Please enter your email address below and we will send you information to change your password.