How To Install Vim On Ubuntu 22.04 LTS

How To Install Vim On Ubuntu 22.04 LTS

Steps To Install Vim On Ubuntu 22.04 LTS

Vim is a highly configurable and popular text editor.  It is an improved version of the vi editor. In this tutorial post, we are going to show you the steps to install Vim on Ubuntu 22.04 LTS. In Ubuntu, you can find Nano as a default editor.

How To Install Vim On Ubuntu 22.04 LTS

Vim editor is available in the Ubuntu repository. You can easily install it using the following command.

sudo apt install vim

How To Make Vim the default editor in Ubuntu

Nano is the default text editor in Ubuntu which means the files will get opened in Nano. If you want to change the default editor in Ubuntu then you need to edit the config file  with the following command:

sudo update-alternatives --config editor

You will see the put something like below from where you can change the default editor in Ubuntu. To make it default, you need to bring the vim.basic to the first position and that is “0”.

Selection Path Priority Status
————————————————————
* 0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
3 /usr/bin/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 15 manual mode
5 /usr/bin/vscodium 0 manual mode

You need to select the editor from here or you can just press enter to keep the current setting.

READ More Relevant Stuff:  How To Install Python Anaconda On Ubuntu 18.04 LTS [Updated]

Basic Vim Guide:

Vim has two modes and they are command mode and insert mode. You cannot write anything in command mode as you need to be in insert mode to write something on a file. You need to press the ‘i’ key to enter the insert mode.

Vim Basic Command:

Esc: Enter command mode

Ctrl + r: Redo changes

u: Undo changes

dd: Delete a line

yy: Copy a line

Esc + :w: Save the changes

Esc + :wq or Esc + ZZ: Save and quit Vim editor.

Esc + :q! : Force vim to quit discarding all changes

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *