|Bram Moolenaar and others
|November 2, 1991
( December 12, 2019 )
|Windows , Linux , macOS , Mac OS Classic , AmigaOS etc. v. m.
|C , Vimscript
|GPL compatible ( Charityware )
Vim ( Vi IMproved ) is a further development of the text editor vi . The free open source program was published in 1991 by Bram Moolenaar . The editor has been actively developed since then. Like vi, Vim is characterized by its various operating modes , while many other common editors only know a combined mode for input and commands, in which commands are executed via keyboard shortcuts and graphic interfaces.
Vim works like the vi editor in text mode on any terminal . Operation is then usually via the keyboard ; a mouse is supported on many terminals, but its use is limited. On the one hand, this is historically due to the screen terminals with a slow, serial connection to the main computer that were common in the early vi times in the mid-1970s , and on the other hand, experienced users appreciate the efficiency advantages of the powerful keyboard control ("vi is at your fingertips"). Its modal concept resulted from the limitation of the terminals at the time . Vim is almost completely downward compatible with vi, but has a large number of further developments and a modern graphical user interface with menus (GVim) as well as a simplified version for beginners (eVim).
Vim can be used on many operating systems and can be found on almost every GNU / Linux computer. Usually, when calling vi on Linux, Vim is called via a shortcut or an alias . Which vi offshoot was started can be checked in command mode using the command : version .
Historical digression on ed / vi
In the early 1970s was ed by Ken Thompson of Unix -Standardeditor. He worked line-oriented, i.e. H. The text was not displayed in multiple lines, as is customary today, but had to be instructed via explicit output commands (since the output was often not on a screen but on a teletype ). In order to be able to work with the limited possibilities of a line, it was necessary to use an edit and a command mode ( modal editor).
The ed commands usually consisted of a letter that could be preceded by a line area. When Bill Joy developed vi from 1976 onwards, this - as a visual editor - represented a significant advance compared to ed, as it represented changes to the edited text in the context of surrounding lines. Vi inherited the modal concept, the line orientation and the commands. These ed commands can be found in all current Vi- compatible editors, as well as in Vim.
Development of the Vim
At the end of the 1980s, Bram Moolenaar wanted to use the editor on an Amiga computer, which he knew and was used to from Unix. However, there was no vi for the Amiga back then. In 1988 he developed version 1.0 of Vim based on the vi clone Stevie . At the time, this was still called vi IMitation , as the main goal was initially to replicate the functionality of vi. On November 2, 1991, Vim version 1.14 was first published on the so-called Fred Fish disk # 591 , a collection of free software for the Amiga. Version 1.22 was ported to Unix and MS-DOS in 1992 . At that time, the long form of the abbreviation was changed to Vi IMproved . The capital letters are there to explain the acronym Vim: VIM is V i IM proved (improved, Engl. For improved).
In the years that followed, Vim saw major improvements. A milestone was the introduction of multiple editing windows in version 3.0 (1994) (Fig. 1). With vi you could edit several files with one call, but you could only see one file at a time and not several at the same time. With version 4.0, which appeared in 1996, a graphical user interface was also available for the first time, in which Robert Webb played a major role. Since 1998 Vim (version 5.0) has mastered syntax coloring (Fig. 2a).
As the last major step so far, code folding , plug-ins , support for multilingualism and vertically divided windows were introduced in version 6.0 in 2001 (Figs. 2 to 5). Version 6.4 (released in October 2005) fixes many bugs, but does not add any new functions. This was reserved for Version 7.0 in May 2006; it has built-in spell checker and supports tab (tabs). Version 7.3 was released in August 2010. The major innovations (in addition to all patches that have accumulated from version 7.2) included complete undo branches (multi-level undo has long been used by vim), Blowfish encryption, Lua - and Python-3 - Scriptability and the ability to hide texts. Version 7.4 was released in August 2013. New in this version is an improved RegEx - parser . The last version so far, Vim 8, was released on September 12, 2016. Among other things, it contains new features such as JSON support .
While several months often pass between small version jumps (for example from version 7.1 to version 7.2), Vim is still being continuously developed. The Vim user community contributes bug fixes or small improvements in the form of patches , which are then incorporated into the Vim code several times a month.
Overview: Selected properties and vi extensions
- integrated spell checker
- Word completion with drop down menu
- Arrangement of several files in tabs
- multiple buffer and split screens, multiple editing windows, also vertical
- Text formatting and visual mode , for example with block operations
- Unlimited Undo (undo) and Redo (restore) even if Vim was terminated in the meantime
- extensive online help
- Syntax highlighting depending on the programming language for around 500 languages and file types
- own script language for function expansion (analogous to plug-ins )
- Completion of commands, words or file names
- Editing of archives ( tar , gz / tgz , zip )
- Auto commands (e.g. decompression of zipped files before editing)
- File format detection and conversion
- History mechanism for commands, search terms, etc.
- Recording and execution of macros
- Save and load session settings
- optional integration of Perl , Python 2 and 3 , Lua , Ruby and Tcl
- Encryption with the Blowfish algorithm
- Support of bidirectional text (including Arabic)
- automatic and manual folding of text parts for a better overview
- easy addressing of debuggers, make programs and toolchains from the editor
- Interprocess communication and job control via sockets and pipes ("channels")
- Terminal integration
The performance of Vim is to be illustrated by some striking vi improvements.
Vim help function
Vim has extensive documentation. The user is supported by various functions in the search for solutions to his problem. With syntax highlighting and private aid syntax keywords are highlighted in color (Figure 1). In the picture these terms are shown in green and are enclosed in two vertical lines in the command line version. Keyboard shortcuts can be used to navigate forwards and backwards between these keywords, similar to a web browser . This works in the graphical user interface or, with appropriate support in the terminal, also with the mouse by double-clicking or right-clicking. There are other functions that make searching easier for the user. An important one of them is the helpgrep command. The user can search for a term in the entire help system, display the hits in another window and then switch from there to the corresponding points in the help system (Fig. 3). The hit list (Fig. 3 below) can be searched for further terms using the Vim search function. The help is supplemented by an HTML version of this help on the Internet, an extensive collection of frequently asked questions (FAQ) , literature in English and German and much more.
Support for programmers
Vim is an editor that, like vi, was written for programmers. This is why there is the option of adding edit-compile-fix (German: "Edit, Translate - Error Correction") functionality via plugins . Similar to an integrated development environment , the source text is edited and then translated directly from Vim using a compiler . If errors occurred during compilation, they will be displayed in another window. From the error message, you can jump directly to the other window to the incorrect point in the source text and correct it. Another cycle can then be started and further errors can be corrected if necessary. The programmer is supported by the functions syntax highlighting and text folding.
Another common task is comparing two versions of a file. Vim offers the option of displaying the differences between two file versions side by side in two windows and marking the differences in color (Fig. 4), the typical task of a merge program. Changed and inserted lines are highlighted in color and areas that are the same in both versions are hidden by folding text . In the example, changed positions are marked in red and inserted lines are marked blue and missing lines are marked light blue. Folded lines are highlighted in gray, indicating the number of lines that are unchanged.
Vim scripting language
Vim can be expanded and programmed using the Vimscript scripting language . This can be used to automate complex processes that would be too complicated for a macro . An example of a Vim script is the Vim start file under Unix and GNU / Linux or under Windows, DOS and OS / 2, in which mainly configuration settings are made. This is done automatically when Vim starts. In the Vim script language, all command line commands are available and via the command ': normal' also all normal mode commands. There are several types of data : floating point numbers, integers, strings, lists, and associative arrays. Boolean values are implemented using whole numbers, with a zero being interpreted as false and all other numbers as true . The most important operators for comparisons, logical operations and basic arithmetic operations are available. As control structures are the decision 'if - then - elseif - else - endif' and the while loop available. The user can define his own functions and use over one hundred predefined functions that essentially correspond to the Unix system calls . The scripts can be tested with a debug mode. Anyone planning to write a Vim script should check the Vim script page beforehand to see whether a script with the corresponding functionality already exists. Although there are many scripts there to support programming tasks, it is also worth taking a look at this page for non-programmers. Last but not least, any user who has solved a problem of general interest well can make his script available to others. The calendar script should serve as an example for a Vim script (Fig. 5).
Over the years some modifications have been developed for Vim, which should make the use of this editor easier for inexperienced users. The best known are the easy Vim mode integrated in Vim and the GUI GVim .
With GVim , Vim has a graphical interface available under most current operating systems, which makes many of the program's commands accessible via menu items and a toolbar, similar to today's graphical text editors. Similar to Vim, GVim can be comprehensively configured via its configuration files, and Vim scripts can also be integrated here. In contrast to Vim, however, more colors and fonts can be set for the display of text files and ready-to-use color schemes can be created and used.
eVim (short for easy Vim ) is a simple mode in which Vim can be operated. If Vim is started in this mode, the insert mode is immediately active; Commands can only be entered via a special command mode. This way, Vim can be used almost like a modeless editor.
With the GVim extension Cream , it is finally possible to use Vim completely in a way that is familiar to previous users of simple editors (such as gedit or Microsoft Notepad ). It is a series of scripts for the further simplification of GVim, so practically all important commands can be reached with the mouse via menus and the operating modes are completely omitted in the default version (but can be switched on at will). Cream is not integrated into Vim or GVim , but builds on both of them without replacing them. H. The simultaneous use of Cream and GVim is also possible without any problems.
Vim is a modal editor . This means that you work in different modes, which often causes problems for beginners. The six basic modes are only briefly explained here. For the first three modes see also vi: Working modes . There are five other modes, but for the sake of simplicity we will not go into them here. These are variants of the basic modes.
Vim starts in normal mode, often referred to as command or command mode. Here you can use keyboard shortcuts, for example, to copy and move lines or format text. This is the central mode , from which all other modes are switched. EscYou can always return to normal mode by pressing the button twice. If you are not sure whether you are already in normal mode, you can Escpress the button at any time . If you were already in normal mode, this is usually signaled with a beep, depending on the Vim configuration and terminal settings.
In insert mode, keystrokes change the edited text, just as you know it from other editors. This mode can be reached from normal mode, for example via i (for insert). There are a variety of other commands to get into this mode.
In insert mode (almost) all keyboard entries are included in the edited text, and only very few keys and combinations have a different effect. The most important thing is the Esckey to exit insert mode. The normal mode commands are then available again.
A less common, alternative view dispenses with viewing the insertion of text as a separate mode. According to this point of view, there are only a series of text change commands , which are immediately followed by an input which must be Escconcluded with . One advantage of this view is that there is never any doubt as to whether normal mode is currently selected, and the potential for command repetition is more likely to open up in this view.
Command line mode
This mode is the introductory colon : achieved. Complex commands such as search and replace can then be entered after the colon. After the final Enter , the command is executed and you are back in normal mode. This mode also includes the commands / (search text pattern forward) ,? (Search text pattern backwards) and the filter command ! , with which the UNIX commands (for example sort) can be called and applied to the text.
This mode is an improvement on Vim and is similar to normal mode. With the mouse or certain keyboard shortcuts, an area is marked line by line, character by character or block by block and highlighted visually. The commands for normal and command line mode can then be applied to this area. Working with this mode is easier than with normal mode because you can see exactly which area you are currently working on.
This mode is started from the visual mode by marking an area. Then you switch to Strg-G in the selection mode. If you now enter a printable character, the selected area is deleted and at the same time you switch to insert mode. This means that the selected area will be overwritten with the entered text. The selection mode is easier to reach using the key combination Shift key - arrow keys . However, Vim must be configured accordingly. This mode is terminated as usual with the Esckey. This mode is also a Vim extension.
This mode is similar to the command line mode, with the difference that after executing a command, there is no change back to normal mode. This mode comes from the UNIX ex line editor (like the traditional vi editor).
Vim can run on many operating systems. There are ports especially for Unix systems , for example for the UNIX or BSD derivatives AIX IRIX , HP-UX , macOS and iOS and free BSD distributions such as FreeBSD as well as for Linux-based systems including Android . Windows has been supported since 3.1, Vim 8 requires Windows XP and up. Ports are (or were) available for VMS , RISC OS , AmigaOS , Atari MiNT , Mac OS Classic , Haiku and BeOS , NeXTStep , OS / 2 .
Vim was the winner of the Readers 'Choice Awards in the Favorite Text Editor category from 2001 to 2005 and received the Slashdot Beanie Award for Best Open Source Text Editor in 2000 and the Linuxworld Editors' Choice Award in 1999 . In May 2008 Bram Moolenaar received the NLUUG Award , an award from the Dutch Unix User Group, for his work on Vim .
Vim is under a GPL -compatible charityware license (charity). This means that Vim can be freely distributed, but the developer asks if you like a donation for orphans in Uganda through the ICCF Holland.
Developer and Community
Vim is mainly developed by Bram Moolenaar and a community of many volunteers. The help page of the current version names over 60 contributors by name. There are a large number of unnamed helpers who not only take care of the further development of Vim, but also porting it to other operating systems, program tests and collecting bugs , completing the documentation and translating the help pages. They also take on answering user inquiries and integrating Vim into other projects.
On the other hand, as in the case of Emacs , a number of spin-offs arose over time , often with quite clear differences in motivation and goals, maintenance and further development as well as the attempt to maintain compatibility with Vim and its extensions and at the same time to differentiate themselves from one another . Neovim, which sees itself primarily as a further development and refactoring project and endeavors to slim down the editor by omitting legacy parts or functions that are seldom used today, has attracted greater attention .
While most command line programs can be terminated with Strg+ Cor Strg+ Q, the Vim user Eschas to enter a command in normal mode, which he may have to reach by pressing . This reads
:q!(exit and discard any changes without asking), although there are numerous others. How to quit Vim is one of the most viewed questions on the Stack Overflow software developer website . This question accounts for several percent of your traffic to Vim and around 0.005% of your total traffic .
- Drew Neil: Modern Vim: Craft Your Development Environment with Vim 8 and Neovim . Pragmatic Bookshelf, Raleigh, NC, USA 2018, ISBN 978-1-68050-262-6 .
- Drew Neil: Vim in Practice: Editing text in a flash . O'Reilly Verlag, Cologne 2014, ISBN 978-3-95561-578-9 .
- Steve Oualline: Vi IMproved - Vim . New Riders Publishing, Indianapolis 2001, ISBN 0-7357-1001-5 (English, truth.sk [PDF; 3.7 MB ]).
- Arnold Robbins, Linda Lamb, Elbert Hannah: Learning the vi and Vim Editors . O'Reilly Verlag, 2008, ISBN 978-0-596-52983-3 .
- Arnold Robbins: vi and Vim Editors Pocket Reference . 2nd Edition. O'Reilly Verlag, 2011, ISBN 978-1-4493-9217-8 .
- Reinhard Wobst: vim 7.3 GE-PACKT: vi improved . 4th edition. mitp-Verlag, 2012, ISBN 978-3-8266-8190-5 .
- Official website with download options, documentation, tutorials, scripts and links to communities and wikis (English)
- Seven habits for the effective editing of text files by Bram Moolenaar (PDF, approx. 140 kB)
- Learn Vimscript the Hard Way , online edition of Steve Losh's book
- Vim Awesome Directory for Vim plugins from various sources
- arstechnica.com .
- Release 8.2.0 . December 12, 2019 (accessed December 13, 2019).
- Vim 8.2 is available! . December 13, 2019 (accessed December 16, 2019).
- Bram Moolenaar: Vim 8.2 is released! . December 12, 2019 (accessed December 16, 2019).
- www.openhub.net . (accessed on July 21, 2018).
- Ryan Paul: Two decades of productivity: Vim's 20th anniversary. November 2, 2011, accessed December 8, 2011 .
- List of Vim patches for version 7.4
- Vim documentation
- ': help quickfix' in the Vim online documentation for version 7.0
- Vim Scripts on www.vim.org
- Calendar script for Vim
- eVim man page
- Cream on SourceForge
- ': help vim-modes' in the Vim online documentation for version 7.0
- Paul Bailey: Termux turns Android into a Linux development environment , opensource.com, accessed on August 28 of 2019.
- Linux Journal from December 2004
- Report on the NLUUG website (in Dutch)
- Internet the ICCF Holland
:help creditsin the documentation for version 8.1
- About Neovim , neovim.io/charter/, accessed August 30, 2018.
- David Robinson: Stack Overflow: Helping One Million Developers Exit Vim (May 23, 2017, accessed October 8, 2018)