Top Qs
Timeline
Chat
Perspective
Vim (text editor)
Improved version of the vi text editor From Wikipedia, the free encyclopedia
Remove ads
Vim (/vɪm/ ⓘ;[5] short for vi improved) is a free and open-source text editor; self-described as an improved vi and built from a distinct codebase so that its use is not constrained by the legal limitations that apply to the original vi. Vim provides both a terminal screen user interface (like vi) as well as a graphical user interface (called gvim).[6]
In release information, the author originally implied that Vim was an abbreviation for "Vi IMitation", but later (either with v2 in 1993 or v3 in 1994), the expansion was changed to "Vi IMproved".[7]
Since its original release for the Amiga, Vim has been ported to many environments including Atari MiNT, BeOS, MS-DOS, Windows starting from Windows NT 3.1, OS/2, OS/390, MorphOS, OpenVMS, QNX, RISC OS, Linux, BSD, and Classic Mac OS.[8] Also, Vim is shipped with Apple macOS.[9] Independent ports of Vim are available for Android[10][11] and iOS.[12]
Vim has been and continues to be popular for software development. In 2018, it was voted the most popular editor amongst Linux Journal readers.[13] In 2015, the Stack Overflow developer survey found it to be the third most popular text editor,[14] and, in 2019, the fifth most popular development environment.[15]
Remove ads
History
Vim's forerunner, Stevie (ST editor for vi enthusiasts), was written by Tim Thompson for the Atari ST and released as source code via Usenet in 1987.[16][17] It was further developed (ported to Unix and OS/2, released as version 3.10 on Usenet) by Tony Andrews[16][18] and G.R. (Fred) Walter.[19][20]
In 1988, Bram Moolenaar, started on what would become Vim; using the codebase for the Stevie editor ported to Amiga (by Tony Andrews et al.) as a starting point.[21][22] Version 1.14 (completed 2 November 1991) became the first public release; distributed via Fish Disk #591 in January 1992.[a][21][23][24][25][26]
Remove ads
License
Vim is released under the Vim license, which includes some charityware clauses that encourage users who enjoy the software to consider donating to children in Uganda.[4] The Vim license is compatible with the GNU General Public License through a special clause allowing distribution of modified copies under the GNU GPL version 2.0 or later.[4]
User experience
Summarize
Perspective

Text user interface
Vim provides a user experience like vi's that integrates keyboard-entered command input with a full-screen editing experience.
Same as vi, Vim tends to allow a user of a QWERTY keyboard to keep their fingers on the home row, which can be an advantage for touch typing.[27]
Graphical user interface
Via its GUI mode (called gVim), it presents an interface with more a modern experience including aspects such as menus, toolbars and icons; still expressed through its command line mode.
Help
Vim has a built-in help facility accessible via the :help command.
The Vim tutorial for beginners, called vimtutor, is usually installed along with Vim, but is a separate executable and can be run separately.[28]
The Vim Users' Manual details Vim's features and can be read from within Vim, or found online.[29][30]
Registers
Vim features various special memory entries called registers (not to be confused with hardware or processor registers). 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 ([a-z0-9]) and a range of special ones that either contain special values (current filename, last command, etc.) or serve a special purpose.[6]: 85
Modes

Like vi, Vim supports multiple editing modes. Depending on the mode, entered characters are either processed as command input or inserted as text. Vim has 14 modes; 7 basic modes and 7 variants:[31]
- Normal
- For editor commands. Generally, this is the default mode and ESC enters this mode.
- Insert
- For editing content like in a modern editor.[32][27]: 12
- Visual
- For selecting areas of text. Commands can be run on the selected area – moving, editing, filtering via built-in or external command, etc.
- Visual linewise
- Selects one or more whole lines.
- Visual blockwise
- Selects a rectangular block of text across one or more lines.
- Select
- Similar to visual, but commands are not interpreted. Instead, highlighted text is directly replaced by input from the keyboard; similar to the selection mode in editors on Windows platforms
- Command-line (Cmdline)
- Provides a single line input at the bottom of the terminal. 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 reverts to the previous mode.[32][27]: 12
- Ex
- Accepts a sequence of commands.
- Terminal-Job
- Interacting with a job in a terminal window.
Remove ads
Customization
Summarize
Perspective
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.[33] 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.[34]
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),[35] 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 for users of Unix-like systems.
Remove ads
Features and improvements over vi
Summarize
Perspective
Vim has a vi compatibility mode, but when that mode is not used, Vim has many enhancements over vi.[36] However even in compatibility mode, Vim is not entirely compatible with vi as defined in the Single Unix Specification[37] and POSIX (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".[38]
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 languages (both native and through alternative scripting interpreters such as Perl, Python, Ruby, Tcl, etc.) including support for plugins, a graphical user interface (gvim), limited integrated development environment-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, session state preservation, spell checking, split (horizontal and vertical) and tabbed windows, Unicode and other multi-language support, syntax highlighting, trans-session command, search and cursor position histories, multiple level and branching undo/redo history which can persist across editing sessions, and visual mode.[citation needed]
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.).[39][40] The feature can be disabled.[41]
Remove ads
Vim script
Summarize
Perspective
Vim script (also called Vimscript or VimL)[42] is the scripting language built into Vim.[43] 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 and a simple form of object-oriented programming. Built-in functions such as map() and filter() allow a basic form of functional programming, and Vim script has lambda 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,[44] Python,[45] Lua,[46] Ruby,[47] Tcl,[48] or Racket.[49] 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
Remove ads
Neovim
Summarize
Perspective
Neovim[51] is a fork of Vim that strives to improve the extensibility and maintainability of Vim.[52] Some features of the fork include built-in Language Server Protocol (LSP) support, support for asynchronous I/O by using the C library libuv, and for Lua scripting by using luaJIT language interpreter,[53][b] allowing both plugin scripting and running scripts in headless / batch mode.[54] The project is free software and its source code is available on GitHub.[55]
Neovim has the same configuration syntax as Vim prior to vim9script; thus the same configuration file can be used with both editors, although there are minor differences in details of options.[56] If the added features of Neovim are not used, Neovim is compatible with almost all of Vim's features.[57]
The Neovim project was started in 2014, after a patch to Vim supporting multi-threading was rejected.[58] Neovim had a successful fundraising in March 2014, supporting at least one full-time developer.[59][60]
Several frontends are under development which make use of Neovim's capabilities.[61][62][63]
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.[64]
Since version 0.9 Neovim supports EditorConfig.[65]
Gallery
- Neovim featuring configured statusbar and dark colorscheme.
- Tweaked v0.9.0-dev version.
Remove ads
Versions
Remove ads
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 and vi (Vim) text editors
- List of text editors
- Comparison of text editors
- Vimperator
Notes
References
External links
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads
