Vim script

From Wikipedia, the free encyclopedia
  (Redirected from Vimscript)
Jump to: navigation, search
Vim script
Paradigm(s) imperative
Appeared in 1992 (1992)
Typing discipline dynamic
OS Cross-platform
Filename extension(s) .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[edit]

" This is a simple while loop in Vim script.
let i = 1
while i < 5
  echo "count is" i
  let i += 1
endwhile

Libraries[edit]

There are libraries for Vim script available on http://www.vim.org/ as Vim plugins.

See also[edit]

References[edit]

External links[edit]