Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Vim (text editor)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Vim script == '''Vim script''' (also called '''Vimscript''' or '''VimL''')<ref>{{cite web|url=https://pragprog.com/book/bkviml/the-viml-primer|access-date=25 January 2020|title=The VimL Primer: Edit Like a Pro with Vim Plugins and Scripts by Benjamin Klein | The Pragmatic Bookshelf|last=Klein|first=Benjamin|url-status=dead|archive-url=https://web.archive.org/web/20200125123547/https://pragprog.com/book/bkviml/the-viml-primer|archive-date=25 January 2020}}</ref> is the [[scripting language]] built into Vim.<ref>{{cite web|url=https://vimhelp.org/usr_41.txt.html|title=Vim documentation: usr_41|website=vimhelp.org|access-date=13 January 2019|archive-date=13 January 2019|archive-url=https://web.archive.org/web/20190113232237/https://vimhelp.org/usr_41.txt.html|url-status=live}}</ref> Based on the [[Ex (text editor)|ex]] editor language of the original [[Vi (text editor)|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 [[List (abstract data type)|lists]] and [[Associative array|dictionaries]] and a simple form of [[object-oriented programming]]. Built-in functions such as <code>map()</code> and <code>filter()</code> allow a basic form of [[functional programming]], and Vim script has [[Anonymous function|lambda]] since version 8.0. Vim script is mostly written in an [[Imperative programming|imperative programming style]]. Vim [[Macro (computer science)|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]],<ref>{{cite web | url = http://vimdoc.sourceforge.net/htmldoc/if_perl.html | title = Vim documentation: if_perl | access-date = 2019-08-27 | last1 = Verdoolaege | first1 = Sven | last2 = Gerassimof | first2 = Matt | archive-date = 8 February 2012 | archive-url = https://web.archive.org/web/20120208154924/http://vimdoc.sourceforge.net/htmldoc/if_perl.html | url-status = live }}</ref> [[Python (programming language)|Python]],<ref>{{cite web | url = http://vimdoc.sourceforge.net/htmldoc/if_pyth.html | title = Vim documentation: if_pyth | access-date = 2019-08-27 | last = Moore | first = Paul | archive-date = 22 August 2012 | archive-url = https://web.archive.org/web/20120822072929/http://vimdoc.sourceforge.net/htmldoc/if_pyth.html | url-status = live }}</ref> [[Lua (programming language)|Lua]],<ref>{{cite web | url = http://vimdoc.sourceforge.net/htmldoc/if_lua.html | title = Vim documentation: if_lua | access-date = 2019-08-27 | last = Carvalho | first = Luis | archive-date = 30 March 2012 | archive-url = https://web.archive.org/web/20120330221044/http://vimdoc.sourceforge.net/htmldoc/if_lua.html | url-status = live }}</ref> [[Ruby (programming language)|Ruby]],<ref>{{cite web | url = http://vimdoc.sourceforge.net/htmldoc/if_ruby.html | title = Vim documentation: if_ruby | access-date = 2019-08-27 | last = Maeda | first = Shugo | archive-date = 14 February 2012 | archive-url = https://web.archive.org/web/20120214174436/http://vimdoc.sourceforge.net/htmldoc/if_ruby.html | url-status = live }}</ref> [[Tcl]],<ref>{{cite web | url = http://vimdoc.sourceforge.net/htmldoc/if_tcl.html | title = Vim documentation: if_tcl | access-date = 2019-08-27 | last = Wilken | first = Ingo | archive-date = 24 August 2012 | archive-url = https://web.archive.org/web/20120824172051/http://vimdoc.sourceforge.net/htmldoc/if_tcl.html | url-status = live }}</ref> or [[Racket (programming language)|Racket]].<ref>{{cite web | url = http://vimdoc.sourceforge.net/htmldoc/if_mzsch.html | title = Vim documentation: if_mzsch | access-date = 2019-08-27 | last = Khorev | first = Sergey | archive-date = 14 April 2012 | archive-url = https://web.archive.org/web/20120414232343/http://vimdoc.sourceforge.net/htmldoc/if_mzsch.html | url-status = live }}</ref> 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 <code>.vim</code>. One notable exception to that is Vim's config file, <code>.vimrc</code>. === Examples === <syntaxhighlight lang="vim"> " 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 </syntaxhighlight>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Vim (text editor)
(section)
Add topic