Vim (text editor)
   HOME

TheInfoList



OR:

Vim (;
"Vim is pronounced as one word, like Jim, not vi-ai-em. It's written with a capital, since it's a name, again like Jim."
a contraction of ''Vi IMproved'') is a free and open-source,
screen-based text editor A text editor is a type of computer program that edits plain text. Such programs are sometimes known as "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be us ...
program. It is an improved clone of Bill Joy's vi. Vim's author,
Bram Moolenaar Bram Moolenaar (born 1961, Lisse) is a Dutch computer programmer and an active member of the open-source software community. He is the original author, maintainer, release manager, and benevolent dictator for life of Vim, a vi-derivative tex ...
, derived Vim from a port of the Stevie editor for Amiga and released a version to the public in 1991. Vim is designed for use both from a
command-line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
and as a standalone application in a
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, ins ...
. Since its release for the Amiga,
cross-platform In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software ...
development has made it available on many other systems. In 2006, it was voted the most popular editor amongst '' Linux Journal'' readers; in 2015 the Stack Overflow developer survey found it to be the third most popular text editor, and in 2019 the fifth most popular development environment.


History

Vim's forerunner, Stevie (ST Editor for VI Enthusiasts), was created by Tim Thompson for the Atari ST in 1987 and further developed by Tony Andrews and G.R. (Fred) Walter. Basing his work on Stevie,
Bram Moolenaar Bram Moolenaar (born 1961, Lisse) is a Dutch computer programmer and an active member of the open-source software community. He is the original author, maintainer, release manager, and benevolent dictator for life of Vim, a vi-derivative tex ...
began working on Vim for the Amiga computer in 1988, with the first public release (Vim v1.14) in 1991. At the time of its first release, the name "Vim" was an acronym for "Vi IMitation", but this changed to "'Vi IMproved" late in 1993.


License

Vim is released under the Vim license, which includes some
charityware Careware (also called charityware, helpware, or goodware) is software licensed in a way that benefits a charity. Some careware is distributed free, and the author suggests that some payment be made to either a nominated charity, or a charity of t ...
clauses that encourage users who enjoy the software to consider donating to children in
Uganda }), is a landlocked country in East Africa. The country is bordered to the east by Kenya, to the north by South Sudan, to the west by the Democratic Republic of the Congo, to the south-west by Rwanda, and to the south by Tanzania. The ...
. The Vim license is compatible with the
GNU General Public License The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the four freedoms to run, study, share, and modify the software. The license was the first copyleft for general ...
through a special clause allowing distribution of modified copies under the GNU GPL version 2.0 or later.


Interface

Like vi, Vim's interface is not based on menus or icons but on commands given in a text user interface; its
GUI The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
mode, gVim, adds menus and toolbars for commonly used commands but the full functionality is still expressed through its command line mode. Vi (and by extension Vim) tends to allow a typist to keep their fingers on the
home row Touch typing (also called blind typing, or touch keyboarding) is a style of typing. Although the phrase refers to typing without using the sense of sight to find the keys—specifically, a touch typist will know their location on the keyboard th ...
, which can be an advantage for a touch typist. Vim has a built-in tutorial for beginners called vimtutor which is usually installed along with Vim, but is a separate executable and can be run with a shell command. The Vim Users' Manual details Vim's features and can be read from within Vim, or found online. Vim also has a built-in help facility (using the :help command) that allows users to query and navigate through commands and features.


Modes

Vim has 12 different editing modes, 6 of which are variants of the 6 basic modes. The most important modes are: * Normal mode – used for editor commands. This is also the default mode, unless the insertmode option is specified. * Visual mode – similar to normal mode, but used to highlight areas of text. Normal commands can be run on the highlighted area, for instance to move or edit a selection. * Insert mode – similar to editing in most modern editors. In this mode, buffers can be modified with the text inserted. * Command-line or Cmdline mode – supports a single line input at the bottom of the Vim window. Normal commands (beginning with :), and some other keys for specific actions (including pattern search and the filter command) activate this mode. On completion of the command, Vim returns to the previous mode.


Customization

