-*starting.txt* For Vim version 9.2. Last change: 2026 Feb 25
+*starting.txt* For Vim version 9.2. Last change: 2026 Mar 17
VIM REFERENCE MANUAL by Bram Moolenaar
":sh", filtering, the |system()| function, backtick expansion
and libcall().
Also disallowed are |delete()|, |rename()|, |mkdir()|,
- |job_start()|, |setenv()| etc.
+ |job_start()|, |setenv()| and setting environment variables,
+ etc.
Interfaces, such as Python, Ruby and Lua, are also disabled,
since they could be used to execute shell commands. Perl uses
the Safe module.
-*version9.txt* For Vim version 9.2. Last change: 2026 Mar 16
+*version9.txt* For Vim version 9.2. Last change: 2026 Mar 17
VIM REFERENCE MANUAL by Bram Moolenaar
This prevents fragmented highlighting when only whitespace or punctuation
separates changes.
-Using external diff mode is no longer allowed when Vim is running in
-|restricted-mode|.
+Restricted mode~
+---------------
+Using external diff mode or setting environment variables is no longer allowed
+when Vim is running in |restricted-mode|.
Other ~
-----
else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg)) == NULL)
emsg(_(e_unexpected_characters_in_let));
- else if (!check_secure())
+ else if (!check_secure() && !check_restricted())
{
char_u *tofree = NULL;
int c1 = name[len];
call delete('Xresult')
endfunc
-func Test_restricted_vim9_env()
+func Test_restricted_env()
let lines =<< trim END
vim9script
def SetEnv()
call assert_equal(['not-allowed'], readfile('XResult_env'))
endif
call delete('XResult_env')
+
+ let lines =<< trim END
+ try
+ let $ENV_TEST = 'val'
+ let result = 'okay'
+ catch /^Vim\%((\S\+)\)\=:E145:/
+ let result = 'not-allowed'
+ endtry
+ call writefile([result], 'XResult_env')
+ qa!
+ END
+ call writefile(lines, 'Xrestricted_legacy', 'D')
+ if RunVim([], [], '-Z --clean -S Xrestricted_legacy')
+ call assert_equal(['not-allowed'], readfile('XResult_env'))
+ endif
+ call delete('XResult_env')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 188,
/**/
187,
/**/