" Vim runtime support library,
-" runs the vim9 script version or legacy script version
+" runs the Vim9 script version or legacy script version
" on demand (mostly for Neovim compatability)
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Nov 04
+" Last Change: 2025 Apr 27
" enable the zip and gzip plugin by default, if not set
-*filetype.txt* For Vim version 9.1. Last change: 2025 Apr 22
+*filetype.txt* For Vim version 9.1. Last change: 2025 Apr 27
VIM REFERENCE MANUAL by Bram Moolenaar
item of the 'runtimepath' option. Example for Unix: >
:!mkdir ~/.vim
<
- 2. Create a vim script file for doing this. Example: >
+ 2. Create a Vim script file for doing this. Example: >
if did_filetype() " filetype already set..
finish " ..don't do these checks
endif
-*if_perl.txt* For Vim version 9.1. Last change: 2023 May 14
+*if_perl.txt* For Vim version 9.1. Last change: 2025 Apr 27
VIM REFERENCE MANUAL by Sven Verdoolaege
|script-here|.
-Example vim script: >
+Example Vim script: >
function! WhitePearl()
perl << EOF
-*pi_getscript.txt* For Vim version 9.1. Last change: 2025 Mar 15
+*pi_getscript.txt* For Vim version 9.1. Last change: 2025 Apr 27
>
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
<
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
-This comment line tells getscript.vim to check vimscript #884 and that the
+This comment line tells getscript.vim to check Vim script #884 and that the
script is automatically installable. Getscript will also use this line to
help build the GetLatestVimScripts.dat file, by including a line such as: >
==============================================================================
4. Network-Oriented File Transfer *netrw-xfer* {{{1
-Network-oriented file transfer under Vim is implemented by a vim script
+Network-oriented file transfer under Vim is implemented by a Vim script
(<netrw.vim>) using plugin techniques. It currently supports both reading and
writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
dav/cadaver, rsync, or sftp.
vim-raku ft_raku.txt /*vim-raku*
vim-script-intro usr_41.txt /*vim-script-intro*
vim-script-library eval.txt /*vim-script-library*
+vim-script-notation usr_41.txt /*vim-script-notation*
vim-security intro.txt /*vim-security*
vim-shebang various.txt /*vim-shebang*
vim-tutor-create pi_tutor.txt /*vim-tutor-create*
-*usr_41.txt* For Vim version 9.1. Last change: 2025 Apr 24
+*usr_41.txt* For Vim version 9.1. Last change: 2025 Apr 27
VIM USER MANUAL - by Bram Moolenaar
These scripts may define functions, commands and settings that Vim uses to
customize and extend its behavior.
-With a slight abuse of nomenclature, we will use "Vim script" to refer to the
-Vim scripting language throughout this documentation. This shorthand helps to
+ *vim-script-notation*
+The correct notation is "Vim script" (or "Vim9 script" when refering to the
+new Vim9 language |Vim9-script|), so we will use "Vim script" to refer to the
+Vim scripting language throughout this documentation. This shorthand helps to
streamline explanations and discussions about scripting with Vim.
A Vim plugin is a collection of one or more Vim scripts, along with additional
-*vim9.txt* For Vim version 9.1. Last change: 2025 Apr 18
+*vim9.txt* For Vim version 9.1. Last change: 2025 Apr 27
VIM REFERENCE MANUAL by Bram Moolenaar
If the name does not end in ".vim" then the use of "as name" is required.
-Once a vim9 script file has been imported, the result is cached and used the
+Once a Vim9 script file has been imported, the result is cached and used the
next time the same script is imported. It will not be read again.
It is not allowed to import the same script twice, also when using two
echo that
.name # Error!
< *import-map*
-When you've imported a function from one script into a vim9 script you can
+When you've imported a function from one script into a Vim9 script you can
refer to the imported function in a mapping by prefixing it with |<SID>|: >
noremap <silent> ,a :call <SID>name.Function()<CR>
" UseConfigFiles function for different modes {{{1
function! s:UseConfigFiles_VimCore(bufnr, target)
-" Use the vimscript EditorConfig core
+" Use the Vim script EditorConfig core
try
let l:config = editorconfig_core#handler#get_configurations(
\ { 'target': a:target } )
endfun
" ---------------------------------------------------------------------
-" netrw#NetSource: source a remotely hosted vim script {{{2
+" netrw#NetSource: source a remotely hosted Vim script {{{2
" uses NetRead to get a copy of the file into a temporarily file,
" then sources that file,
" then removes that file.
==============================================================================
4. Network-Oriented File Transfer *netrw-xfer* {{{1
-Network-oriented file transfer under Vim is implemented by a vim script
+Network-oriented file transfer under Vim is implemented by a Vim script
(<netrw.vim>) using plugin techniques. It currently supports both reading and
writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
dav/cadaver, rsync, or sftp.
syn region vimGlobal matchgroup=Statement start='\<g\%[lobal]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
-" Vim9 Script Regions: {{{2
+" Vim9 script Regions: {{{2
" ==================
if s:vim9script
" Version: 0.1.18
" URL: http://www.vim.org/scripts/script.php?script_id=945
" Last Change: 2021 Feb 03
+" 2025 Apr 27 by Vim Project correct Vim script spelling
" THE ORIGINAL AUTHOR'S NOTES:
"
-" This is my very first vim script, I hope to have
+" This is my very first Vim script, I hope to have
" done it the right way.
"
" I must directly or indirectly thank the author of java.vim and ruby.vim:
enddef
-# Issue #16227 (Vimscript ternary expression highlighting)
+# Issue #16227 (Vim script ternary expression highlighting)
var foo = 'foo' # comment
var bar = foo == 'foo' ? 'bar' : 'baz'
echo "Foo" | clearmatches()
-# Issue 16721 (vimscript highlight of builtin function after |)
+# Issue 16721 (Vim script highlight of builtin function after |)
&directory = $'{$MYVIMDIR}/.data/swap/'
&backupdir = $'{$MYVIMDIR}/.data/backup//'
z: string = "zed")
enddef
-" Issue #16243 (vimscript def parameters syntax highlight is wrong)
+" Issue #16243 (Vim script def parameters syntax highlight is wrong)
def Test(lines: list<number> = [line('.'), line('.')]): void
enddef
endfunction
-" Issue #16243 (vimscript def parameters syntax highlight is wrong)
+" Issue #16243 (Vim script def parameters syntax highlight is wrong)
function Test(lines = [line('.'), line('.')])
endfunction
syn region vimGlobal matchgroup=Statement start='\<g\%[lobal]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
-" Vim9 Script Regions: {{{2
+" Vim9 script Regions: {{{2
" ==================
if s:vim9script
$(MAKE) -C xxd -f Make_ming.mak clean
$(MAKE) -C tee -f Make_ming.mak clean
-# Run vim script to generate the Ex command lookup table.
+# Run Vim script to generate the Ex command lookup table.
# This only needs to be run when a command name has been added or changed.
# If this fails because you don't have Vim yet, first build and install Vim
# without changes.
cmdidxs: ex_cmds.h
vim --clean -N -X --not-a-term -u create_cmdidxs.vim -c quit
-# Run vim script to generate the normal/visual mode command lookup table.
+# Run Vim script to generate the normal/visual mode command lookup table.
# This only needs to be run when a new normal/visual mode command has been
# added. If this fails because you don't have Vim yet:
# - change nv_cmds[] in nv_cmds.h to add the new normal/visual mode command.
$(MAKE) /NOLOGO -f Make_mvc.mak clean
cd ..
-# Run vim script to generate the Ex command lookup table.
+# Run Vim script to generate the Ex command lookup table.
# This only needs to be run when a command name has been added or changed.
# If this fails because you don't have Vim yet, first build and install Vim
# without changes.
cmdidxs: ex_cmds.h
vim --clean -N -X --not-a-term -u create_cmdidxs.vim -c quit
-# Run vim script to generate the normal/visual mode command lookup table.
+# Run Vim script to generate the normal/visual mode command lookup table.
# This only needs to be run when a new normal/visual mode command has been
# added. If this fails because you don't have Vim yet:
# - change nv_cmds[] in nv_cmds.h to add the new normal/visual mode command.
-rm -rf autom4te.cache
-rm -f auto/config.status auto/config.cache
-# Run vim script to generate the Ex command lookup table.
+# Run Vim script to generate the Ex command lookup table.
# This only needs to be run when a command name has been added or changed.
# If this fails because you don't have Vim yet, first build and install Vim
# without changes.
cmdidxs: ex_cmds.h
vim --clean -X --not-a-term -S create_cmdidxs.vim -c quit
-# Run vim script to generate the normal/visual mode command lookup table.
+# Run Vim script to generate the normal/visual mode command lookup table.
# This only needs to be run when a new normal/visual mode command has been
# added.
# This requires a "vim" executable with the +eval feature.
clipboard.c | handling the clipboard
cmdexpand.c | command-line completion
cmdhist.c | command-line history
-debugger.c | vim script debugger
+debugger.c | Vim script debugger
diff.c | diff mode (vimdiff)
drawline.c | drawing a window line
drawscreen.c | drawing the windows
optionstr.c | handling string options
popupmenu.c | popup menu
popupwin.c | popup window
-profiler.c | vim script profiler
+profiler.c | Vim script profiler
quickfix.c | quickfix commands (":make", ":cn")
regexp.c | pattern matching
register.c | handling registers
textobject.c | text objects
textprop.c | text properties
time.c | time and timer functions
-typval.c | vim script type/value functions
+typval.c | Vim script type/value functions
undo.c | undo and redo
usercmd.c | user defined commands
userfunc.c | user defined functions
{
where_T where = WHERE_INIT;
- // In a vim9 script, do type check and make sure the variable is
+ // In a Vim9 script, do type check and make sure the variable is
// writable.
if (check_typval_type(lp->ll_valtype, rettv, where) == FAIL)
return NULL;
if (dict_get_bool(args, "cell", FALSE))
{
// calculate the middle of the character cell
- // Note: Cell coordinates are 1-based from vimscript
+ // Note: Cell coordinates are 1-based from Vim script
int pY = (row - 1) * gui.char_height + gui.char_height / 2;
int pX = (col - 1) * gui.char_width + gui.char_width / 2;
gui_mouse_moved(pX, pY);
// - warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’
// - warning: unknown conversion type character ‘b’ in format
//
-// These formats are in practise only used from vim script printf()
+// These formats are in practise only used from Vim script printf()
// function and never as literals in C code.
char *fmt_012p = "%012p";
char *fmt_5S = "%5S";
/*
* Test vim_snprintf() with a focus on checking that truncation is
* correct when buffer is small, since it cannot be tested from
- * vim script tests. Check that:
+ * Vim script tests. Check that:
* - no buffer overflows happens (with valgrind or asan)
* - output string is always NUL terminated.
*
* Not all formats of vim_snprintf() are checked here. They are
- * checked more exhaustively in Test_printf*() vim script tests.
+ * checked more exhaustively in Test_printf*() Vim script tests.
*/
static void
test_vim_snprintf(void)
assert(bsize == 0 || STRNCMP(buf, "\x01\x02", bsize_int) == 0);
assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0');
- // %p format is not tested in vim script tests Test_printf*()
+ // %p format is not tested in Vim script tests Test_printf*()
// as it only makes sense in C code.
// NOTE: SunOS libc doesn't use the prefix "0x" on %p.
#ifdef SUN_SYSTEM
*/
/*
- * profiler.c: vim script profiler
+ * profiler.c: Vim script profiler
*/
#include "vim.h"
#define FC_DEAD 0x80 // function kept only for reference to dfunc
#define FC_EXPORT 0x100 // "export def Func()"
#define FC_NOARGS 0x200 // no a: variables in lambda
-#define FC_VIM9 0x400 // defined in vim9 script file
+#define FC_VIM9 0x400 // defined in Vim9 script file
#define FC_CFUNC 0x800 // defined as Lua C func
#define FC_COPY 0x1000 // copy of another function by
// copy_lambda_to_global_func()
" required for :*
set cpo+=*
let list = filter(getcompletion('', 'command'), 'exists(":" . v:val) == 0')
- " :++ and :-- are only valid in Vim9 Script context, so they can be ignored
+ " :++ and :-- are only valid in Vim9 script context, so they can be ignored
call assert_equal(['++', '--'], sort(list))
call assert_equal(2, exists(':k'))
call assert_equal(0, exists(':ke'))
call assert_fails('source XtwoScript', 'E121:')
endfunc
-" When sourcing a vim script, shebang should be ignored.
+" When sourcing a Vim script, shebang should be ignored.
func Test_source_ignore_shebang()
call writefile(['#!./xyzabc', 'let g:val=369'], 'Xsisfile.vim', 'D')
source Xsisfile.vim
source
call assert_equal(10, Xtestfunc())
- " test for sourcing a vim9 script with line continuation
+ " test for sourcing a Vim9 script with line continuation
%d _
let lines =<< trim END
vim9script
v9.CheckScriptSuccess(lines)
delfunc g:TheFunc
- # vim9cmd execute(cmd) executes code in vim9 script context
+ # vim9cmd execute(cmd) executes code in Vim9 script context
lines =<< trim END
vim9cmd execute("g:vim9executetest = 'bar'")
call assert_equal('bar', g:vim9executetest)
unlet g:vim9executetest1
unlet g:vim9executetest2
- # legacy call execute(cmd) executes code in vim script context
+ # legacy call execute(cmd) executes code in Vim script context
lines =<< trim END
vim9script
legacy call execute("let g:vim9executetest = 'bar'")
vim9script
-# Utility functions for testing vim9 script
+# Utility functions for testing Vim9 script
# Use a different file name for each run.
var sequence = 1
if (dict_get_bool(args, "cell", FALSE))
{
// calculate the middle of the character cell
- // Note: Cell coordinates are 1-based from vimscript
+ // Note: Cell coordinates are 1-based from Vim script
pY = (row - 1) * gui.char_height + gui.char_height / 2;
pX = (col - 1) * gui.char_width + gui.char_width / 2;
}