Vim is highly customizable and extensible, making it an attractive tool for users who demand a large amount of control and flexibility over their text editing environment. Text input is facilitated by a variety of features designed to increase keyboard efficiency. Users can execute complex commands with "key mappings," which can be customized and extended. The "recording" feature allows for the creation of macros to automate sequences of keystrokes and call internal or user-defined functions and mappings. Abbreviations, similar to macros and key mappings, facilitate the expansion of short strings of text into longer ones and can also be used to correct mistakes. Vim also features an "easy" mode for users looking for a simpler text editing solution. There are many plugins available that extend or add new functionality to Vim. These plugins are usually written in Vim's internal scripting language, vimscript (also known as VimL), but can be written in other languages as well. There are projects bundling together complex scripts and customizations and aimed at turning Vim into a tool for a specific task or adding a major flavour to its behaviour. Examples include
Cream Cream is a dairy product composed of the higher-fat layer skimmed from the top of milk before homogenization. In un-homogenized milk, the fat, which is less dense, eventually rises to the top. In the industrial production of cream, this process ...
, which makes Vim behave like a click-and-type editor, or VimOutliner, which provides a comfortable outliner for users of Unix-like systems.


Features and improvements over vi

Vim has a vi compatibility mode, but when that mode is not used, Vim has many enhancements over vi.Vim help system (type ":help
/code>" within Vim)
However, even in compatibility mode, Vim is not entirely compatible with vi as defined in the Single Unix Specification and
POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming in ...
(e.g., Vim does not support vi's open mode, only visual mode). Vim's developers state that it is "very much compatible with Vi". (question 1.3) Some of Vim's enhancements include completion functions, comparison and merging of files (known as vimdiff), a comprehensive integrated help system, extended regular expressions,
scripting language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
s (both native and through alternative scripting interpreters such as Perl, Python, Ruby, Tcl, etc.) including support for plugins, a
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, ins ...
(gvim), limited
integrated development environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools ...
-like features, mouse interaction (both with and without the GUI), folding, editing of compressed or archived files in gzip, bzip2, zip, and tar format and files over network protocols such as SSH, FTP, and
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide We ...
, session state preservation, spell checking, split (horizontal and vertical) and tabbed windows,
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. The standard, ...
and other multi-language support, syntax highlighting, trans-session command, search and cursor position
histories Histories or, in Latin, Historiae may refer to: * the plural of history * ''Histories'' (Herodotus), by Herodotus * ''The Histories'', by Timaeus * ''The Histories'' (Polybius), by Polybius * ''Histories'' by Gaius Sallustius Crispus (Sallust), ...
, multiple level and branching undo/redo history which can persist across editing sessions, and visual mode. While running, Vim saves the user's changes in a swap file with the ".swp"
extension Extension, extend or extended may refer to: Mathematics Logic or set theory * Axiom of extensionality * Extensible cardinal * Extension (model theory) * Extension (predicate logic), the set of tuples of values that satisfy the predicate * Ext ...
. This file can be used to recover after a crash. If a user tries to open a file and a swap file already exists, Vim will warn the user, and if the user proceeds, Vim will use a swap file with the extension ".swo" (or, if there is already more than one swap file, ".swn", ".swm", etc.). This feature can be disabled.


Vim script

Vim script (also called Vimscript or VimL) is the
scripting language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
built into Vim. Based on the ex editor language of the original vi editor, early versions of Vim added commands for control flow and function definitions. Since version 7, Vim script also supports more advanced data types such as
lists A ''list'' is any set of items in a row. List or lists may also refer to: People * List (surname) Organizations * List College, an undergraduate division of the Jewish Theological Seminary of America * SC Germania List, German rugby union ...
and dictionaries and a simple form of
object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
. Built-in functions such as map() and filter() allow a basic form of
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions tha ...
, and Vim script has
lambda Lambda (}, ''lám(b)da'') is the 11th letter of the Greek alphabet, representing the voiced alveolar lateral approximant . In the system of Greek numerals, lambda has a value of 30. Lambda is derived from the Phoenician Lamed . Lambda gave ri ...
since version 8.0. Vim script is mostly written in an imperative programming style. Vim macros can contain a sequence of ''normal-mode'' commands, but can also invoke ex commands or functions written in Vim script for more complex tasks. Almost all extensions (called plugins or more commonly scripts) of the core Vim functionality are written in Vim script, but plugins can also utilize other languages like
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offic ...
, Python, Lua,
Ruby A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called ...
, Tcl, or Racket. These plugins can be installed manually, or through a plugin manager such as Vundle, Pathogen, or Vim-Plug. Vim script files are stored as plain text, similarly to other code, and the filename extension is usually .vim. One notable exception to that is Vim's config file, .vimrc.


Examples

" This is the Hello World program in Vim script. echo "Hello, world!" " This is a simple while loop in Vim script. let i = 1 while i < 5 echo "count is" i let i += 1 endwhile unlet i


Availability

Whereas vi was originally available only on
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, ...
operating systems, Vim has been ported to many operating systems including AmigaOS (the initial target platform), Atari
MiNT MiNT is Now TOS (MiNT) is a free software alternative operating system kernel for the Atari ST system and its successors. It is a multi-tasking alternative to TOS and MagiC. Together with the free system components fVDI device drivers, XaAE ...
,
BeOS BeOS is an operating system for personal computers first developed by Be Inc. in 1990. It was first written to run on BeBox hardware. BeOS was positioned as a multimedia platform that could be used by a substantial population of desktop users an ...
, DOS,
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
starting from
Windows NT 3.1 Windows NT 3.1 is the first major release of the Windows NT operating system developed by Microsoft, released on July 27, 1993. At the time of Windows NT's release, Microsoft's Windows 3.1 desktop environment had established brand recognit ...
, OS/2,
OS/390 OS/390 is an IBM operating system for the System/390 IBM mainframe computers. Overview OS/390 was introduced in late 1995 in an effort to simplify the packaging and ordering for the key, entitled elements needed to complete a fully functiona ...
, MorphOS, OpenVMS, QNX, RISC OS,
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
, BSD, and Classic Mac OS. Also, Vim is shipped with
Apple An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ancest ...
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
. Independent ports of Vim are available for Android and iOS.


Neovim

Neovim is a fork of Vim that strives to improve the extensibility and maintainability of Vim. Some features of the fork include built-in Language Server Protocol support, support for
asynchronous I/O In computer science, asynchronous I/O (also non-sequential I/O) is a form of input/output processing that permits other processing to continue before the transmission has finished. A name used for asynchronous I/O in the Windows API is overlapp ...
, and support for scripting using Lua. Neovim has the same configuration syntax as Vim (unless vim9script is used); thus the same configuration file can be used with both editors, although there are minor differences in details of options. If the added features of Neovim are not used, Neovim is compatible with almost all of Vim's features. The Neovim project was started in 2014, with some Vim community members offering early support of the high-level refactoring effort to provide better scripting, plugins, and integration with modern
GUI The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
s. The project is
free software Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, n ...
and its source code is available on
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, cont ...
. Neovim had a successful fundraising in March 2014, supporting at least one full-time developer. Several frontends are under development, making use of Neovim's capabilities. The Neovim editor is available in an Ubuntu Personal Package Archive, hosted by Canonical and some more conventional package managers, making it possible to install it on a variety of operating systems. On October 27, 2021,
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, cont ...
released a GitHub Copilot (a cloud-based
artificial intelligence Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech ...
tool for autocompleting code) plugin for Neovim as a public repository.


See also

* ''
Learning the vi and Vim Editors ''Learning the vi and Vim Editors'' is a tutorial book for the vi and vim text editors written by Arnold Robbins, Elbert Hannah, and Linda Lamb and published by O'Reilly Media. The book is in its 8th edition. The book features a tarsier on the ...
'', a tutorial book for vi and vim, published by O'Reilly Media * Editor war – the rivalry between users of the Emacs and vi (Vim) text editors * List of text editors * Comparison of text editors * Vimperator


References


External links

* * {{Authority control 1991 software Amiga software BeOS text editors Classic Mac OS text editors Computer science in the Netherlands Cross-platform free software DOS text editors Free file comparison tools Free software programmed in C Free text editors Information technology in the Netherlands Linux text editors MacOS text editors MorphOS software OpenVMS text editors OS/2 text editors Termcap Unix text editors Vi Windows text editors Text editors that use GTK Free HTML editors Linux integrated development environments Hex editors Free integrated development environments Free integrated development environments for Python Free and open-source software Command-line software Console applications