Vimscript

Vimscript
Usual filename extensions .vim

Vimscript, also Vim script, is the scripting language built into Vim.[1] 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, Vimscript 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 Vimscript 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 Vimscript for more complex tasks. Almost all extensions (called plugins) of the core Vim functionality are written in Vimscript, but plugins can also utilize other scripting languages like Perl, Python or Lua (if support for them is compiled into the Vim binary).

Vimscript files are stored in plain text format and the file name extension is .vim.

Example

let i = 1
while i < 5
  echo "count is" i
  let i += 1
endwhile

References

  1. ^ http://vimdoc.sourceforge.net/htmldoc/usr_41.html

External links