-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathstarting.txt
1761 lines (1481 loc) · 75.2 KB
/
starting.txt
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
*starting.txt* For Vim version 9.1. Last change: 2025 Feb 27
VIM REFERENCE MANUAL by Bram Moolenaar
Starting Vim *starting*
1. Vim arguments |vim-arguments|
2. Vim on the Amiga |starting-amiga|
3. Running eVim |evim-keys|
4. Initialization |initialization|
5. $VIM and $VIMRUNTIME |$VIM|
6. Suspending |suspend|
7. Exiting |exiting|
8. Saving settings |save-settings|
9. Views and Sessions |views-sessions|
10. The viminfo file |viminfo-file|
==============================================================================
1. Vim arguments *vim-arguments*
Most often, Vim is started to edit a single file with the command
vim filename *-vim*
More generally, Vim is started with:
vim [option | filename] ..
Option arguments and file name arguments can be mixed, and any number of them
can be given. However, watch out for options that take an argument.
For compatibility with various Vi versions, see |cmdline-arguments|.
Exactly one out of the following five items may be used to choose how to
start editing:
*-file* *---*
filename One or more file names. The first one will be the current
file and read into the buffer. The cursor will be positioned
on the first line of the buffer.
To avoid a file name starting with a '-' being interpreted as
an option, precede the arglist with "--", e.g.: >
vim -- -filename
< All arguments after the "--" will be interpreted as file names,
no other options or "+command" argument can follow.
For behavior of quotes on MS-Windows, see |win32-quotes|.
*--*
- This argument can mean two things, depending on whether Ex
mode is to be used.
Starting in Normal mode: >
vim -
ex -v -
< Start editing a new buffer, which is filled with text
that is read from stdin. The commands that would normally be
read from stdin will now be read from stderr. Example: >
find . -name "*.c" -print | vim -
< The buffer will be marked as modified, so that you are
reminded to save the text when trying to exit. If you don't
like that, put this these lines in your vimrc: >
" Don't set 'modified' when reading from stdin
au StdinReadPost * set nomodified
<
Starting in Ex mode: >
ex -
vim -e -
exim -
vim -E
< Start editing in silent mode. See |-s-ex|.
*-t* *-tag*
-t {tag} A tag. "tag" is looked up in the tags file, the associated
file becomes the current file, and the associated command is
executed. Mostly this is used for C programs, in which case
"tag" often is a function name. The effect is that the file
containing that function becomes the current file and the
cursor is positioned on the start of the function (see
|tags|).
*-q* *-qf*
-q [errorfile] QuickFix mode. The file with the name [errorfile] is read
and the first error is displayed. See |quickfix|.
If [errorfile] is not given, the 'errorfile' option is used
for the file name. See 'errorfile' for the default value.
(nothing) Without one of the four items above, Vim will start editing a
new buffer. It's empty and doesn't have a file name.
The startup mode can be changed by using another name instead of "vim", which
is equal to giving options:
ex vim -e Start in Ex mode (see |Ex-mode|). *ex*
exim vim -E Start in improved Ex mode (see |Ex-mode|). *exim*
(normally not installed)
view vim -R Start in read-only mode (see |-R|). *view*
gvim vim -g Start the GUI (see |gui|). *gvim*
gex vim -eg Start the GUI in Ex mode. *gex*
gview vim -Rg Start the GUI in read-only mode. *gview*
rvim vim -Z Like "vim", but in restricted mode (see |-Z|) *rvim*
rview vim -RZ Like "view", but in restricted mode. *rview*
rgvim vim -gZ Like "gvim", but in restricted mode. *rgvim*
rgview vim -RgZ Like "gview", but in restricted mode. *rgview*
evim vim -y Easy Vim: set 'insertmode' (see |-y|) *evim*
eview vim -yR Like "evim" in read-only mode *eview*
vimdiff vim -d Start in diff mode |diff-mode|
gvimdiff vim -gd Start in diff mode |diff-mode|
Additional characters may follow, they are ignored. For example, you can have
"gvim-8" to start the GUI. You must have an executable by that name then, of
course.
On Unix, you would normally have one executable called "vim", and links from
the different startup-names to that executable. If your system does not
support links and you do not want to have several copies of the executable,
you could use an alias instead. For example, in a C shell descendant: >
alias view vim -R
alias gvim vim -g
<
*startup-options*
The option arguments may be given in any order. Single-letter options can be
combined after one dash. There can be no option arguments after the "--"
argument.
On VMS all option arguments are assumed to be lowercase, unless preceded with
a slash. Thus "-R" means recovery and "-/R" readonly.
--help *-h* *--help* *-?*
-?
-h Give usage (help) message and exit.
See |info-message| about capturing the text.
*--version*
--version Print version information and exit. Same output as for
|:version| command.
See |info-message| about capturing the text.
*--noplugin*
--noplugin Skip loading plugins. Resets the 'loadplugins' option.
Note that the |-u| argument may also disable loading plugins:
argument load: vimrc files plugins defaults.vim ~
(nothing) yes yes yes
-u NONE no no no
-u DEFAULTS no no yes
-u NORC no yes no
--noplugin yes no yes
--startuptime {fname} *--startuptime*
During startup write timing messages to the file {fname}.
This can be used to find out where time is spent while loading
your .vimrc, plugins and opening the first file.
When {fname} already exists new messages are appended.
{only available when compiled with the |+startuptime|
feature}
*--literal*
--literal Take file names literally, don't expand wildcards. Not needed
for Unix, because Vim always takes file names literally (the
shell expands wildcards).
Applies to all the names, also the ones that come before this
argument.
*-+*
+[num] The cursor will be positioned on line "num" for the first
file being edited. If "num" is missing, the cursor will be
positioned on the last line.
*-+/*
+/{pat} The cursor will be positioned on the first line containing
"pat" in the first file being edited (see |pattern| for the
available search patterns). The search starts at the cursor
position, which can be the first line or the cursor position
last used from |viminfo|. To force a search from the first
line use "+1 +/pat".
+{command} *-+c* *-c*
-c {command} {command} will be executed after the first file has been
read (and after autocommands and modelines for that file have
been processed). "command" is interpreted as an Ex command.
If the "command" contains spaces, it must be enclosed in
double quotes (this depends on the shell that is used).
Example: >
vim "+set si" main.c
vim "+find stdio.h"
vim -c "set ff=dos" -c wq mine.mak
<
Note: You can use up to 10 "+" or "-c" arguments in a Vim
command. They are executed in the order given. A "-S"
argument counts as a "-c" argument as well.
--cmd {command} *--cmd*
{command} will be executed before processing any vimrc file.
Otherwise, it acts like -c {command}. You can use up to 10 of
these commands, independently from "-c" commands.
*-S*
-S {file} The {file} will be sourced after the first file has been read.
This is an easy way to do the equivalent of: >
-c "source {file}"
< It can be mixed with "-c" arguments and repeated like "-c".
The limit of 10 "-c" arguments applies here as well.
{file} cannot start with a "-".
Do not use this for running a script to do some work and exit
Vim, you won't see error messages. Use |-u| instead.
-S Works like "-S Session.vim". Only when used as the last
argument or when another "-" option follows.
*-r*
-r Recovery mode. Without a file name argument, a list of
existing swap files is given. With a file name, a swap file
is read to recover a crashed editing session. See
|crash-recovery|.
*-L*
-L Same as -r.
*-R*
-R Readonly mode. The 'readonly' option will be set for all the
files being edited. You can still edit the buffer, but will
be prevented from accidentally overwriting a file. If you
forgot that you are in View mode and did make some changes,
you can overwrite a file by adding an exclamation mark to
the Ex command, as in ":w!". The 'readonly' option can be
reset with ":set noro" (see the options chapter, |options|).
Subsequent edits will not be done in readonly mode. Calling
the executable "view" has the same effect as the -R argument.
The 'updatecount' option will be set to 10000, meaning that
the swap file will not be updated automatically very often.
See |-M| for disallowing modifications.
*-m*
-m Modifications not allowed to be written. The 'write' option
will be reset, so that writing files is disabled. However,
the 'write' option can be set to enable writing again.
*-M*
-M Modifications not allowed. The 'modifiable' option will be
reset, so that changes are not allowed. The 'write' option
will be reset, so that writing files is disabled. However,
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()|,
|job_start()|, |setenv()| 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.
For Unix restricted mode is used when the last part of $SHELL
is "nologin" or "false".
Note that the user may still find a loophole to execute a
shell command, it has only been made difficult.
*-g*
-g Start Vim in GUI mode. See |gui|. For the opposite see |-v|.
*-v*
-v Start Ex in Vi mode. Only makes a difference when the
executable is called "ex" or "gvim". For gvim the GUI is not
started if possible.
*-e*
-e Start Vim in Ex mode, see |Ex-mode|. Only makes a difference
when the executable is not called "ex".
*-E*
-E Start Vim in improved Ex mode |gQ|. Only makes a difference
when the executable is not called "exim".
*-s-ex*
-s Silent or batch mode. Only when Vim was started as "ex" or
when preceded with the "-e" argument. Otherwise, see |-s|,
which does take an argument while this use of "-s" doesn't.
To be used when Vim is used to execute Ex commands from a file
instead of a terminal. Switches off most prompts and
informative messages. Also warnings and error messages.
The output of these commands is displayed (to stdout):
:print
:list
:number
:set to display option values.
When 'verbose' is non-zero, messages are printed (for
debugging, to stderr).
'term' and $TERM are not used.
If Vim appears to be stuck, try typing "qa!<Enter>". You
don't get a prompt, thus you can't see Vim is waiting for you
to type something.
Initializations are skipped (except the ones given with the
"-u" argument).
Example: >
vim -e -s < thefilter thefile
< For the opposite, to see errors from the script, execute the
file with the |-u| flag: >
vim -u thefilter thefile
<
*-b*
-b Binary mode. File I/O will only recognize <NL> to separate
lines. The 'expandtab' option will be reset. The 'textwidth'
option is set to 0. 'modeline' is reset. The 'binary' option
is set. This is done after reading the vimrc/exrc files but
before reading any file in the arglist. See also
|edit-binary|.
*-l*
-l Lisp mode. Sets the 'lisp' and 'showmatch' options on.
*-A*
-A Arabic mode. Sets the 'arabic' option on. {only when
compiled with the |+arabic| features (which include
|+rightleft|), otherwise, Vim gives an error message
and exits}
*-F*
-F This was used for Farsi mode, which has been removed.
See |farsi.txt|.
*-H*
-H Hebrew mode. Sets the 'hkmap' and 'rightleft' options on.
{only when compiled with the |+rightleft| feature, otherwise,
Vim gives an error message and exits}
*-V* *verbose*
-V[N] Verbose. Sets the 'verbose' option to [N] (default: 10).
Messages will be given for each file that is ":source"d and
for reading or writing a viminfo file. Can be used to find
out what is happening upon startup and exit.
Example: >
vim -V8 foobar
-V[N]{filename}
Like -V and set 'verbosefile' to {filename}. The result is
that messages are not displayed but written to the file
{filename}. {filename} must not start with a digit.
Example: >
vim -V20vimlog foobar
<
--log {filename} *--log*
Start logging and write entries to {filename}.
This works like calling `ch_logfile({filename}, 'ao')` very
early during startup.
{only available with the |+eval| and |+channel| feature}
*-D*
-D Debugging. Go to debugging mode when executing the first
command from a script. |debug-mode|
{not available when compiled without the |+eval| feature}
*-C*
-C Compatible mode. Sets the 'compatible' option. You can use
this to get 'compatible', even though a .vimrc file exists.
Keep in mind that the command ":set nocompatible" in some
plugin or startup script overrules this, so you may end up
with 'nocompatible' anyway. To find out, use: >
:verbose set compatible?
< Several plugins won't work with 'compatible' set. You may
want to set it after startup this way: >
vim "+set cp" filename
< Also see |compatible-default|.
*-N*
-N Not compatible mode. Resets the 'compatible' option. You can
use this to get 'nocompatible', when there is no .vimrc file
or when using "-u NONE".
Also see |compatible-default|.
*-y* *easy*
-y Easy mode. Implied for |evim| and |eview|. Starts with
'insertmode' set and behaves like a click-and-type editor.
This sources the script $VIMRUNTIME/evim.vim. Mappings are
set up to work like most click-and-type editors, see
|evim-keys|. The GUI is started when available.
*-n*
-n No swap file will be used. Recovery after a crash will be
impossible. Handy if you want to view or edit a file on a
very slow medium (e.g., a floppy).
Can also be done with ":set updatecount=0". You can switch it
on again by setting the 'updatecount' option to some value,
e.g., ":set uc=100".
NOTE: Don't combine -n with -b, making -nb, because that has a
different meaning: |-nb|.
'updatecount' is set to 0 AFTER executing commands from a
vimrc file, but before the GUI initializations. Thus it
overrides a setting for 'updatecount' in a vimrc file, but not
in a gvimrc file. See |startup|.
When you want to reduce accesses to the disk (e.g., for a
laptop), don't use "-n", but set 'updatetime' and
'updatecount' to very big numbers, and type ":preserve" when
you want to save your work. This way you keep the possibility
for crash recovery.
*-o*
-o[N] Open N windows, split horizontally. If [N] is not given,
one window is opened for every file given as argument. If
there is not enough room, only the first few files get a
window. If there are more windows than arguments, the last
few windows will be editing an empty file.
*-O*
-O[N] Open N windows, split vertically. Otherwise, it's like -o.
If both the -o and the -O option are given, the last one on
the command line determines how the windows will be split.
*-p*
-p[N] Open N tab pages. If [N] is not given, one tab page is opened
for every file given as argument. The maximum is set with
'tabpagemax' pages (default 10). If there are more tab pages
than arguments, the last few tab pages will be editing an
empty file. Also see |tabpage|.
*-T*
-T {terminal} Set the terminal type to "terminal". This influences the
codes that Vim will send to your terminal. This is normally
not needed, because Vim will be able to find out what type
of terminal you are using. (See |terminal-info|.)
*--not-a-term*
--not-a-term Tells Vim that the user knows that the input and/or output is
not connected to a terminal. This will avoid the warning and
the two second delay that would happen.
Also avoids the "Reading from stdin..." as well as the
"N files to edit" message.
--gui-dialog-file {name} *--gui-dialog-file*
When using the GUI, instead of showing a dialog, write the
title and message of the dialog to file {name}. The file is
created or appended to. Only useful for testing, to avoid
that the test gets stuck on a dialog that can't be seen.
Without the GUI the argument is ignored.
*--ttyfail*
--ttyfail When the stdin or stdout is not a terminal (tty) then exit
right away.
*-d*
-d Start in diff mode, like |vimdiff|.
{not available when compiled without the |+diff| feature}
-d {device} Only on the Amiga and when not compiled with the |+diff|
feature. Works like "-dev".
*-dev*
-dev {device} Only on the Amiga: The {device} is opened to be used for
editing.
Normally you would use this to set the window position and
size: "-d con:x/y/width/height", e.g.,
"-d con:30/10/600/150". But you can also use it to start
editing on another device, e.g., AUX:.
*-f*
-f GUI: Do not disconnect from the program that started Vim.
'f' stands for "foreground". If omitted, the GUI forks a new
process and exits the current one. "-f" should be used when
gvim is started by a program that will wait for the edit
session to finish (e.g., mail or readnews). If you want gvim
never to fork, include 'f' in 'guioptions' in your |gvimrc|.
Careful: You can use "-gf" to start the GUI in the foreground,
but "-fg" is used to specify the foreground color. |gui-fork|
Amiga: Do not restart Vim to open a new window. This
option should be used when Vim is started by a program that
will wait for the edit session to finish (e.g., mail or
readnews). See |amiga-window|.
MS-Windows: This option is not supported. However, when
running Vim with an installed vim.bat or gvim.bat file it
works.
*--nofork*
--nofork GUI: Do not fork. Same as |-f|.
*-u* *E282*
-u {vimrc} The file {vimrc} is read for initializations. Most other
initializations are skipped; see |initialization|.
This can be used to start Vim in a special mode, with special
mappings and settings. A shell alias can be used to make
this easy to use. For example, in a C shell descendant: >
alias vimc 'vim -u ~/.c_vimrc \!*'
< And in a Bash shell: >
alias vimc='vim -u ~/.c_vimrc'
< Also consider using autocommands; see |autocommand|.
When {vimrc} is equal to "NONE" (all uppercase), all
initializations from files and environment variables are
skipped, including reading the |gvimrc| file when the GUI
starts. Loading plugins is also skipped.
When {vimrc} is equal to "NORC" (all uppercase), this has the
same effect as "NONE", but loading plugins is not skipped.
When {vimrc} is equal to "DEFAULTS" (all uppercase), this has
the same effect as "NONE", but the |defaults.vim| script is
loaded, which will also set 'nocompatible'. Also see
|--clean|.
Using the "-u" argument with another argument than DEFAULTS
has the side effect that the 'compatible' option will be on by
default. This can have unexpected effects. See
|'compatible'|.
*-U* *E230*
-U {gvimrc} The file {gvimrc} is read for initializations when the GUI
starts. Other GUI initializations are skipped. When {gvimrc}
is equal to "NONE", no file is read for GUI initializations at
all. |gui-init|
Exception: Reading the system-wide menu file is always done.
*-i*
-i {viminfo} The file "viminfo" is used instead of the default viminfo
file. If the name "NONE" is used (all uppercase), no viminfo
file is read or written, even if 'viminfo' is set or when
":rv" or ":wv" are used. See also |viminfo-file|.
*--clean*
--clean Similar to "-u DEFAULTS -U NONE -i NONE":
- initializations from files and environment variables is
skipped
- 'runtimepath' and 'packpath' are set to exclude home
directory entries (does not happen with -u DEFAULTS).
- the |defaults.vim| script is loaded, which implies
'nocompatible': use Vim defaults
- no |gvimrc| script is loaded
- no viminfo file is read or written
Note that a following "-u" argument overrules the effect of
"-u DEFAULTS".
*-x*
-x Use encryption to read/write files. Will prompt for a key,
which is then stored in the 'key' option. All writes will
then use this key to encrypt the text. The '-x' argument is
not needed when reading a file, because there is a check if
the file that is being read has been encrypted, and Vim asks
for a key automatically. |encryption|
{only available when compiled with the |+cryptv| feature}
*-X*
-X Do not try connecting to the X server to get the current
window title and copy/paste using the X clipboard. This
avoids a long startup time when running Vim in a terminal
emulator and the connection to the X server is slow.
See |--startuptime| to find out if this affects you.
Only makes a difference on Unix or VMS, when compiled with the
|+X11| feature. Otherwise, it's ignored.
To disable the connection only for specific terminals, see the
'clipboard' option.
When the X11 Session Management Protocol (XSMP) handler has
been built in, the -X option also disables that connection as
it, too, may have undesirable delays.
When the connection is desired later anyway (e.g., for
client-server messages), call the |serverlist()| function.
This does not enable the XSMP handler though.
*-s*
-s {scriptin} The script file "scriptin" is read. The characters in the
file are interpreted as if you had typed them. The same can
be done with the command ":source! {scriptin}". If the end
of the file is reached before the editor exits, further
characters are read from the keyboard. Only works when not
started in Ex mode, see |-s-ex|. See also |complex-repeat|.
*-w_nr*
-w {number}
-w{number} Set the 'window' option to {number}.
*-w*
-w {scriptout} All the characters that you type are recorded in the file
"scriptout", until you exit Vim. This is useful if you want
to create a script file to be used with "vim -s" or
":source!". When the "scriptout" file already exists, new
characters are appended. See also |complex-repeat|.
{scriptout} cannot start with a digit.
If you want to record what is typed in a human readable form,
you can use |ch_logfile()|. It adds "raw key input" lines.
Also see |--log|.
*-W*
-W {scriptout} Like -w, but do not append, overwrite an existing file.
--remote [+{cmd}] {file} ...
Open the {file} in another Vim that functions as a server.
Any non-file arguments must come before this.
See |--remote|.
--remote-silent [+{cmd}] {file} ...
Like --remote, but don't complain if there is no server.
See |--remote-silent|.
--remote-wait [+{cmd}] {file} ...
Like --remote, but wait for the server to finish editing the
file(s).
See |--remote-wait|.
--remote-wait-silent [+{cmd}] {file} ...
Like --remote-wait, but don't complain if there is no server.
See |--remote-wait-silent|.
--servername {name}
Specify the name of the Vim server to send to or to become.
See |--servername|.
--remote-send {keys}
Send {keys} to a Vim server and exit.
See |--remote-send|.
--remote-expr {expr}
Evaluate {expr} in another Vim that functions as a server.
The result is printed on stdout.
See |--remote-expr|.
--serverlist Output a list of Vim server names and exit. See
|--serverlist|.
--socketid {id} *--socketid*
GTK+ GUI Vim only. Make gvim try to use GtkPlug mechanism, so
that it runs inside another window. See |gui-gtk-socketid|
for details.
--windowid {id} *--windowid*
Win32 GUI Vim only. Make gvim try to use the window {id} as a
parent, so that it runs inside that window. See
|gui-w32-windowid| for details.
--echo-wid *--echo-wid*
GTK+ GUI Vim only. Make gvim echo the Window ID on stdout,
which can be used to run gvim in a kpart widget. The format
of the output is: >
WID: 12345\n
--role {role} *--role*
GTK+ 2 GUI only. Set the role of the main window to {role}.
The window role can be used by a window manager to uniquely
identify a window, in order to restore window placement and
such. The --role argument is passed automatically when
restoring the session on login. See |gui-gnome-session|
-P {parent-title} *-P* *MDI* *E671* *E672*
Win32 only: Specify the title of the parent application. When
possible, Vim will run in an MDI window inside the
application.
{parent-title} must appear in the window title of the parent
application. Make sure that it is specific enough.
Note that the implementation is still primitive. It won't
work with all applications and the menu doesn't work.
-nb *-nb*
-nb={fname}
-nb:{hostname}:{addr}:{password}
Attempt connecting to Netbeans and become an editor server for
it. The second form specifies a file to read connection info
from. The third form specifies the hostname, address and
password for connecting to Netbeans. |netbeans-run|
{only available when compiled with the |+netbeans_intg|
feature; if not then -nb will make Vim exit}
If the executable is called "view", Vim will start in Readonly mode. This is
useful if you can make a hard or symbolic link from "view" to "vim".
Starting in Readonly mode can also be done with "vim -R".
If the executable is called "ex", Vim will start in "Ex" mode. This means it
will accept only ":" commands. But when the "-v" argument is given, Vim will
start in Normal mode anyway.
Additional arguments are available on Unix like systems when compiled with
X11 GUI support. See |gui-resources|.
==============================================================================
2. Vim on the Amiga *starting-amiga*
Starting Vim from the Workbench *workbench*
-------------------------------
Vim can be started from the Workbench by clicking on its icon twice. It will
then start with an empty buffer.
Vim can be started to edit one or more files by using a "Project" icon. The
"Default Tool" of the icon must be the full pathname of the Vim executable.
The name of the ".info" file must be the same as the name of the text file.
By clicking on this icon twice, Vim will be started with the file name as
current file name, which will be read into the buffer (if it exists). You can
edit multiple files by pressing the shift key while clicking on icons, and
clicking twice on the last one. The "Default Tool" for all these icons must
be the same.
It is not possible to give arguments to Vim, other than file names, from the
workbench.
Vim window *amiga-window*
----------
Vim will run in the CLI window where it was started. If Vim was started with
the "run" or "runback" command, or if Vim was started from the workbench, it
will open a window of its own.
Technical detail:
To open the new window a little trick is used. As soon as Vim
recognizes that it does not run in a normal CLI window, it will
create a script file in "t:". This script file contains the same
command as the one Vim was started with, and an "endcli" command.
This script file is then executed with a "newcli" command (the "c:run"
and "c:newcli" commands are required for this to work). The script
file will hang around until reboot, or until you delete it. This
method is required to get the ":sh" and ":!" commands to work
correctly. But when Vim was started with the -f option (foreground
mode), this method is not used. The reason for this is that
when a program starts Vim with the -f option it will wait for Vim to
exit. With the script trick, the calling program does not know when
Vim exits. The -f option can be used when Vim is started by a mail
program which also waits for the edit session to finish. As a
consequence, the ":sh" and ":!" commands are not available when the
-f option is used.
Vim will automatically recognize the window size and react to window
resizing. Under Amiga DOS 1.3, it is advised to use the fastfonts program,
"FF", to speed up display redrawing.
==============================================================================
3. Running eVim *evim-keys*
EVim runs Vim as click-and-type editor. This is very unlike the original Vi
idea. But it helps for people that don't use Vim often enough to learn the
commands. Hopefully they will find out that learning to use Normal mode
commands will make their editing much more effective.
In Evim these options are changed from their default value:
:set nocompatible Use Vim improvements
:set insertmode Remain in Insert mode most of the time
:set hidden Keep invisible buffers loaded
:set backup Keep backup files (not for VMS)
:set backspace=2 Backspace over everything
:set autoindent auto-indent new lines
:set history=50 keep 50 lines of Ex commands
:set ruler show the cursor position
:set incsearch show matches halfway typing a pattern
:set mouse=a use the mouse in all modes
:set hlsearch highlight all matches for a search pattern
:set whichwrap+=<,>,[,] <Left> and <Right> wrap around line breaks
:set guioptions-=a non-Unix only: don't do auto-select
Key mappings:
<CTRL-Q> quit, using `:confirm` prompt if there are changes
<Down> moves by screen lines rather than file lines
<Up> idem
Q does "gq", formatting, instead of Ex mode
<BS> in Visual mode: deletes the selection
CTRL-X in Visual mode: Cut to clipboard
<S-Del> idem
CTRL-C in Visual mode: Copy to clipboard
<C-Insert> idem
CTRL-V Pastes from the clipboard (in any mode)
<S-Insert> idem
CTRL-Z undo
CTRL-Y redo
<M-Space> system menu
CTRL-A select all
<C-Tab> next window, CTRL-W w
<C-F4> close window, CTRL-W c
Additionally:
- ":behave mswin" is used |:behave|
- syntax highlighting is enabled
- filetype detection is enabled, filetype plugins and indenting is enabled
- in a text file 'textwidth' is set to 78
One hint: If you want to go to Normal mode to be able to type a sequence of
commands, use CTRL-L. |i_CTRL-L|
There is no way to stop "easy mode", you need to exit Vim.
==============================================================================
4. Initialization *initialization* *startup*
This section is about the non-GUI version of Vim. See |gui-fork| for
additional initialization when starting the GUI.
At startup, Vim checks environment variables and files and sets values
accordingly. Vim proceeds in this order:
1. Set the 'shell' and 'term' option *SHELL* *COMSPEC* *TERM*
The environment variable SHELL, if it exists, is used to set the
'shell' option. On Win32, the COMSPEC variable is used
if SHELL is not set.
The environment variable TERM, if it exists, is used to set the 'term'
option. However, 'term' will change later when starting the GUI (step
8 below).
2. Process the arguments
The options and file names from the command that start Vim are
inspected.
The |-V| argument can be used to display or log what happens next,
useful for debugging the initializations.
The |--cmd| arguments are executed.
Buffers are created for all files (but not loaded yet).
3. Execute Ex commands, from environment variables and/or files
An environment variable is read as one Ex command line, where multiple
commands must be separated with '|' or "<NL>".
*vimrc* *exrc*
A file that contains initialization commands is called a "vimrc" file.
Each line in a vimrc file is executed as an Ex command line. It is
sometimes also referred to as "exrc" file. They are the same type of
file, but "exrc" is what Vi always used, "vimrc" is a Vim specific
name. Also see |vimrc-intro|.
Places for your personal initializations:
Unix $HOME/.vimrc, $HOME/.vim/vimrc
or $XDG_CONFIG_HOME/vim/vimrc
MS-Windows $HOME/_vimrc, $HOME/vimfiles/vimrc
or $VIM/_vimrc
Amiga s:.vimrc, home:.vimrc, home:vimfiles:vimrc
or $VIM/.vimrc
Haiku $HOME/config/settings/vim/vimrc
The files are searched in the order specified above and only the first
one that is found is read.
RECOMMENDATION: Put all your Vim configuration stuff in the
$HOME/.vim/ directory ($HOME/vimfiles/ for MS-Windows). That makes it
easy to copy it to another system.
If Vim was started with "-u filename", the file "filename" is used.
All following initializations until 4. are skipped. `$MYVIMRC` and
`$MYVIMDIR` are not set (but `$MYVIMDIR` will be set, if 'rtp' is
updated).
"vim -u NORC" can be used to skip these initializations without
reading a file. "vim -u NONE" also skips loading plugins. |-u|
If Vim was started in Ex mode with the "-s" argument, all following
initializations until 4. are skipped. Only the "-u" option is
interpreted.
*evim.vim*
a. If Vim was started as |evim| or |eview| or with the |-y| argument, the
script $VIMRUNTIME/evim.vim will be loaded.
*system-vimrc*
b. For Unix, MS-Windows, VMS, Macintosh and Amiga the system vimrc file
is read for initializations. The path of this file is shown with the
":version" command. Mostly it's "$VIM/vimrc". Note that this file is
ALWAYS read in 'compatible' mode, since the automatic resetting of
'compatible' is only done later. Add a ":set nocp" command if you
like. For the Macintosh the $VIMRUNTIME/macmap.vim is read.
*VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc*
*$MYVIMRC* *$MYVIMDIR*
c. Five places are searched for initializations. The first that exists
is used, the others are ignored. The `$MYVIMRC` environment variable is
set to the file that was first found, unless `$MYVIMRC` was already set
when using VIMINIT. The `$MYVIMDIR` environment variable is
set to the personal 'rtp' directory, however it is not verified
that the directory actually exists.
I The environment variable VIMINIT (see also |compatible-default|) (*)
The value of $VIMINIT is used as an Ex command line.
II The user vimrc file(s):
"$HOME/.vimrc" (for Unix) (*)
"$HOME/.vim/vimrc" (for Unix) (*)
"$XDG_CONFIG_HOME/vim/vimrc" (for Unix) (*)
"s:.vimrc" (for Amiga) (*)
"home:.vimrc" (for Amiga) (*)
"home:vimfiles:vimrc" (for Amiga) (*)
"$VIM/.vimrc" (for Amiga) (*)
"$HOME/_vimrc" (for Win32) (*)
"$HOME/vimfiles/vimrc" (for Win32) (*)
"$VIM/_vimrc" (for Win32) (*)
"$HOME/config/settings/vim/vimrc" (for Haiku) (*)
Note: For Unix and Amiga, when ".vimrc" does not exist,
"_vimrc" is also tried, in case an MS-DOS compatible file
system is used. For MS-Windows ".vimrc" is checked after
"_vimrc", in case long file names are used.
Note: For Win32, "$HOME" is checked first. If no "_vimrc" or
".vimrc" is found there, "$VIM" is tried. See |$VIM| for when
$VIM is not set.
III The environment variable EXINIT.
The value of $EXINIT is used as an Ex command line.
IV The user exrc file(s). Same as for the user vimrc file, but with
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
used, depending on the system. And without the (*)!
V The default vimrc file, $VIMRUNTIME/defaults.vim. This sets up
options values and has "syntax on" and "filetype on" commands,
which is what most new users will want. See |defaults.vim|.
d. If the 'exrc' option is on (which is NOT the default), the current
directory is searched for three files. The first that exists is used,
the others are ignored.
- The file ".vimrc" (for Unix, Amiga) (*)
"_vimrc" (for Win32) (*)
- The file "_vimrc" (for Unix, Amiga) (*)
".vimrc" (for Win32) (*)
- The file ".exrc" (for Unix, Amiga)
"_exrc" (for Win32)
(*) Using this file or environment variable will cause 'compatible' to be
off by default. See |compatible-default|.
Note: When using the |mzscheme| interface, it is initialized after loading
the vimrc file. Changing 'mzschemedll' later has no effect.
4. Load the plugin scripts. *load-plugins*
This does the same as the command: >
:runtime! plugin/**/*.vim
< The result is that all directories in the 'runtimepath' option will be
searched for the "plugin" sub-directory and all files ending in ".vim"
will be sourced (in alphabetical order per directory), also in
subdirectories.
However, directories in 'runtimepath' ending in "after" are skipped
here and only loaded after packages, see below.
Loading plugins won't be done when:
- The 'loadplugins' option was reset in a vimrc file.
- The |--noplugin| command line argument is used.
- The |--clean| command line argument is used.
- The "-u NONE" command line argument is used |-u|.
- When Vim was compiled without the |+eval| feature.
Note that using "-c 'set noloadplugins'" doesn't work, because the
commands from the command line have not been executed yet. You can
use "--cmd 'set noloadplugins'" or "--cmd 'set loadplugins'" |--cmd|.
Packages are loaded. These are plugins, as above, but found in the
"start" directory of each entry in 'packpath'. Every plugin directory
found is added in 'runtimepath' and then the plugins are sourced. See
|packages|.
The plugins scripts are loaded, as above, but now only the directories
ending in "after" are used. Note that 'runtimepath' will have changed
if packages have been found, but that should not add a directory
ending in "after".
5. Set 'shellpipe' and 'shellredir'
The 'shellpipe' and 'shellredir' options are set according to the
value of the 'shell' option, unless they have been set before.
This means that Vim will figure out the values of 'shellpipe' and
'shellredir' for you, unless you have set them yourself.
6. Set 'updatecount' to zero, if "-n" command argument used.
7. Set binary options
If the "-b" flag was given to Vim, the options for binary editing will
be set now. See |-b|.
8. Perform GUI initializations
Only when starting "gvim", the GUI initializations will be done. See
|gui-init|.
9. Read the viminfo file
If the 'viminfo' option is not empty, the viminfo file is read. See
|viminfo-file|.
10. Read the quickfix file
If the "-q" flag was given to Vim, the quickfix file is read. If this
fails, Vim exits.
11. Open all windows
When the |-o| flag was given, windows will be opened (but not
displayed yet).
When the |-p| flag was given, tab pages will be created (but not
displayed yet).
When switching screens, it happens now. Redrawing starts.
If the "-q" flag was given to Vim, the first error is jumped to.
Buffers for all windows will be loaded, without triggering |BufAdd|
autocommands.
12. Execute startup commands
If a "-t" flag was given to Vim, the tag is jumped to.
The commands given with the |-c| and |+cmd| arguments are executed.
If the 'insertmode' option is set, Insert mode is entered.
The starting flag is reset, has("vim_starting") will now return zero.
The |v:vim_did_enter| variable is set to 1.
The |VimEnter| autocommands are executed.
The `$MYVIMRC` or `$MYGVIMRC` environment variable will be set to the first found
vimrc and/or gvimrc file while `$MYVIMDIR` is set to the users personal runtime
directory 'rtp' (typically the first entry in 'runtimepath'). If 'rtp'
changes, `$MYVIMDIR` will be updated.
Note: These environment variables resolve symbolic links, but 'rtp' does not.
Some hints on using initializations ~
Standard setup:
Create a vimrc file to set the default settings and mappings for all your edit
sessions. Put it in a place so that it will be found by 3b.:
~/.vimrc (Unix)
s:.vimrc (Amiga)
$VIM\_vimrc (Win32)
~/config/settings/vim/vimrc (Haiku)
Note that creating a vimrc file will cause the 'compatible' option to be off
by default. See |compatible-default|.
Local setup:
Put all commands that you need for editing a specific directory only into a
vimrc file and place it in that directory under the name ".vimrc" ("_vimrc"
for Win32). NOTE: To make Vim look for these special files you have to turn