Useful Vim Commands

by admin May 10, 2017 at 11:31 am

What is Vim ?

Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.

Vim is often called a “programmer’s editor,” and so useful for programming that many consider it an entire IDE. It’s not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files.

To change the character from uppercase to lowercase

:%s/.*/\L&/

To remove blank lines

:g/^$/d

To replace the word from start to end in the file

:1,$s/pattern/replace/g

Example :

:1,$s/red/yellow/g

To remove trailing white space at the end of each line

:%s/\s\+$//e

To remove leading white space at the begining of each line

:%s/^\s\+//e
Tags:

Add Comment