summarylogtreecommitdiffstats
path: root/restore_restricted_mode.patch
blob: 4d9bdc212754435712b683ab4087eac2e421dfb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -17,25 +15,26 @@ local COUNT      =    0x400
 local NOTRLCOM   =    0x800
 local ZEROR      =   0x1000
 local CTRLV      =   0x2000
 local CMDARG     =   0x4000
 local BUFNAME    =   0x8000
 local BUFUNL     =  0x10000
 local ARGOPT     =  0x20000
 local SBOXOK     =  0x40000
 local CMDWIN     =  0x80000
 local MODIFY     = 0x100000
 local FLAGS      = 0x200000
+local RESTRICT   = 0x400000
 local FILES      = bit.bor(XFILE, EXTRA)
 local WORD1      = bit.bor(EXTRA, NOSPC)
 local FILE1      = bit.bor(FILES, NOSPC)
 
 module.flags = {
   RANGE = RANGE,
   DFLALL = DFLALL,
 }
 
 -- The following table is described in ex_cmds_defs.h file.
 module.cmds = {
   {
     command='append',
     flags=bit.bor(BANG, RANGE, ZEROR, TRLBAR, CMDWIN, MODIFY),
@@ -1579,19 +1574,19 @@ return {
   {
     command='lua',
+    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_lua',
   },
   {
     command='luado',
+    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_luado',
   },
   {
     command='luafile',
+    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_luafile',
   },
   {
@@ -1921,19 +1916,19 @@ return {
   {
     command='perl',
+    flags=bit.bor(RANGE, EXTRA, DFLALL, NEEDARG, SBOXOK, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, DFLALL, NEEDARG, SBOXOK, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_perl',
   },
   {
     command='perldo',
+    flags=bit.bor(RANGE, EXTRA, DFLALL, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, DFLALL, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_perldo',
   },
   {
     command='perlfile',
+    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_perlfile',
   },
   {
@@ -2060,63 +2055,63 @@ return {
   {
     command='python',
+    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_python',
   },
   {
     command='pydo',
+    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_pydo',
   },
   {
     command='pyfile',
+    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_pyfile',
   },
   {
     command='py3',
+    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_python3',
   },
   {
     command='py3do',
+    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_pydo3',
   },
   {
     command='python3',
+    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_python3',
   },
   {
     command='py3file',
+    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_py3file',
   },
   {
     command='pyx',
+    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_pyx',
   },
   {
     command='pyxdo',
+    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_pyxdo',
   },
   {
     command='pythonx',
+    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_pyx',
   },
   {
     command='pyxfile',
+    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_pyxfile',
   },
   {
@@ -2249,15 +2234,15 @@ return {
   {
     command='ruby',
+    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_ruby',
   },
   {
     command='rubydo',
+    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_rubydo',
   },
   {
     command='rubyfile',
+    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN, RESTRICT),
-    flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
     addr_type='ADDR_LINES',
     func='ex_rubyfile',
   },
   {
diff --git a/src/nvim/po/af.po b/src/nvim/po/af.po
--- a/src/nvim/po/af.po
+++ b/src/nvim/po/af.po
@@ -1348,6 +1348,10 @@ msgstr "E143: Outobevele het nuwe buffer %s onverwags geskrap"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: nie-numeriese parameter vir :z"
 
+#, fuzzy
+#~ msgid "E145: Shell commands not allowed in restricted mode"
+#~ msgstr "E145: Dop bevele nie toegelaat in rvim"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Patrone kan nie deur letters afgebaken word nie"
 
diff --git a/src/nvim/po/ca.po b/src/nvim/po/ca.po
--- a/src/nvim/po/ca.po
+++ b/src/nvim/po/ca.po
@@ -1234,6 +1234,10 @@ msgstr "E143: Una auto-ordre ha eliminat el buffer nou %s inesperadament"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: Argument no numric per a :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Les ordres shell no estan permeses en l'rvim"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Les expressions regulars no poden estar delimitades per lletres"
diff --git a/src/nvim/po/cs.cp1250.po b/src/nvim/po/cs.cp1250.po
--- a/src/nvim/po/cs.cp1250.po
+++ b/src/nvim/po/cs.cp1250.po
@@ -1249,6 +1249,10 @@ msgstr "E143: Automatick
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: neseln argument pro :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovoluje pouit pkaz shellu"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulrn vrazy nesm bt oddleny psmeny"
diff --git a/src/nvim/po/cs.po b/src/nvim/po/cs.po
--- a/src/nvim/po/cs.po
+++ b/src/nvim/po/cs.po
@@ -1249,6 +1249,10 @@ msgstr "E143: Automatick
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: neseln argument pro :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovoluje pouit pkaz shellu"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulrn vrazy nesm bt oddleny psmeny"
diff --git a/src/nvim/po/da.po b/src/nvim/po/da.po
--- a/src/nvim/po/da.po
+++ b/src/nvim/po/da.po
@@ -980,6 +980,9 @@ msgstr "E143: Autokommandoer slettede uventede ny buffer %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: ikke-numerisk argument til :z"
 
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Skalkommandoer er ikke tilladt i rvim"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulære udtryk kan ikke afgrænses af bogstaver"
 
diff --git a/src/nvim/po/de.po b/src/nvim/po/de.po
--- a/src/nvim/po/de.po
+++ b/src/nvim/po/de.po
@@ -3,7 +3,7 @@
 # Do ":help uganda"  in Vim to read copying and usage conditions.
 # Do ":help credits" in Vim to see a list of people who contributed.
 #
+# Previous-Translator(s): 
-# Previous-Translator(s):
 # Johannes Zellner <johannes@zellner.org>
 # Gerfried Fuchs <alfie@ist.org>
 msgid ""
@@ -659,6 +659,10 @@ msgstr "E143: Autokommandos l
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: Nicht-numerisches Argument fr :z"
 
+#: ../ex_cmds.c:3398
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Shell-Befehle sind in rvim nicht erlaubt"
+
 #: ../ex_cmds.c:3492
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulre Ausdrcke knnen nicht durch Buchstaben begrenzt werden"
diff --git a/src/nvim/po/en_GB.po b/src/nvim/po/en_GB.po
--- a/src/nvim/po/en_GB.po
+++ b/src/nvim/po/en_GB.po
@@ -1194,6 +1194,10 @@ msgstr ""
 msgid "E144: non-numeric argument to :z"
 msgstr ""
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr ""
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regular expressions cannot be delimited by letters"
diff --git a/src/nvim/po/eo.po b/src/nvim/po/eo.po
--- a/src/nvim/po/eo.po
+++ b/src/nvim/po/eo.po
@@ -969,6 +969,9 @@ msgstr "E143: Aŭtokomandoj neatendite forviŝis novan bufron %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: nenumera argumento de :z"
 
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Ŝelkomandoj nepermeseblaj en rvim"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Ne eblas limigi regulesprimon per literoj"
 
diff --git a/src/nvim/po/es.po b/src/nvim/po/es.po
--- a/src/nvim/po/es.po
+++ b/src/nvim/po/es.po
@@ -1234,6 +1234,10 @@ msgstr "E143: Las auto-órdenes han eliminado al nuevo búfer %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: Argumento no numérico para \":z\""
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: No se permiten órdenes de consola en rvim"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Las expresiones regulares no se pueden delimitar con letras"
diff --git a/src/nvim/po/fi.po b/src/nvim/po/fi.po
--- a/src/nvim/po/fi.po
+++ b/src/nvim/po/fi.po
@@ -1515,6 +1515,10 @@ msgstr "E143: Autocommand poisti uuden puskurin odotuksen vastaisesti %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: :z:n argumentti ei ole numero"
 
+#, fuzzy
+#~ msgid "E145: Shell commands not allowed in restricted mode"
+#~ msgstr "E145: Kuoren komennot eivät toimi rvimissä"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Säännöllistä ilmausta ei voi rajata kirjaimilla"
 
diff --git a/src/nvim/po/fr.po b/src/nvim/po/fr.po
--- a/src/nvim/po/fr.po
+++ b/src/nvim/po/fr.po
@@ -1117,6 +1117,12 @@ msgstr "E143: Une autocommande a effac
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: L'argument de :z n'est pas numrique"
 
+# AB - La version franaise fera peut-tre mieux passer l'amre pilule.
+#      La consultation de l'aide donnera l'explication complte  ceux qui
+#      ne comprendraient pas  quoi ce message est d.
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Les commandes externes sont indisponibles dans rvim"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr ""
 "E146: Les expressions rgulires ne peuvent pas tre dlimites par des "
diff --git a/src/nvim/po/ga.po b/src/nvim/po/ga.po
--- a/src/nvim/po/ga.po
+++ b/src/nvim/po/ga.po
@@ -967,6 +967,9 @@ msgstr "E143: Scrios na huathorduithe maol
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: argint neamhuimhriil chun :z"
 
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: N cheadatear orduithe blaoisce i rvim"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr ""
 "E146: N cheadatear litreacha mar theormharcir ar shloinn ionadaochta"
diff --git a/src/nvim/po/it.po b/src/nvim/po/it.po
--- a/src/nvim/po/it.po
+++ b/src/nvim/po/it.po
@@ -1220,6 +1220,10 @@ msgstr ""
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: argomento non-numerico a :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Comandi Shell non permessi in rvim"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Le espressioni regolari non possono essere delimitate da lettere"
diff --git a/src/nvim/po/ja.euc-jp.po b/src/nvim/po/ja.euc-jp.po
--- a/src/nvim/po/ja.euc-jp.po
+++ b/src/nvim/po/ja.euc-jp.po
@@ -987,6 +987,9 @@ msgstr "E143: autocommand
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: ǤϤʤ :z Ϥޤ"
 
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvimǤϥ륳ޥɤȤޤ"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: ɽʸǶڤ뤳ȤǤޤ"
 
diff --git a/src/nvim/po/ja.po b/src/nvim/po/ja.po
--- a/src/nvim/po/ja.po
+++ b/src/nvim/po/ja.po
@@ -987,6 +987,9 @@ msgstr "E143: autocommandが予期せず新しいバッファ %s を削除しま
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: 数ではない引数が :z に渡されました"
 
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvimではシェルコマンドを使えません"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: 正規表現は文字で区切ることができません"
 
diff --git a/src/nvim/po/ko.UTF-8.po b/src/nvim/po/ko.UTF-8.po
--- a/src/nvim/po/ko.UTF-8.po
+++ b/src/nvim/po/ko.UTF-8.po
@@ -1215,6 +1215,10 @@ msgstr "E143: Autocommand가 뜻 밖에 새 버퍼 %s을(를) 지웠습니다"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: 숫자가 아닌 인자가 :z에 주어졌습니다"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim에서는 쉘 명령을 사용할 수 없습니다"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: 정규표현식은 글자로 구분될 수 없습니다"
diff --git a/src/nvim/po/nb.po b/src/nvim/po/nb.po
--- a/src/nvim/po/nb.po
+++ b/src/nvim/po/nb.po
@@ -1231,6 +1231,10 @@ msgstr "E143: Autokommandoer slettet uventet den nye bufferen %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: Ikke-numerisk parameter til :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Skallkommandoer er ikke tillatt i rvim"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulre uttrykk kan ikke bli adskilt av bokstaver"
diff --git a/src/nvim/po/nl.po b/src/nvim/po/nl.po
--- a/src/nvim/po/nl.po
+++ b/src/nvim/po/nl.po
@@ -1217,6 +1217,10 @@ msgstr "E143: 'Autocommands' hebben het nieuwe buffer %s onverwacht verwijderd"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: niet-numeriek argument voor :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: in rvim zijn shell-opdrachten zijn niet toegestaan"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: reguliere expressies kunnen niet begrensd worden door letters"
diff --git a/src/nvim/po/no.po b/src/nvim/po/no.po
--- a/src/nvim/po/no.po
+++ b/src/nvim/po/no.po
@@ -1231,6 +1231,10 @@ msgstr "E143: Autokommandoer slettet uventet den nye bufferen %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: Ikke-numerisk parameter til :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Skallkommandoer er ikke tillatt i rvim"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulre uttrykk kan ikke bli adskilt av bokstaver"
diff --git a/src/nvim/po/pl.UTF-8.po b/src/nvim/po/pl.UTF-8.po
--- a/src/nvim/po/pl.UTF-8.po
+++ b/src/nvim/po/pl.UTF-8.po
@@ -1201,6 +1201,10 @@ msgstr "E143: Autokomendy nieoczekiwanie skasowały nowy bufor %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: nienumeryczny argument dla :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Komendy powłoki są niedozwolone w rvim"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Wzorce regularne nie mogą być rozgraniczane literami"
diff --git a/src/nvim/po/pt_BR.po b/src/nvim/po/pt_BR.po
--- a/src/nvim/po/pt_BR.po
+++ b/src/nvim/po/pt_BR.po
@@ -4210,6 +4210,10 @@ msgstr ""
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: argumento no-numrico passado a :z"
 
+#: ../ex_cmds.c:3398
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Comandos do shell no so permitidos no rvim"
+
 #: ../ex_cmds.c:3492
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Expresses regulares no podem ser delimitadas por letras"
diff --git a/src/nvim/po/ru.po b/src/nvim/po/ru.po
--- a/src/nvim/po/ru.po
+++ b/src/nvim/po/ru.po
@@ -1205,6 +1205,10 @@ msgstr "E143: Автокоманды неожиданно убили новый
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: Параметр команды :z должен быть числом"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Использование команд оболочки не допускается в rvim."
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Регулярные выражения не могут разделяться буквами"
diff --git a/src/nvim/po/sk.cp1250.po b/src/nvim/po/sk.cp1250.po
--- a/src/nvim/po/sk.cp1250.po
+++ b/src/nvim/po/sk.cp1250.po
@@ -1219,6 +1219,10 @@ msgstr "E143: Automatick
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: neseln argument pre :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovouje pouitie prkazov shellu"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulrne vrazy nesm by oddelen psmenami"
diff --git a/src/nvim/po/sk.po b/src/nvim/po/sk.po
--- a/src/nvim/po/sk.po
+++ b/src/nvim/po/sk.po
@@ -1219,6 +1219,10 @@ msgstr "E143: Automatick
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: neseln argument pre :z"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovouje pouitie prkazov shellu"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regulrne vrazy nesm by oddelen psmenami"
diff --git a/src/nvim/po/sr.po b/src/nvim/po/sr.po
--- a/src/nvim/po/sr.po
+++ b/src/nvim/po/sr.po
@@ -981,6 +981,9 @@ msgstr "E143: Аутокоманде су неочекивано обрисал
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: ненумерички аргумент за :z"
 
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Shell команде нису дозвољене у rvim"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Регуларни изрази не могу да се раздвајају словима"
 
diff --git a/src/nvim/po/sv.po b/src/nvim/po/sv.po
--- a/src/nvim/po/sv.po
+++ b/src/nvim/po/sv.po
@@ -2622,6 +2622,10 @@ msgstr "E143: Autokommandon tog ov
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: ickenumeriskt argument till :z"
 
+#: ../ex_cmds.c:3398
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Skalkommandon inte tilltna i rvim"
+
 #: ../ex_cmds.c:3492
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Reguljra uttryck kan inte vara tskilda av bokstver"
diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po
--- a/src/nvim/po/uk.po
+++ b/src/nvim/po/uk.po
@@ -1459,6 +1459,10 @@ msgstr "E143: Автокоманди несподівано знищили но
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: нечисловий аргумент для :z"
 
+msgid ""
+"E145: Shell commands and some functionality not allowed in restricted mode"
+msgstr "E145: У обмеженому режимі не дозволені команди оболонки і деяка функіональність"
+
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Регулярні вирази не можна розділяти літерами"
 
diff --git a/src/nvim/po/vi.po b/src/nvim/po/vi.po
--- a/src/nvim/po/vi.po
+++ b/src/nvim/po/vi.po
@@ -1229,6 +1229,10 @@ msgstr "E143: Các lệnh tự động xóa bộ đệm mới ngoài ý muốn %
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: Tham số của lệnh :z phải là số"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Không cho phép sử dụng lệnh shell trong rvim."
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Không thể phân cách biểu thức chính quy bằng chữ cái"
diff --git a/src/nvim/po/zh_CN.UTF-8.po b/src/nvim/po/zh_CN.UTF-8.po
--- a/src/nvim/po/zh_CN.UTF-8.po
+++ b/src/nvim/po/zh_CN.UTF-8.po
@@ -1222,6 +1222,10 @@ msgstr "E143: 自动命令意外地删除了新缓冲区 %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: :z 不接受非数字的参数"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim 中禁止使用 shell 命令"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: 正则表达式不能用字母作分界"
diff --git a/src/nvim/po/zh_TW.UTF-8.po b/src/nvim/po/zh_TW.UTF-8.po
--- a/src/nvim/po/zh_TW.UTF-8.po
+++ b/src/nvim/po/zh_TW.UTF-8.po
@@ -1262,6 +1262,10 @@ msgstr "E143: Autocommands 意外地刪除新緩衝區 %s"
 msgid "E144: non-numeric argument to :z"
 msgstr "E144: :z 不接受非數字的參數"
 
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim 中禁止使用 shell 命令"
+
 #: ../ex_cmds.c:3498
 msgid "E146: Regular expressions can't be delimited by letters"
 msgstr "E146: Regular expression 無法用字母分隔 (?)"
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -416,8 +416,8 @@ Aliases:
   gvimdiff  (GUI)
   rgview    (GUI)
   rgvim     (GUI)
+  rview     (alias for "nvim -RZ")
+  rvim      (alias for "nvim -Z")
-  rview
-  rvim
   view      (alias for "nvim -R")
   vimdiff   (alias for "nvim -d" |diff-mode|)
 
@@ -496,7 +496,6 @@ Startup:
   --literal (file args are always literal; to expand wildcards on Windows, use
     |:n| e.g. `nvim +"n *"`)
   Easy mode: eview, evim, nvim -y
-  Restricted mode: rview, rvim, nvim -Z
   Vi mode: nvim -v
 
 Test functions:
diff --git a/man/nvim.1 b/man/nvim.1
--- a/man/nvim.1
+++ b/man/nvim.1
@@ -113,6 +113,9 @@ associated with a file.
 To overwrite a file, add an exclamation mark to the relevant Ex command, such as
 .Ic :w! .
 .Ic ":help 'readonly'"
+.It Fl Z
+Restricted mode.
+Disable commands that make use of an external shell.
 .It Fl m
 Resets the 'write' option, to disable file modifications.
 Writing to a file is disabled, but buffers can still be modified.
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -973,7 +973,7 @@ name).  This is included for backwards compatibility with version 3.0, the
 
 Note: Where a file name is expected wildcards expansion is done.  On Unix the
 shell is used for this, unless it can be done internally (for speed).
+Unless in |restricted-mode|, backticks work also, like in >
-Backticks work also, like in >
 	:n `echo *.c`
 But expansion is only done if there are any wildcards before expanding the
 '%', '#', etc..  This avoids expanding wildcards inside a file name.  If you
diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt
--- a/runtime/doc/diff.txt
+++ b/runtime/doc/diff.txt
@@ -20,7 +20,8 @@ additionally sets up for viewing the differences between the arguments. >
 
 	nvim -d file1 file2 [file3 [file4]]
 
-In addition to the |-d| argument, |-R| may be used for readonly mode.
+In addition to the |-d| argument, |-Z| and |-R| may be used for restricted
+mode and readonly mode respectively.
 
 The second and following arguments may also be a directory name.  Vim will
 then append the file name of the first argument to the directory name to find
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5698,6 +5698,7 @@ libcall({libname}, {funcname}, {argument})
 		If {argument} is a number, it is passed to the function as an
 		int; if {argument} is a string, it is passed as a
 		null-terminated string.
+		This function will fail in |restricted-mode|.
 
 		libcall() allows you to write your own 'plug-in' extensions to
 		Vim without having to recompile the program.  It is NOT a
@@ -8803,6 +8804,7 @@ system({cmd} [, {input}])				*system()* *E677*
 		{cmd} is a string: 'shell' 'shellcmdflag' {cmd}
 
 		The resulting error code can be found in |v:shell_error|.
+		This function will fail in |restricted-mode|.
 
 		Note that any wrong value in the options mentioned above may
 		make the function fail.  It has also been reported to fail
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -185,6 +185,18 @@ argument.
 		the 'modifiable' and 'write' options can be set to enable
 		changes and writing.
 
+					*-Z* *restricted-mode* *E145* *E981*
+-Z		Restricted mode.  All commands that make use of an external
+		shell are disabled.  This includes suspending with CTRL-Z,
+		":sh", filtering, the system() function, backtick expansion
+		and libcall().
+		Also disallowed are delete(), rename(), mkdir(), jobstart(),
+		etc.
+		Interfaces, such as Python, Ruby and Lua, are also disabled,
+		since they could be used to execute shell commands.
+		Note that the user may still find a loophole to execute a
+		shell command, it has only been made difficult.
+
 -e							*-e* *-E*
 -E		Start Nvim in Ex mode |gQ|.
 
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -7152,7 +7152,7 @@ void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv,
   rettv->v_type = VAR_STRING;
   rettv->vval.v_string = NULL;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -10418,7 +10418,7 @@ Channel *find_job(uint64_t id, bool show_error)
 
 void script_host_eval(char *name, typval_T *argvars, typval_T *rettv)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -205,7 +205,7 @@ static void float_op_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 
 static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -862,7 +862,7 @@ static void f_chanclose(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -901,7 +901,7 @@ static void f_chansend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -1480,7 +1480,7 @@ static void f_deepcopy(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 static void f_delete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 {
   rettv->vval.v_number = -1;
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -1515,7 +1515,7 @@ static void f_delete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 // dictwatcheradd(dict, key, funcref) function
 static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -1553,7 +1553,7 @@ static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 // dictwatcherdel(dict, key, funcref) function
 static void f_dictwatcherdel(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -4798,7 +4798,7 @@ static void f_jobpid(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -4822,7 +4822,7 @@ static void f_jobresize(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -4855,7 +4855,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -4988,7 +4988,7 @@ static void f_jobstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -5021,7 +5021,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
   if (argvars[0].v_type != VAR_LIST || (argvars[1].v_type != VAR_NUMBER
@@ -5239,7 +5239,7 @@ static void libcall_common(typval_T *argvars, typval_T *rettv, int out_type)
     rettv->vval.v_string = NULL;
   }
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -5942,9 +5942,8 @@ static void f_mkdir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   int prot = 0755;  // -V536
 
   rettv->vval.v_number = FAIL;
+  if (check_restricted() || check_secure())
-  if (check_secure()) {
     return;
-  }
 
   char buf[NUMBUFLEN];
   const char *const dir = tv_get_string_buf(&argvars[0], buf);
@@ -6833,7 +6832,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
  */
 static void f_rename(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     rettv->vval.v_number = -1;
   } else {
     char buf[NUMBUFLEN];
@@ -7231,7 +7230,7 @@ static void f_rpcnotify(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -7267,7 +7266,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->vval.v_number = 0;
   const int l_provider_call_nesting = provider_call_nesting;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -7364,7 +7363,7 @@ static void f_rpcstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -7430,7 +7429,7 @@ static void f_rpcstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_NUMBER;
   rettv->vval.v_number = 0;
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -7892,7 +7891,7 @@ static void f_serverstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
   rettv->v_type = VAR_STRING;
   rettv->vval.v_string = NULL;  // Address of the new server
 
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -7934,7 +7933,7 @@ static void f_serverstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 /// "serverstop()" function
 static void f_serverstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
@@ -10467,7 +10466,7 @@ static void f_tempname(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 // "termopen(cmd[, cwd])" function
 static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     return;
   }
 
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1049,13 +1049,13 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)
   int len;
   int scroll_save = msg_scroll;
 
+  /*
+   * Disallow shell commands in restricted mode (-Z)
+   * Disallow shell commands from .exrc and .vimrc in current directory for
+   * security reasons.
+   */
+  if (check_restricted() || check_secure())
-  //
-  // Disallow shell commands from .exrc and .vimrc in current directory for
-  // security reasons.
-  //
-  if (check_secure()) {
     return;
-  }
 
   if (addr_count == 0) {                /* :! */
     msg_scroll = FALSE;             /* don't scroll here */
@@ -1383,9 +1383,10 @@ do_shell(
     int flags             // may be SHELL_DOOUT when output is redirected
 )
 {
+  // Disallow shell commands in restricted mode (-Z)
   // Disallow shell commands from .exrc and .vimrc in current directory for
   // security reasons.
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     msg_end();
     return;
   }
@@ -3029,6 +3030,20 @@ void ex_z(exarg_T *eap)
   ex_no_reprint = true;
 }
 
+// Check if the restricted flag is set.
+// If so, give an error message and return true.
+// Otherwise, return false.
+bool check_restricted(void)
+  FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+  if (restricted) {
+    EMSG(_("E145: Shell commands and some functionality not allowed"
+           " in restricted mode"));
+    return true;
+  }
+  return false;
+}
+
 /*
  * Check if the secure flag is set (.exrc or .vimrc in current directory).
  * If so, give an error message and return TRUE.
diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h
--- a/src/nvim/ex_cmds_defs.h
+++ b/src/nvim/ex_cmds_defs.h
@@ -62,5 +62,6 @@
 #define EX_MODIFY       0x100000  // forbidden in non-'modifiable' buffer
 #define EX_FLAGS        0x200000  // allow flags after count in argument
+#define EX_RESTRICT     0x400000  // forbidden in restricted mode
 #define EX_FILES (EX_XFILE | EX_EXTRA)  // multiple extra files allowed
 #define EX_FILE1 (EX_FILES | EX_NOSPC)  // 1 file, defaults to current file
 #define EX_WORD1 (EX_EXTRA | EX_NOSPC)  // one extra word allowed
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1503,6 +1503,10 @@ static char_u * do_one_cmd(char_u **cmdlinep,
       errormsg = (char_u *)_(e_sandbox);
       goto doend;
     }
+    if (restricted != 0 && (ea.argt & EX_RESTRICT)) {
+      errormsg = (char_u *)_("E981: Command not allowed in restricted mode");
+      goto doend;
+    }
     if (!MODIFIABLE(curbuf) && (ea.argt & EX_MODIFY)
         // allow :put in terminals
         && (!curbuf->terminal || ea.cmdidx != CMD_put)) {
@@ -6620,22 +6624,25 @@ static void ex_hide(exarg_T *eap)
 /// ":stop" and ":suspend": Suspend Vim.
 static void ex_stop(exarg_T *eap)
 {
+  // Disallow suspending in restricted mode (-Z)
+  if (!check_restricted()) {
+    if (!eap->forceit) {
+      autowrite_all();
+    }
+    apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, false, NULL);
-  if (!eap->forceit) {
-    autowrite_all();
-  }
-  apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, false, NULL);
 
+    // TODO(bfredl): the TUI should do this on suspend
+    ui_cursor_goto(Rows - 1, 0);
+    ui_call_grid_scroll(1, 0, Rows, 0, Columns, 1, 0);
+    ui_flush();
+    ui_call_suspend();  // call machine specific function
-  // TODO(bfredl): the TUI should do this on suspend
-  ui_cursor_goto(Rows - 1, 0);
-  ui_call_grid_scroll(1, 0, Rows, 0, Columns, 1, 0);
-  ui_flush();
-  ui_call_suspend();  // call machine specific function
 
+    ui_flush();
+    maketitle();
+    resettitle();  // force updating the title
+    ui_refresh();  // may have resized window
+    apply_autocmds(EVENT_VIMRESUME, NULL, NULL, false, NULL);
+  }
-  ui_flush();
-  maketitle();
-  resettitle();  // force updating the title
-  ui_refresh();  // may have resized window
-  apply_autocmds(EVENT_VIMRESUME, NULL, NULL, false, NULL);
 }
 
 // ":exit", ":xit" and ":wq": Write file and quite the current window.
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -492,6 +492,9 @@ EXTERN int stdout_isatty INIT(= true);
 // volatile because it is used in a signal handler.
 EXTERN volatile int full_screen INIT(= false);
 
+// When started in restricted mode (-Z).
+EXTERN int restricted INIT(= false);
+
 /// Non-zero when only "safe" commands are allowed, e.g. when sourcing .exrc or
 /// .vimrc in current directory.
 EXTERN int secure INIT(= false);
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -965,7 +965,7 @@ static void typval_exec_lua(const char *lcmd, size_t lcmd_len, const char *name,
                             typval_T *const args, int argcount, bool special,
                             typval_T *ret_tv)
 {
+  if (check_restricted() || check_secure()) {
-  if (check_secure()) {
     if (ret_tv) {
       ret_tv->v_type = VAR_NUMBER;
       ret_tv->vval.v_number = 0;
diff --git a/src/nvim/main.c b/src/nvim/main.c
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1012,6 +1012,10 @@ static void command_line_scan(mparm_T *parmp)
           want_argument = true;
           break;
         }
+        case 'Z': {  // "-Z" restricted mode
+          restricted = true;
+          break;
+        }
 
         case 'c': {  // "-c{command}" or "-c {command}" exec command
           if (argv[0][argv_idx] != NUL) {
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -1091,9 +1091,8 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags,
 {
   char_u *buffer = NULL;
 
+  if (check_restricted() || check_secure())
-  if (check_secure()) {
     return NULL;
-  }
 
   // get a name for the temp file
   char_u *tempname = vim_tempname();
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -150,11 +150,11 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file,
     return FAIL;
   }
 
+  // Don't allow the use of backticks in secure and restricted mode.
+  if (secure || restricted) {
-  // Don't allow the use of backticks in secure.
-  if (secure) {
     for (i = 0; i < num_pat; i++) {
       if (vim_strchr(pat[i], '`') != NULL
+          && (check_restricted() || check_secure())) {
-          && (check_secure())) {
         return FAIL;
       }
     }
diff --git a/src/nvim/testdir/test_restricted.vim b/src/nvim/testdir/test_restricted.vim
--- a/src/nvim/testdir/test_restricted.vim
+++ b/src/nvim/testdir/test_restricted.vim
@@ -0,0 +1,103 @@
+" Test for "rvim" or "vim -Z"
+
+source shared.vim
+
+"if has('win32') && has('gui')
+"  " Win32 GUI shows a dialog instead of displaying the error in the last line.
+"  finish
+"endif
+
+func Test_restricted()
+  call Run_restricted_test('!ls', 'E145:')
+endfunc
+
+func Run_restricted_test(ex_cmd, error)
+  let cmd = GetVimCommand('Xrestricted')
+  if cmd == ''
+    return
+  endif
+
+  " Use a VimEnter autocommand to avoid that the error message is displayed in
+  " a dialog with an OK button.
+  call writefile([
+	\ "func Init()",
+	\ "  silent! " . a:ex_cmd,
+	\ "  call writefile([v:errmsg], 'Xrestrout')",
+	\ "  qa!",
+	\ "endfunc",
+	\ "au VimEnter * call Init()",
+	\ ], 'Xrestricted')
+  call system(cmd . ' -Z')
+  call assert_match(a:error, join(readfile('Xrestrout')))
+
+  call delete('Xrestricted')
+  call delete('Xrestrout')
+endfunc
+
+func Test_restricted_lua()
+  if !has('lua')
+    throw 'Skipped: Lua is not supported'
+  endif
+  call Run_restricted_test('lua print("Hello, Vim!")', 'E981:')
+  call Run_restricted_test('luado return "hello"', 'E981:')
+  call Run_restricted_test('luafile somefile', 'E981:')
+  call Run_restricted_test('call luaeval("expression")', 'E145:')
+endfunc
+
+func Test_restricted_mzscheme()
+  if !has('mzscheme')
+    throw 'Skipped: MzScheme is not supported'
+  endif
+  call Run_restricted_test('mzscheme statement', 'E981:')
+  call Run_restricted_test('mzfile somefile', 'E981:')
+  call Run_restricted_test('call mzeval("expression")', 'E145:')
+endfunc
+
+func Test_restricted_perl()
+  if !has('perl')
+    throw 'Skipped: Perl is not supported'
+  endif
+  " TODO: how to make Safe mode fail?
+  " call Run_restricted_test('perl system("ls")', 'E981:')
+  " call Run_restricted_test('perldo system("hello")', 'E981:')
+  " call Run_restricted_test('perlfile somefile', 'E981:')
+  " call Run_restricted_test('call perleval("system(\"ls\")")', 'E145:')
+endfunc
+
+func Test_restricted_python()
+  if !has('python')
+    throw 'Skipped: Python is not supported'
+  endif
+  call Run_restricted_test('python print "hello"', 'E981:')
+  call Run_restricted_test('pydo return "hello"', 'E981:')
+  call Run_restricted_test('pyfile somefile', 'E981:')
+  call Run_restricted_test('call pyeval("expression")', 'E145:')
+endfunc
+
+func Test_restricted_python3()
+  if !has('python3')
+    throw 'Skipped: Python3 is not supported'
+  endif
+  call Run_restricted_test('py3 print "hello"', 'E981:')
+  call Run_restricted_test('py3do return "hello"', 'E981:')
+  call Run_restricted_test('py3file somefile', 'E981:')
+  call Run_restricted_test('call py3eval("expression")', 'E145:')
+endfunc
+
+func Test_restricted_ruby()
+  if !has('ruby')
+    throw 'Skipped: Ruby is not supported'
+  endif
+  call Run_restricted_test('ruby print "Hello"', 'E981:')
+  call Run_restricted_test('rubydo print "Hello"', 'E981:')
+  call Run_restricted_test('rubyfile somefile', 'E981:')
+endfunc
+
+func Test_restricted_tcl()
+  if !has('tcl')
+    throw 'Skipped: Tcl is not supported'
+  endif
+  call Run_restricted_test('tcl puts "Hello"', 'E981:')
+  call Run_restricted_test('tcldo puts "Hello"', 'E981:')
+  call Run_restricted_test('tclfile somefile', 'E981:')
+endfunc