At face value, Vim is regarded as an exceptional text editor. However, there is more to this supposed ‘text editor‘ when it comes to implementing some file management footprints.
Vim might not seem user-friendly in the eyes of a new Linux user but once you get a grip on its usage, there is no turning back. This article will walk us through the use of Vim as a file manager, but first, we will appreciate some unique features that classify it as a reputable text editor.
Some Notable Vim Features
It is worth mentioning the following unique features associated with Vim editor.
The following command ensures that you are never stuck while using Vim. Through its extensive online help system, users have access to the needed Vim-related resources.
Vim does not automatically enable all its features. It is up to the user to turn on the feature that fits their text editing need. To turn on and explore these features, you first need to create the $HOME/.vimrc file.
$ nano $HOME/.vimrc
If you need the split the current window you are working on into two, implement the vim command:
Afterward, the command
Ctrl-w k can be used to move the cursor down a window and
Ctrl-w j can be used to move the cursor up a window.
Supposing the below Vim command is executed while working on another file, the Vim window will split to enable the editing of another referenced file.
To quit a window, we will use the usual Vim command:
If you have a Makefile of a program you are working on, you can compile it under Vim with the command:
To fix an error on your program file, navigate to the erroneous line(s) with the vim command:
To preview the current error message:
When keying in a partial phrase in Vim, use
^P for previous match word completion and
^N for next matching word completion.
Install Vim Editor in Linux
The vim installation guide on various Linux operation system distributions is as follows:
$ sudo apt install vim [On Debian, Ubuntu and Mint] $ sudo yum install vim [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a app-editors/vim [On Gentoo Linux] $ sudo pacman -S vim [On Arch Linux] $ sudo zypper install vim [On OpenSUSE]
Using Vim to Browse/Explore Directories
First, launch Vim on your Linux operating system.
The next step is to access the file explorer window, this can be done by executing the following vim command:
Hit [Enter] on your keyboard to explore Linux files and directories as shown:
From here, you can use the search panel or the keyboard arrow key to navigate to the targeted file.
Vim also provides Quick Help shortcut keys (as per the following screen capture) to help with the usage of file explorer.
Vim’s file exploration features make it easy to access different files from the terminal window instead of using the traditional approach:
$ vim file_to_open.txt
For more vim tips, read the following articles: