|RPN in Vim script|
Vim is a text editor. Some think it is the best editor, or simply The editor.
The reason to list a text editor in a web site dedicated to programming languages is that this one has its own programming language, a script language used for configuring, adapting and extending the editor. The language is thus an important part of Vim. As I am preparing all the text on this web site in this editor, I gladly mention it and its script language here.
Because the language has no proper name, it is called simply ‘the Vim script language.’
Superficially, the language resembles BASIC in that it is command-oriented, in a single line there can normally be only one command, and every command begins with a keyword, such as
if, etc. There are also traces of C, sh/bash, other script languages, and even functional languages in it.
The language has integers, floating-point numbers (since lately) and strings as primitive datatypes, and lists and dictionaries as composite ones. For command sequence control, there are the usual conditional and looping constructs. A list-oriented iterator (also useful for traversing dictionaries) and an exception handling mechanism are also included.
Programming in the Vim script language makes use of a large number of built-in functions: for numeric computations, for string, list and dictionary manipulation, for interaction with the user, for various searches in and transformations of the edited text, for cursor and mark positioning and location, for editing aids, such as highlighting, spellchecking, folding, and others – currently well over 200 in number.
The main purpose of the language is to provide a means for executing Vim commands programmatically, possibly depending on some data and on interaction with the user. Both commands of the ‘:-kind’ (command-line commands) and those known as normal mode commands can be executed in a script. This symbiosis between Vim and the script language significantly enhances both.
There are several ways in which its integration with the editor is reflected in the language:
The Vim script language's documentation can be found in each distribution of the editor, as part of the Vim's documentation. Some of it is also available online: see the links below.
The Vim documentation online, in non-Vim formats (some of it not up to date)
Scripting the Vim editor: a series of tutorials on programming in Vim script
Dr Chip's Vim Page: a number of Vim scripts and other resources on Vim