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." ''vi improved'') is a
free and open-source
Free and open-source software (FOSS) is software available under a Software license, license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term ...
,
screen-based text editor
A text editor is a type of computer program that edits plain text. An example of such program is "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be used to c ...
program. It is an improved
clone of
Bill Joy
William Nelson Joy (born November 8, 1954) is an American computer engineer and venture capitalist. He co-founded Sun Microsystems in 1982 along with Scott McNealy, Vinod Khosla, and Andy Bechtolsheim, and served as Chief Scientist and CTO ...
's
vi. Vim's author,
Bram Moolenaar, derived Vim from a port of the
Stevie editor for
Amiga
Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
and released a version to the public in 1991. Vim is designed for use both from a
command-line interface
A command-line interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
and as a standalone application in a
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
.
Since its release for the Amiga,
cross-platform
Within 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 platform, computing platforms. Some ...
development has made it available on
many other systems. In 2018, it was voted the most popular editor amongst ''
Linux Journal
''Linux Journal'' (''LJ'') is an American monthly technology magazine originally published by Specialized System Consultants, Inc. (SSC) in Seattle, Washington since 1994. In December 2006 the publisher changed to Belltown Media, Inc. in Hous ...
'' readers; in 2015 the
Stack Overflow
In software, a stack overflow occurs if the call stack pointer exceeds the stack bound. The call stack may consist of a limited amount of address space, often determined at the start of the program. The size of the call stack depends on many fa ...
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
Atari ST is a line of personal computers from Atari Corporation and the successor to the company's Atari 8-bit computers, 8-bit computers. The initial model, the Atari 520ST, had limited release in April–June 1985, and was widely available i ...
in 1987
and further developed by Tony Andrews
and G.R. (Fred) Walter. It was one of the first popularized clones of Vi, and did not use Vi's source code. The source code for Vi used the Ed text editor developed under AT&T, and therefore Vi could only be used by those with an AT&T source license. Basing Vim on the source code for Stevie meant the program could be distributed without requiring the AT&T source license.
Basing his work on Stevie, Bram Moolenaar began working on Vim for the Amiga
Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
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.
Release history
License
Vim is released under the Vim license
A license (American English) or licence (Commonwealth English) is an official permission or permit to do, use, or own something (as well as the document of that permission or permit).
A license is granted by a party (licensor) to another part ...
, which includes some charityware clauses that encourage users who enjoy the software to consider donating to children in Uganda
Uganda, officially the Republic of Uganda, is a landlocked country in East Africa. It 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 ...
. The Vim license is compatible with the GNU General Public License
The GNU General Public Licenses (GNU GPL or simply GPL) are a series of widely used free software licenses, or ''copyleft'' licenses, that guarantee end users the freedom to run, study, share, or modify the software. The GPL was the first ...
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
An icon () is a religious work of art, most commonly a painting, in the cultures of the Eastern Orthodox, Oriental Orthodox, Catholic, and Lutheran churches. The most common subjects include Jesus, Mary, saints, and angels. Although especially ...
but on commands given in a text user interface
In computing, text-based user interfaces (TUI) (alternately terminal user interfaces, to reflect a dependence upon the properties of computer terminals and not just text), is a retronym describing a type of user interface (UI) common as an ear ...
; its GUI mode, gVim, adds menus and toolbars for commonly used commands but the full functionality is still expressed through its command line
A command-line interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
mode. Vi (and by extension Vim) tends to allow a typist to keep their fingers on the home row, which can be an advantage for a touch typist.
Vim has a built-in tutorial
In education, a tutorial is a method of transferring knowledge and may be used as a part of a learning process. More interactive and specific than a book or a lecture, a tutorial seeks to teach by example and supply the information to complete ...
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) which allows users to query and navigate through commands and features.
Registers
Vim features various special memory entries called registers (not to be confused with hardware or processor register
A processor register is a quickly accessible location available to a computer's processor. Registers usually consist of a small amount of fast storage, although some registers have specific hardware functions, and may be read-only or write-onl ...
s). When cutting, deleting, copying, or pasting text the user can choose to store the manipulated text in a register. There are 36 general-purpose registers associated with letters and numbers ( -z0-9 and a range of special ones that either contain special values (current filename, last command, etc.) or serve a special purpose.
Modes
Like vi, vim supports multiple editing modes. Depending on the mode, typed characters are interpreted either as sequences of commands or are inserted as text. In Vim there are 14 editing modes, 7 basic modes and 7 variants:
* Normal mode – used for editor commands. This is generally the default mode and by default hitting returns the editor to this mode.
* Insert mode – used for typing text in a way similar to most modern editors. In this mode, opened text in buffers can be modified with the text entered from the keyboard.
* Visual mode – used to select areas of text. Commands can be run on the selected area – moving, editing, filtering via built-in or external command, etc.
** Visual linewise, a subtype of visual mode which selects one or more whole lines
** Visual blockwise, another subtype which selects a rectangular block of text across one or more lines
* Select mode – similar to visual, but the commands are not interpreted, instead, highlighted text is directly replaced by input from the keyboard; similar to the selection mode used in editors on Microsoft Windows platforms
* Command-line or Cmdline mode – provides a single line input at the bottom of the Vim window. 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.
* Ex mode – accepts a sequence of commands.
* Terminal-Job mode - Interacting with a job in a terminal window.
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 bindings," 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, which makes Vim behave like a click-and-type editor, or VimOutliner, which provides a comfortable outliner
An outliner (or outline processor) is a specialized type of text editor (word processor) used to create and edit Outline (list), outlines, which are text files which have a tree structure or a tree view, for organization. Textual information is co ...
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
The Single UNIX Specification (SUS) is a standard for computer operating systems, compliance with which is required to qualify for using the "UNIX" trademark. The standard specifies programming interfaces for the C language, a command-line shell, ...
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 application programming interfaces (APIs), along with comm ...
(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
Comparison or comparing is the act of evaluating two or more things by determining the relevant, comparable characteristics of each thing, and then determining which characteristics of each are similar to the other, which are different, and t ...
and merging of files (known as vimdiff), a comprehensive integrated help system, extended regular expression
A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
s, scripting language
In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
s (both native and through alternative scripting interpreters such as Perl, Python, Ruby, Tcl, etc.) including support for plugins, a graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
(gvim), limited integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
-like features, mouse
A mouse (: mice) is a small rodent. Characteristically, mice are known to have a pointed snout, small rounded ears, a body-length scaly tail, and a high breeding rate. The best known mouse species is the common house mouse (''Mus musculus'' ...
interaction (both with and without the GUI), folding, editing of compressed or archived files in gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and ...
, bzip2
bzip2 is a free and open-source file compression program that uses the Burrows–Wheeler algorithm. It only compresses single files and is not a file archiver. It relies on separate external utilities such as tar for tasks such as handli ...
, zip, and tar format and files over network protocols such as SSH, FTP
The File Transfer Protocol (FTP) is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. FTP is built on a client–server model architecture using separate control and dat ...
, and HTTP
HTTP (Hypertext Transfer Protocol) 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 Web, wher ...
, session state preservation, spell checking, split (horizontal and vertical) and tabbed windows, Unicode
Unicode or ''The Unicode Standard'' or TUS is a character encoding standard maintained by the Unicode Consortium designed to support the use of text in all of the world's writing systems that can be digitized. Version 16.0 defines 154,998 Char ...
and other multi-language support, syntax highlighting
Syntax highlighting is a feature of text editors that is used for programming language, programming, scripting language, scripting, or markup language, markup languages, such as HTML. The feature displays text, especially source code, in differe ...
, trans-session command, search and cursor position histories, 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. 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.). The feature can be disabled.
Vim script
Vim script (also called Vimscript or VimL) is the scripting language
In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
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 and dictionaries
A dictionary is a listing of lexemes from the lexicon of one or more specific languages, often arranged Alphabetical order, alphabetically (or by Semitic root, consonantal root for Semitic languages or radical-and-stroke sorting, radical an ...
and a simple form of object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impl ...
. 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 Function application, applying and Function composition (computer science), composing Function (computer science), functions. It is a declarat ...
, and Vim script has lambda
Lambda (; uppercase , lowercase ; , ''lám(b)da'') is the eleventh 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 Phoen ...
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 high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
, Python, Lua, Ruby
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 sapph ...
, 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
While vi was originally available only on Unix
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user 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, a ...
operating systems, Vim has been ported to many operating systems including AmigaOS
AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
(the initial target platform), Atari
Atari () is a brand name that has been owned by several entities since its inception in 1972. It is currently owned by French holding company Atari SA (formerly Infogrames) and its focus is on "video games, consumer hardware, licensing and bl ...
MiNT, BeOS, DOS, Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
starting from Windows NT 3.1, OS/2
OS/2 is a Proprietary software, proprietary computer operating system for x86 and PowerPC based personal computers. It was created and initially developed jointly by IBM and Microsoft, under the leadership of IBM software designer Ed Iacobucci, ...
, OS/390, MorphOS
MorphOS is an AmigaOS-like operating system designed for Power and PowerPC based computers. The core, based on the Quark microkernel, is proprietary, although several libraries and other parts are open source, such as the Ambient desktop.
The p ...
, OpenVMS
OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Op ...
, QNX, RISC OS
RISC OS () is an operating system designed to run on ARM architecture, ARM computers. Originally designed in 1987 by Acorn Computers of England, it was made for use in its new line of ARM-based Acorn Archimedes, Archimedes personal computers an ...
, Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
, BSD
The Berkeley Software Distribution (BSD), also known as Berkeley Unix or BSD Unix, is a discontinued Unix operating system developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berkeley, beginni ...
, and Classic Mac OS
Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Mac (computer), Macintosh family of personal computers by Apple Computer, Inc. from 1984 to 2001, starting with System 1 and end ...
. Also, Vim is shipped with Apple
An apple is a round, edible fruit produced by an apple tree (''Malus'' spp.). Fruit trees of the orchard or domestic apple (''Malus domestica''), the most widely grown in the genus, are agriculture, cultivated worldwide. The tree originated ...
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
.
Independent ports of Vim are available for Android and iOS
Ios, Io or Nio (, ; ; locally Nios, Νιός) is a Greek island in the Cyclades group in the Aegean Sea. Ios is a hilly island with cliffs down to the sea on most sides. It is situated halfway between Naxos and Santorini. It is about long an ...
.
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 (LSP) 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 I/O operation has finished. A name used for asynchronous I/O in the Windows API is '' over ...
by using the C library libuv, and for Lua scripting by using luaJIT language interpreter, allowing both plugin scripting and running scripts in headless / batch mode. The project is free software
Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
and its source code
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
is available on GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
.
Neovim has the same configuration syntax as Vim prior to vim9script; thus the same configuration file
A configuration file, a.k.a. config file, is a computer file, file that stores computer data, data used to configure a software system such as an application software, application, a server (computing), server or an operating system.
Some applic ...
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, after a patch to Vim supporting multi-threading was rejected. Neovim had a successful fundraising in March 2014, supporting at least one full-time developer.
Several frontends are under development which make use of Neovim's capabilities.
With the 0.5 release of Neovim on 2 July 2021, it gained built-in support for the LSP, Tree-sitter, and more complete Lua support – including the support for configuration scripts written in Lua instead of VimL.
Gallery
File:Neovim being used to edit its own configuration file.png, Neovim featuring configured statusbar and dark colorscheme.
File:Neovim v0.9.0-dev-a0a1125 Material Theme.png, Tweaked v0.9.0-dev version.
See also
* '' Learning the vi and Vim Editors'', a tutorial book for vi and vim, published by O'Reilly Media
* Editor war – the rivalry between users of the Emacs
Emacs (), originally named EMACS (an acronym for "Editor Macros"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
and vi (Vim) text editors
* List of text editors
* Comparison of text editors
* Vimperator
Notes
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