How to use vim text editor with ubuntu

install the vim text editor. By following two steps

First, open the terminal by short key ctrl+alt+t

 Second, type the below command

sudo apt install vim

To Open a file

First, navigate the cursor to the right location where the file is saved, and to navigate you can use commands such as


When you reached the right location then open the file by a command shown below

Vim filename.cpp

You can also open a file without a terminal by right-clicking the required file and select open with a vim text editor

To edit a file

Use the i command to insert text into the file

Use the o command to move the cursor to the next line

Use Esc to switch between i mode and o mode or u mode

Use u command to undo the last operation

To exit a file

First, use Esc to switch mode

Use :q  to exit without saving

Use :q! to exit without saving the changes which you have made

To save a file

First, use Esc to switch mode

Use :w command to saves file

Use :X command to save and exit the file

To create a new file

Use the below command

Vim newfile.cpp

Mohammed Anees

Hey there, welcome to aneescraftsmanship I am Mohammed Anees an independent developer/blogger. I like to share and discuss the craft with others plus the things which I have learned because I believe that through discussion and sharing a new world opens up

Leave a Reply

Your email address will not be published.