Vim is a text editor that allows to create and modify text files via command line. Vim is an improved version of the old Unix Vi text editor. Vim provides syntax highlighting, unlimited undo, macros and other features.
This tutorial demonstrates how to install Vim on Raspberry Pi.
Use SSH to connect to Raspberry Pi. Update the package lists and install Vim using these commands:
sudo apt update
sudo apt install -y vim
Once the installation is completed, we can check version of the Vim:
vim --version
To create a new file or edit an existing file, type vim
command followed by filename:
vim test.txt
If you don't have required permissions then execute the command as superuser.
sudo vim /var/log/daemon.log
File is opened in read-only mode. To start editing the file we need to switch to insertion mode. To do that press the letter i
. When finished editing the file, we need to exit the insertion mode. Press the ESC
key to do that. To save the file and exit Vim, type :wq
command and press the Enter
key. To exit without saving, type :q!
command.
If you decided to completely uninstall Vim and related dependencies, run the following command:
sudo apt purge --autoremove -y vim
Leave a Comment
Cancel reply