-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestore_restricted_mode.patch
1217 lines (1117 loc) · 41.9 KB
/
restore_restricted_mode.patch
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
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 numèric 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: neèíselný argument pro :z"
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovoluje použití pøíkazù shellu"
+
#: ../ex_cmds.c:3498
msgid "E146: Regular expressions can't be delimited by letters"
msgstr "E146: Regulární výrazy nesmí být oddìleny písmeny"
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: neèíselný argument pro :z"
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovoluje pou¾ití pøíkazù shellu"
+
#: ../ex_cmds.c:3498
msgid "E146: Regular expressions can't be delimited by letters"
msgstr "E146: Regulární výrazy nesmí být oddìleny písmeny"
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 für :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: Reguläre Ausdrücke können 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 numérique"
+# AB - La version française fera peut-être mieux passer l'amère pilule.
+# La consultation de l'aide donnera l'explication complète à 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 régulières ne peuvent pas être délimitées 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: argóint neamhuimhriúil chun :z"
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Ní cheadaítear orduithe blaoisce i rvim"
+
msgid "E146: Regular expressions can't be delimited by letters"
msgstr ""
"E146: Ní cheadaítear litreacha mar theormharcóirí ar shloinn ionadaíochta"
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: Regulære 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: Regulære 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 não-numérico passado a :z"
+#: ../ex_cmds.c:3398
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: Comandos do shell não são permitidos no rvim"
+
#: ../ex_cmds.c:3492
msgid "E146: Regular expressions can't be delimited by letters"
msgstr "E146: Expressões regulares não 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: neèíselný argument pre :z"
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovo¾uje použitie príkazov shellu"
+
#: ../ex_cmds.c:3498
msgid "E146: Regular expressions can't be delimited by letters"
msgstr "E146: Regulárne výrazy nesmú by oddelené písmenami"
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: neèíselný argument pre :z"
+#: ../ex_cmds.c:3404
+msgid "E145: Shell commands not allowed in rvim"
+msgstr "E145: rvim nepovoµuje pou¾itie príkazov shellu"
+
#: ../ex_cmds.c:3498
msgid "E146: Regular expressions can't be delimited by letters"
msgstr "E146: Regulárne výrazy nesmú by» oddelené písmenami"
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 tillåtna i rvim"
+
#: ../ex_cmds.c:3492
msgid "E146: Regular expressions can't be delimited by letters"
msgstr "E146: Reguljära uttryck kan inte vara åtskilda av bokstäver"
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)