Vim (Vi IMproved) is an enhanced version of the text editor vi available on all UNIX systems.
What is Vim?
Its author, Bram Moolenaar, introduced its first version in 1991, making many improvements since then. The main feature of both Vim and Vi is that they have different modes that they change to perform certain operations, making them different from the most common editors that have a single mode in which directives are entered with key combinations or graphic interfaces.
Vim is used from a text-mode terminal like its predecessor vi. It is fully controlled by the keyboard. This is because Vi was developed in the mid-1970s because the terminals communicated with a host over a not too fast (20 Kbps) serial connection. The limitations of time terminals have led to different ways of concept, an idea that has been very profitable up to that time.
Vim is almost 100% compatible with vi, but although it has many improvements, it has a simplified version that acts like a graphic interface and menus-editable versions and an editor without different modes.
Vim versions are available for many operating systems and can be found on almost all GNU/Linux systems and all BSD systems where it can be run with the vi command, which calls Vim with a symbolic link or alias. When Vim starts, it does it in command mode and displays the version on the screen.
When Bram Moolenar purchased an Amiga computer in the late 1980s, he wanted to continue using the Unix editor he was used to, but vi clones that Amiga could use did not convince him. So in 1988, to start developing Vim, vi clone started from Stevie 1.0.
At first, vi was called IMitation (vi imitation) because initially, its main purpose was to imitate the functions available in the new system of vi. Version 1.14 appeared in the free software collection “Fred Fish disk # 591” for Amiga in 1991. Version 1.22 is the first release with Unix and MS-DOS versions. The abbreviation that gave its name to that time was changed to Vi IMproved.
In the years that followed, Vim made great progress. An important step was taken to include windows in version 3.0 (1994). You can open several files in the same session as Vi, but you can only see one at a time; Vim allows you to view windows simultaneously.
Since version 4.0 (1996), a graphical user interface (GUI) has been available that Robert Webb started developing. Since version 5.0 (1998), Vim has syntax highlighting.
Integrated spell checker.
Multiple windows that divide the editing area horizontally or vertically.
Highlighting syntax depending on a programming language or tags used.
Retrieves and repeats directives.
Understanding more than 200 different syntaxes.
Scripting language to program extensions.
Commands are completed with words and filenames.
File compression and decompression making it possible to edit compressed files.
Recognizing file formats and converting between them.
History of the directives enforced.
Macro recording and playback.
Saves the settings between sessions.
Automatic and manual code folding.
Optional graphic interface.
It is highly configurable and customizable.
It is almost 100% compatible with Vi.
Vim has excellent documentation managed by the maxim, an undocumented feature that is useless. Documents in text form are very comprehensive and easy to understand.
The user accesses the description of various functions that can solve their problems through a search. Keywords are highlighted, highlighting the syntax of Vim’s help. When the cursor is over a keyword, you can navigate through the help using key combinations and return if necessary.
In the graphic version, you can also use the mouse for this purpose. The helpgrep command is important because it allows the user to search for a word in help texts without the need for a keyword. Help is complemented by a version of HTML available for online consultation and a comprehensive list of frequently asked questions (FAQs).
Vim is an editor made by programmers for programmers. To facilitate programming, Vim has an “edit, compile, correct” mode. As with integrated development environments, you can edit the source code, call an external compiler, and interpret the results. If there are compilation errors, they are displayed in a window.
Error messages direct the user to the region where they can be corrected. Then the “edit, compile, fix” and, if necessary, a new correction cycle starts again. The developer’s job is also facilitated by the function of syntax highlighting and code folding.
Comparing two (or more) versions of a file is common for some users. Vim offers a simple solution, two different versions of the file are shown in two adjacent windows, where differences are highlighted. In this way, the differences between the versions can be seen in color. For example, deletions appear in red, and new attachments appear in purple.
In addition to converting these differences to another file, there are commands that allow you to place the cursor over the following and previous differences.
Vim has an interpreted language or script to program new functions where you can automate certain processes that are too complex to be performed with a macro. Scripts can be read and interpreted using the source command.
Vim is a permanent editor, so you can work in different modes to perform a specific task. The showmode option must be enabled to see which mode the Vim is in.
The six Vim modes are described below. The first three are the original vi modes. The five additional modes should not be understood separately but should be understood together with the basic mode. Also see Vim’s help on this topic: help vim-modes.
Vim starts in command mode, also known as normal mode. In this mode, you can use key combinations to copy lines and work in text format. This is the central mode where you switch to other modes. If you don’t know what you are doing, you can always return to normal mode by pressing the Escape key twice. If it is already in normal mode and allows both Vim and terminal settings, Vim will beep.
When the keys are pressed in insert mode, the text is edited just like any other editor. You can switch from command mode to insert mode by pressing the “i” key.
For example, at the end of the line, there are a wide variety of commands to switch to the insert mode, which is greatly different, because they allow editing at a certain point in the text, that is, by deleting a word. A skilled user can greatly benefit from the presence of such various orders.
In addition mode, all keys have some functions that are activated by simply pressing the Control key or Shift keys at the same time as well as adding them. The Esc key is very important in insert mode because it allows you to switch from insert mode to command mode.
Switching to command mode to perform certain tasks greatly improves editing efficiency and you can take full advantage of Vim’s power.
Command Line Mode
This mode is accessed by pressing the colon (:) repeatedly. After the colon, you can enter complex commands, such as search and replace with regular expressions. You can return to command mode by pressing the Esc button.
This mode is a mod developed over vi. You can mark a text field (a group of lines or a block) by using certain key combinations with the cursor movement keys. Once the text is marked, you can use the command mode’s commands to change it. Operations that can be performed in this mode are simpler than operations in command mode.
This mode starts as a visual mode because you have to choose a block of text. After selection, you can switch to selection mode using the Control-G button. In the mode, if a printable key is pressed, the selected text is deleted, the selection mode ends and the symbol corresponding to the key pressed appears.
The selection can be expanded by pressing the shift and arrow keys, the usual behavior in Microsoft Windows programs. This mode can be terminated by pressing the Escape key.
This mode is similar to command line mode, but it does not return to command mode after an order is executed. This mode is entered by pressing the Q button and ends with vi. In this mode, Vim simulates the old UNIX software, which changes text line by line rather than editing the entire page due to time limitations.
gVim is the graphic version of the Vim software. Works with gVim gtk libraries. It preserves the functions of Vim and adds menus and a graphical environment.
Its main advantage includes drop-down menus for new users, a little less difficult learning curve. Its main disadvantage is that it is not installed on all systems by default.
One virtue of Vim is that it can be run on many operating systems. This is important for users like system administrators who need to work on many different platforms.
It can be run on the following operating systems: AmigaOS, Atari MiNT, BeOS, DOS, GNU / Linux, Mac OS, NextStep, OS/2, OSF, RISC OS, IRIX, Unix (BSD, AIX and HP-UX), VMS and Windows 3. x/95/98/ME/2000/NT/XP.
Advantages of Use
Most users claim that this editor increases productivity when compared to simpler editors when it overcomes the learning curve. Key combinations can be memorized using reminder methods as they relate to English words.
The unique complexity of the learning instructions is rewarded with increased efficiency. Expert users can copy, format, or sort the text in many different ways, using a few shortcuts, which can only be done with much more complex operations in many editors.
Some experience is sufficient to realize that combinations of instructions that allow complex text editing with Vim are facilitated. On the other hand, new versions allow you to use the mouse and add graphic menus that make it easier to work with Vim and other editors. Due to its small size and speed on UNIX-based platforms with limited resources, it is often installed as a basic editor.
Vim won the Linux Journal Readers’ Choice Awards in the Favorite Text Editor category from 2001-2005 and received the Slashdot Bernie Award for the Best Open Source Text Editor and the 1999 Linuxworld Editor’s Choice Award.
Vim is distributed under a Charityware license that is compatible with the GNU General Public License. This means that Vim is subject to the same conditions, but users are encouraged to donate to orphan children in Uganda through the ICCF Holland organization.
It was developed by Vim, Bram Moolenaar, and many volunteers. There are more than 50 participants on the Vim help page of the current version.
In addition, there are a large number of people who help not only develop the software but also move it to other operating systems, test new versions, report bugs, write documents and translate the help system. They also adapt Vim to other projects and many other things, answering user questions.
All users can contribute by writing scripts or giving advice. There is a very active mailing list with useful, fast, and competent responses for both new and experienced users.