Vim script
Paradigm | imperative |
---|---|
First appeared | 1992 |
dynamic | |
OS | Cross-platform |
.vim | |
Website | [1] |
Vim script (also called vimscript or viml) is the scripting language built into Vim.[2] 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, but Vim script does not have lambda; 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 interpreted languages like Perl, Python, Lua, or Ruby (if support for them is compiled into the Vim binary).
Vim script files are stored in plain text format and the file name extension is .vim.
Example
" This is a simple while loop in Vim script. let i = 1 while i < 5 echo "count is" i let i += 1 endwhile
Libraries
There are libraries for Vim script available on http://www.vim.org/ as Vim plugins.
See also
References
External links
- Vim script repository
- Examples of Vim scripts
- IBM.com/developerWorks introductory tutorial by expert and author Damian Conway
- Vim, an open-source text editor history of vim by Bram Moolenaar