Serverspace Black Friday
JT
April 26, 2024
Updated July 12, 2024

How to Exit from VIM and Other Management Tips

Linux Maintenance

Vim is a text editor that is predominantly used in Linux-like operating systems. Its many functionalities and the way it is operated are not always easy for a beginner. Therefore, this manual explains the basics and answers questions that arise when working with this tool.

How to exit from vim?

In order to exit vim you need to switch from edit mode to command mode and type the command to exit. Press the Esc key and type the :wq command also as shown in the image below:

Exit from vim
Screenshot №1 — Exit from vim

The entered :wq command indicates two basic actions: save and exit. To exit without saving, use the :q! command, which can be useful when working!

How to learn vim command?

To familiarise yourself with vim's basic options, you can use -h when calling the utility:

vim -h
List of help arguments
Screenshot №2 — List of help arguments

The manual describes the basic options and syntax that will be used to call the utility and work with it. To familiarise yourself with the basic commands of the editor, there is a utility called vimtutor, which opens about twenty tutorials:

Vimtutor
Screenshot №3 — Vimtutor

By going through them in an estimated time of 25 minutes, you will learn the basics and be able to fully use the editor.

All steps in the tutorial can be performed on powerful cloud servers. Serverspace provide isolated VPS / VDS servers for common and virtualize usage.

Create Server
Screenshot №4 — Create Server

It will take some time to deploy server capacity. After that you can connect in any of the convenient ways. Let's return to explore vim environment.

How to enable edit mode in vim?

When opening a file, the utility waits for input commands; to switch from viewing mode to editing mode, press the i key, which will start input from the cursor position. The same symbol I will start input from the beginning of the line. Enter the required text, followed by Esc to exit the editing mode.

Edit mode
Screenshot №5 — Edit mode

How to copy to clipboard in VIM?

To copy and paste from the clipboard, the same commands are used. In order to select an area press v to switch to selection mode, then use j, k, h, l keys to move through the text. Once the desired area is selected, use the following buttons:

  • y - copy to buffer;
  • Y - copy string to buffer;
  • x - delete and copy to buffer;
  • p - paste from the buffer.
Copy item
Screenshot №6 — Copy item

When these keys are pressed, copying will take place, pasting is done via the p key.

How do I erase text in VIM?

In order to delete text, you can switch to edit mode with i or I and delete characters in the usual way. However, if you want to delete the whole line or a selected segment via selection mode v , then use the d button. The selected segment will be deleted.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 2
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.