Mercurial > vim
comparison runtime/doc/editing.txt @ 16553:0e473e9e70c2 v8.1.1280
patch 8.1.1280: remarks about functionality not in Vi clutters the help
commit https://github.com/vim/vim/commit/25c9c680ec4dfbb51f4ef21c3460a48d3c67ffc8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 5 18:13:34 2019 +0200
patch 8.1.1280: remarks about functionality not in Vi clutters the help
Problem: Remarks about functionality not in Vi clutters the help.
Solution: Move all info about what is new in Vim or already existed in Vi to
vi_diff.txt. Remove {not in Vi} remarks. (closes #4268) Add
"noet" to the help files modeline. Also include many other help
file improvements.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 05 May 2019 18:15:06 +0200 |
parents | 8c3a1bd270bb |
children | 1eaf34420bb3 |
comparison
equal
deleted
inserted
replaced
16552:deb3d4f5be8b | 16553:0e473e9e70c2 |
---|---|
1 *editing.txt* For Vim version 8.1. Last change: 2018 Dec 16 | 1 *editing.txt* For Vim version 8.1. Last change: 2019 May 05 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
42 | 42 |
43 *:keepalt* *:keepa* | 43 *:keepalt* *:keepa* |
44 :keepalt {cmd} Execute {cmd} while keeping the current alternate file | 44 :keepalt {cmd} Execute {cmd} while keeping the current alternate file |
45 name. Note that commands invoked indirectly (e.g., | 45 name. Note that commands invoked indirectly (e.g., |
46 with a function) may still set the alternate file | 46 with a function) may still set the alternate file |
47 name. {not in Vi} | 47 name. |
48 | 48 |
49 All file names are remembered in the buffer list. When you enter a file name, | 49 All file names are remembered in the buffer list. When you enter a file name, |
50 for editing (e.g., with ":e filename") or writing (e.g., with ":w filename"), | 50 for editing (e.g., with ":e filename") or writing (e.g., with ":w filename"), |
51 the file name is added to the list. You can use the buffer list to remember | 51 the file name is added to the list. You can use the buffer list to remember |
52 which files you edited and to quickly switch from one file to another (e.g., | 52 which files you edited and to quickly switch from one file to another (e.g., |
58 :f[ile] Prints the current file name (as typed, unless ":cd" | 58 :f[ile] Prints the current file name (as typed, unless ":cd" |
59 was used), the cursor position (unless the 'ruler' | 59 was used), the cursor position (unless the 'ruler' |
60 option is set), and the file status (readonly, | 60 option is set), and the file status (readonly, |
61 modified, read errors, new file). See the 'shortmess' | 61 modified, read errors, new file). See the 'shortmess' |
62 option about how to make this message shorter. | 62 option about how to make this message shorter. |
63 {Vi does not include column number} | |
64 | 63 |
65 :f[ile]! like |:file|, but don't truncate the name even when | 64 :f[ile]! like |:file|, but don't truncate the name even when |
66 'shortmess' indicates this. | 65 'shortmess' indicates this. |
67 | 66 |
68 {count}CTRL-G Like CTRL-G, but prints the current file name with | 67 {count}CTRL-G Like CTRL-G, but prints the current file name with |
69 full path. If the count is higher than 1 the current | 68 full path. If the count is higher than 1 the current |
70 buffer number is also given. {not in Vi} | 69 buffer number is also given. |
71 | 70 |
72 *g_CTRL-G* *word-count* *byte-count* | 71 *g_CTRL-G* *word-count* *byte-count* |
73 g CTRL-G Prints the current position of the cursor in five | 72 g CTRL-G Prints the current position of the cursor in five |
74 ways: Column, Line, Word, Character and Byte. If the | 73 ways: Column, Line, Word, Character and Byte. If the |
75 number of Characters and Bytes is the same then the | 74 number of Characters and Bytes is the same then the |
78 than one position on the screen (<Tab> or special | 77 than one position on the screen (<Tab> or special |
79 character), both the "real" column and the screen | 78 character), both the "real" column and the screen |
80 column are shown, separated with a dash. | 79 column are shown, separated with a dash. |
81 Also see the 'ruler' option and the |wordcount()| | 80 Also see the 'ruler' option and the |wordcount()| |
82 function. | 81 function. |
83 {not in Vi} | |
84 | 82 |
85 *v_g_CTRL-G* | 83 *v_g_CTRL-G* |
86 {Visual}g CTRL-G Similar to "g CTRL-G", but Word, Character, Line, and | 84 {Visual}g CTRL-G Similar to "g CTRL-G", but Word, Character, Line, and |
87 Byte counts for the visually selected region are | 85 Byte counts for the visually selected region are |
88 displayed. | 86 displayed. |
89 In Blockwise mode, Column count is also shown. (For | 87 In Blockwise mode, Column count is also shown. (For |
90 {Visual} see |Visual-mode|.) | 88 {Visual} see |Visual-mode|.) |
91 {not in VI} | |
92 | 89 |
93 *:file_f* | 90 *:file_f* |
94 :f[ile][!] {name} Sets the current file name to {name}. The optional ! | 91 :f[ile][!] {name} Sets the current file name to {name}. The optional ! |
95 avoids truncating the message, as with |:file|. | 92 avoids truncating the message, as with |:file|. |
96 If the buffer did have a name, that name becomes the | 93 If the buffer did have a name, that name becomes the |
97 |alternate-file| name. An unlisted buffer is created | 94 |alternate-file| name. An unlisted buffer is created |
98 to hold the old name. | 95 to hold the old name. |
99 *:0file* | 96 *:0file* |
100 :0f[ile][!] Remove the name of the current buffer. The optional ! | 97 :0f[ile][!] Remove the name of the current buffer. The optional ! |
101 avoids truncating the message, as with |:file|. {not | 98 avoids truncating the message, as with |:file|. |
102 in Vi} | |
103 | 99 |
104 :buffers | 100 :buffers |
105 :files | 101 :files |
106 :ls List all the currently known file names. See | 102 :ls List all the currently known file names. See |
107 'windows.txt' |:files| |:buffers| |:ls|. {not in | 103 'windows.txt' |:files| |:buffers| |:ls|. |
108 Vi} | |
109 | 104 |
110 Vim will remember the full path name of a file name that you enter. In most | 105 Vim will remember the full path name of a file name that you enter. In most |
111 cases when the file name is displayed only the name you typed is shown, but | 106 cases when the file name is displayed only the name you typed is shown, but |
112 the full path name is being used if you used the ":cd" command |:cd|. | 107 the full path name is being used if you used the ":cd" command |:cd|. |
113 | 108 |
242 is set or 'autowriteall' is set and the file can be | 237 is set or 'autowriteall' is set and the file can be |
243 written. | 238 written. |
244 If 'fileformats' is not empty, the first format given | 239 If 'fileformats' is not empty, the first format given |
245 will be used for the new buffer. If 'fileformats' is | 240 will be used for the new buffer. If 'fileformats' is |
246 empty, the 'fileformat' of the current buffer is used. | 241 empty, the 'fileformat' of the current buffer is used. |
247 {not in Vi} | |
248 | 242 |
249 *:ene!* *:enew!* | 243 *:ene!* *:enew!* |
250 :ene[w]! Edit a new, unnamed buffer. Discard any changes to | 244 :ene[w]! Edit a new, unnamed buffer. Discard any changes to |
251 the current buffer. | 245 the current buffer. |
252 Set 'fileformat' like |:enew|. | 246 Set 'fileformat' like |:enew|. |
253 {not in Vi} | |
254 | 247 |
255 *:fin* *:find* | 248 *:fin* *:find* |
256 :fin[d][!] [++opt] [+cmd] {file} | 249 :fin[d][!] [++opt] [+cmd] {file} |
257 Find {file} in 'path' and then |:edit| it. | 250 Find {file} in 'path' and then |:edit| it. |
258 {not in Vi} {not available when the |+file_in_path| | 251 {not available when the |+file_in_path| feature was |
259 feature was disabled at compile time} | 252 disabled at compile time} |
260 | 253 |
261 :{count}fin[d][!] [++opt] [+cmd] {file} | 254 :{count}fin[d][!] [++opt] [+cmd] {file} |
262 Just like ":find", but use the {count} match in | 255 Just like ":find", but use the {count} match in |
263 'path'. Thus ":2find file" will find the second | 256 'path'. Thus ":2find file" will find the second |
264 "file" found in 'path'. When there are fewer matches | 257 "file" found in 'path'. When there are fewer matches |
276 | 269 |
277 *:vie* *:view* | 270 *:vie* *:view* |
278 :vie[w][!] [++opt] [+cmd] file | 271 :vie[w][!] [++opt] [+cmd] file |
279 When used in Ex mode: Leave |Ex-mode|, go back to | 272 When used in Ex mode: Leave |Ex-mode|, go back to |
280 Normal mode. Otherwise same as |:edit|, but set | 273 Normal mode. Otherwise same as |:edit|, but set |
281 'readonly' option for this buffer. {not in Vi} | 274 'readonly' option for this buffer. |
282 | 275 |
283 *CTRL-^* *CTRL-6* | 276 *CTRL-^* *CTRL-6* |
284 CTRL-^ Edit the alternate file. Mostly the alternate file is | 277 CTRL-^ Edit the alternate file. Mostly the alternate file is |
285 the previously edited file. This is a quick way to | 278 the previously edited file. This is a quick way to |
286 toggle between two files. It is equivalent to ":e #", | 279 toggle between two files. It is equivalent to ":e #", |
295 | 288 |
296 {count}CTRL-^ Edit [count]th file in the buffer list (equivalent to | 289 {count}CTRL-^ Edit [count]th file in the buffer list (equivalent to |
297 ":e #[count]"). This is a quick way to switch between | 290 ":e #[count]"). This is a quick way to switch between |
298 files. | 291 files. |
299 See |CTRL-^| above for further details. | 292 See |CTRL-^| above for further details. |
300 {not in Vi} | |
301 | 293 |
302 [count]]f *]f* *[f* | 294 [count]]f *]f* *[f* |
303 [count][f Same as "gf". Deprecated. | 295 [count][f Same as "gf". Deprecated. |
304 | 296 |
305 *gf* *E446* *E447* | 297 *gf* *E446* *E447* |
329 < If the name is a hypertext link, that looks like | 321 < If the name is a hypertext link, that looks like |
330 "type://machine/path", you need the |netrw| plugin. | 322 "type://machine/path", you need the |netrw| plugin. |
331 For Unix the '~' character is expanded, like in | 323 For Unix the '~' character is expanded, like in |
332 "~user/file". Environment variables are expanded too | 324 "~user/file". Environment variables are expanded too |
333 |expand-env|. | 325 |expand-env|. |
334 {not in Vi} | |
335 {not available when the |+file_in_path| feature was | 326 {not available when the |+file_in_path| feature was |
336 disabled at compile time} | 327 disabled at compile time} |
337 | 328 |
338 *v_gf* | 329 *v_gf* |
339 {Visual}[count]gf Same as "gf", but the highlighted text is used as the | 330 {Visual}[count]gf Same as "gf", but the highlighted text is used as the |
340 name of the file to edit. 'isfname' is ignored. | 331 name of the file to edit. 'isfname' is ignored. |
341 Leading blanks are skipped, otherwise all blanks and | 332 Leading blanks are skipped, otherwise all blanks and |
342 special characters are included in the file name. | 333 special characters are included in the file name. |
343 (For {Visual} see |Visual-mode|.) | 334 (For {Visual} see |Visual-mode|.) |
344 {not in VI} | |
345 | 335 |
346 *gF* | 336 *gF* |
347 [count]gF Same as "gf", except if a number follows the file | 337 [count]gF Same as "gf", except if a number follows the file |
348 name, then the cursor is positioned on that line in | 338 name, then the cursor is positioned on that line in |
349 the file. The file name and the number must be | 339 the file. The file name and the number must be |
635 [count] is used like with |:argadd|. | 625 [count] is used like with |:argadd|. |
636 If the current file cannot be |abandon|ed {name}s will | 626 If the current file cannot be |abandon|ed {name}s will |
637 still be added to the argument list, but won't be | 627 still be added to the argument list, but won't be |
638 edited. No check for duplicates is done. | 628 edited. No check for duplicates is done. |
639 Also see |++opt| and |+cmd|. | 629 Also see |++opt| and |+cmd|. |
640 {not in Vi} | |
641 | 630 |
642 :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* | 631 :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* |
643 :[count]arga[dd] | 632 :[count]arga[dd] |
644 Add the {name}s to the argument list. When {name} is | 633 Add the {name}s to the argument list. When {name} is |
645 omitted add the current buffer name to the argument | 634 omitted add the current buffer name to the argument |
657 And after the last one: | 646 And after the last one: |
658 :+2argadd y a b c x y | 647 :+2argadd y a b c x y |
659 There is no check for duplicates, it is possible to | 648 There is no check for duplicates, it is possible to |
660 add a file to the argument list twice. | 649 add a file to the argument list twice. |
661 The currently edited file is not changed. | 650 The currently edited file is not changed. |
662 {not in Vi} | |
663 Note: you can also use this method: > | 651 Note: you can also use this method: > |
664 :args ## x | 652 :args ## x |
665 < This will add the "x" item and sort the new list. | 653 < This will add the "x" item and sort the new list. |
666 | 654 |
667 :argd[elete] {pattern} .. *:argd* *:argdelete* *E480* | 655 :argd[elete] {pattern} .. *:argd* *:argdelete* *E480* |
671 current entry. | 659 current entry. |
672 This command keeps the currently edited file, also | 660 This command keeps the currently edited file, also |
673 when it's deleted from the argument list. | 661 when it's deleted from the argument list. |
674 Example: > | 662 Example: > |
675 :argdel *.obj | 663 :argdel *.obj |
676 < {not in Vi} | |
677 | 664 |
678 :[range]argd[elete] Delete the {range} files from the argument list. | 665 :[range]argd[elete] Delete the {range} files from the argument list. |
679 Example: > | 666 Example: > |
680 :10,$argdel | 667 :10,$argdel |
681 < Deletes arguments 10 and further, keeping 1-9. > | 668 < Deletes arguments 10 and further, keeping 1-9. > |
686 < Deletes the current argument. > | 673 < Deletes the current argument. > |
687 :%argd | 674 :%argd |
688 < Removes all the files from the arglist. | 675 < Removes all the files from the arglist. |
689 When the last number in the range is too high, up to | 676 When the last number in the range is too high, up to |
690 the last argument is deleted. | 677 the last argument is deleted. |
691 {not in Vi} | |
692 | 678 |
693 *:argu* *:argument* | 679 *:argu* *:argument* |
694 :[count]argu[ment] [count] [++opt] [+cmd] | 680 :[count]argu[ment] [count] [++opt] [+cmd] |
695 Edit file [count] in the argument list. When [count] | 681 Edit file [count] in the argument list. When [count] |
696 is omitted the current entry is used. This fails | 682 is omitted the current entry is used. This fails |
697 when changes have been made and Vim does not want to | 683 when changes have been made and Vim does not want to |
698 |abandon| the current buffer. | 684 |abandon| the current buffer. |
699 Also see |++opt| and |+cmd|. | 685 Also see |++opt| and |+cmd|. |
700 {not in Vi} | |
701 | 686 |
702 :[count]argu[ment]! [count] [++opt] [+cmd] | 687 :[count]argu[ment]! [count] [++opt] [+cmd] |
703 Edit file [count] in the argument list, discard any | 688 Edit file [count] in the argument list, discard any |
704 changes to the current buffer. When [count] is | 689 changes to the current buffer. When [count] is |
705 omitted the current entry is used. | 690 omitted the current entry is used. |
706 Also see |++opt| and |+cmd|. | 691 Also see |++opt| and |+cmd|. |
707 {not in Vi} | |
708 | 692 |
709 :[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* | 693 :[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* |
710 Edit [count] next file. This fails when changes have | 694 Edit [count] next file. This fails when changes have |
711 been made and Vim does not want to |abandon| the | 695 been made and Vim does not want to |abandon| the |
712 current buffer. Also see |++opt| and |+cmd|. {Vi: no | 696 current buffer. Also see |++opt| and |+cmd|. {Vi: no |
725 | 709 |
726 :[count]N[ext] [count] [++opt] [+cmd] *:Next* *:N* *E164* | 710 :[count]N[ext] [count] [++opt] [+cmd] *:Next* *:N* *E164* |
727 Edit [count] previous file in argument list. This | 711 Edit [count] previous file in argument list. This |
728 fails when changes have been made and Vim does not | 712 fails when changes have been made and Vim does not |
729 want to |abandon| the current buffer. | 713 want to |abandon| the current buffer. |
730 Also see |++opt| and |+cmd|. {Vi: no count or ++opt}. | 714 Also see |++opt| and |+cmd|. |
731 | 715 |
732 :[count]N[ext]! [count] [++opt] [+cmd] | 716 :[count]N[ext]! [count] [++opt] [+cmd] |
733 Edit [count] previous file in argument list. Discard | 717 Edit [count] previous file in argument list. Discard |
734 any changes to the buffer. Also see |++opt| and | 718 any changes to the buffer. Also see |++opt| and |
735 |+cmd|. {Vi: no count or ++opt}. | 719 |+cmd|. {Vi: no count or ++opt}. |
746 Also see |++opt| and |+cmd|. {Vi: no ++opt} | 730 Also see |++opt| and |+cmd|. {Vi: no ++opt} |
747 | 731 |
748 :rew[ind]! [++opt] [+cmd] | 732 :rew[ind]! [++opt] [+cmd] |
749 Start editing the first file in the argument list. | 733 Start editing the first file in the argument list. |
750 Discard any changes to the buffer. Also see |++opt| | 734 Discard any changes to the buffer. Also see |++opt| |
751 and |+cmd|. {Vi: no ++opt} | 735 and |+cmd|. |
752 | 736 |
753 *:fir* *:first* | 737 *:fir* *:first* |
754 :fir[st][!] [++opt] [+cmd] | 738 :fir[st][!] [++opt] [+cmd] |
755 Other name for ":rewind". {not in Vi} | 739 Other name for ":rewind". |
756 | 740 |
757 *:la* *:last* | 741 *:la* *:last* |
758 :la[st] [++opt] [+cmd] | 742 :la[st] [++opt] [+cmd] |
759 Start editing the last file in the argument list. | 743 Start editing the last file in the argument list. |
760 This fails when changes have been made and Vim does | 744 This fails when changes have been made and Vim does |
761 not want to |abandon| the current buffer. | 745 not want to |abandon| the current buffer. |
762 Also see |++opt| and |+cmd|. {not in Vi} | 746 Also see |++opt| and |+cmd|. |
763 | 747 |
764 :la[st]! [++opt] [+cmd] | 748 :la[st]! [++opt] [+cmd] |
765 Start editing the last file in the argument list. | 749 Start editing the last file in the argument list. |
766 Discard any changes to the buffer. Also see |++opt| | 750 Discard any changes to the buffer. Also see |++opt| |
767 and |+cmd|. {not in Vi} | 751 and |+cmd|. |
768 | 752 |
769 *:wn* *:wnext* | 753 *:wn* *:wnext* |
770 :[count]wn[ext] [++opt] | 754 :[count]wn[ext] [++opt] |
771 Write current file and start editing the [count] | 755 Write current file and start editing the [count] |
772 next file. Also see |++opt| and |+cmd|. {not in Vi} | 756 next file. Also see |++opt| and |+cmd|. |
773 | 757 |
774 :[count]wn[ext] [++opt] {file} | 758 :[count]wn[ext] [++opt] {file} |
775 Write current file to {file} and start editing the | 759 Write current file to {file} and start editing the |
776 [count] next file, unless {file} already exists and | 760 [count] next file, unless {file} already exists and |
777 the 'writeany' option is off. Also see |++opt| and | 761 the 'writeany' option is off. Also see |++opt| and |
778 |+cmd|. {not in Vi} | 762 |+cmd|. |
779 | 763 |
780 :[count]wn[ext]! [++opt] {file} | 764 :[count]wn[ext]! [++opt] {file} |
781 Write current file to {file} and start editing the | 765 Write current file to {file} and start editing the |
782 [count] next file. Also see |++opt| and |+cmd|. {not | 766 [count] next file. Also see |++opt| and |+cmd|. |
783 in Vi} | |
784 | 767 |
785 :[count]wN[ext][!] [++opt] [file] *:wN* *:wNext* | 768 :[count]wN[ext][!] [++opt] [file] *:wN* *:wNext* |
786 :[count]wp[revious][!] [++opt] [file] *:wp* *:wprevious* | 769 :[count]wp[revious][!] [++opt] [file] *:wp* *:wprevious* |
787 Same as :wnext, but go to previous file instead of | 770 Same as :wnext, but go to previous file instead of |
788 next. {not in Vi} | 771 next. |
789 | 772 |
790 The [count] in the commands above defaults to one. For some commands it is | 773 The [count] in the commands above defaults to one. For some commands it is |
791 possible to use two counts. The last one (rightmost one) is used. | 774 possible to use two counts. The last one (rightmost one) is used. |
792 | 775 |
793 If no [+cmd] argument is present, the cursor is positioned at the last known | 776 If no [+cmd] argument is present, the cursor is positioned at the last known |
823 This means that you are position 4 in the argument list, but not editing the | 806 This means that you are position 4 in the argument list, but not editing the |
824 fourth file in the argument list. This happens when you do ":e file". | 807 fourth file in the argument list. This happens when you do ":e file". |
825 | 808 |
826 | 809 |
827 LOCAL ARGUMENT LIST | 810 LOCAL ARGUMENT LIST |
828 | |
829 {not in Vi} | |
830 | 811 |
831 *:arglocal* | 812 *:arglocal* |
832 :argl[ocal] Make a local copy of the global argument list. | 813 :argl[ocal] Make a local copy of the global argument list. |
833 Doesn't start editing another file. | 814 Doesn't start editing another file. |
834 | 815 |
876 {cmd} must not change the argument list. | 857 {cmd} must not change the argument list. |
877 Note: While this command is executing, the Syntax | 858 Note: While this command is executing, the Syntax |
878 autocommand event is disabled by adding it to | 859 autocommand event is disabled by adding it to |
879 'eventignore'. This considerably speeds up editing | 860 'eventignore'. This considerably speeds up editing |
880 each file. | 861 each file. |
881 {not in Vi} | |
882 Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, | 862 Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, |
883 |:cfdo| and |:lfdo| | 863 |:cfdo| and |:lfdo| |
884 | 864 |
885 Example: > | 865 Example: > |
886 :args *.c | 866 :args *.c |
968 previous name is used for the alternate file name. | 948 previous name is used for the alternate file name. |
969 The [!] is needed to overwrite an existing file. | 949 The [!] is needed to overwrite an existing file. |
970 When 'filetype' is empty filetype detection is done | 950 When 'filetype' is empty filetype detection is done |
971 with the new name, before the file is written. | 951 with the new name, before the file is written. |
972 When the write was successful 'readonly' is reset. | 952 When the write was successful 'readonly' is reset. |
973 {not in Vi} | |
974 | 953 |
975 *:up* *:update* | 954 *:up* *:update* |
976 :[range]up[date][!] [++opt] [>>] [file] | 955 :[range]up[date][!] [++opt] [>>] [file] |
977 Like ":write", but only write when the buffer has been | 956 Like ":write", but only write when the buffer has been |
978 modified. {not in Vi} | 957 modified. |
979 | 958 |
980 | 959 |
981 WRITING WITH MULTIPLE BUFFERS *buffer-write* | 960 WRITING WITH MULTIPLE BUFFERS *buffer-write* |
982 | 961 |
983 *:wa* *:wall* | 962 *:wa* *:wall* |
984 :wa[ll] Write all changed buffers. Buffers without a file | 963 :wa[ll] Write all changed buffers. Buffers without a file |
985 name cause an error message. Buffers which are | 964 name cause an error message. Buffers which are |
986 readonly are not written. {not in Vi} | 965 readonly are not written. |
987 | 966 |
988 :wa[ll]! Write all changed buffers, even the ones that are | 967 :wa[ll]! Write all changed buffers, even the ones that are |
989 readonly. Buffers without a file name are not | 968 readonly. Buffers without a file name are not |
990 written and cause an error message. {not in Vi} | 969 written and cause an error message. |
991 | 970 |
992 | 971 |
993 Vim will warn you if you try to overwrite a file that has been changed | 972 Vim will warn you if you try to overwrite a file that has been changed |
994 elsewhere. See |timestamp|. | 973 elsewhere. See |timestamp|. |
995 | 974 |
1116 Triggers the |QuitPre| autocommand event. | 1095 Triggers the |QuitPre| autocommand event. |
1117 See |CTRL-W_q| for quitting another window. | 1096 See |CTRL-W_q| for quitting another window. |
1118 | 1097 |
1119 :conf[irm] q[uit] Quit, but give prompt when changes have been made, or | 1098 :conf[irm] q[uit] Quit, but give prompt when changes have been made, or |
1120 the last file in the argument list has not been | 1099 the last file in the argument list has not been |
1121 edited. See |:confirm| and 'confirm'. {not in Vi} | 1100 edited. See |:confirm| and 'confirm'. |
1122 | 1101 |
1123 :q[uit]! Quit without writing, also when the current buffer has | 1102 :q[uit]! Quit without writing, also when the current buffer has |
1124 changes. The buffer is unloaded, also when it has | 1103 changes. The buffer is unloaded, also when it has |
1125 'hidden' set. | 1104 'hidden' set. |
1126 If this is the last window and there is a modified | 1105 If this is the last window and there is a modified |
1129 buffer. | 1108 buffer. |
1130 Use ":qall!" to exit always. | 1109 Use ":qall!" to exit always. |
1131 | 1110 |
1132 :cq[uit] Quit always, without writing, and return an error | 1111 :cq[uit] Quit always, without writing, and return an error |
1133 code. See |:cq|. Used for Manx's QuickFix mode (see | 1112 code. See |:cq|. Used for Manx's QuickFix mode (see |
1134 |quickfix|). {not in Vi} | 1113 |quickfix|). |
1135 | 1114 |
1136 *:wq* | 1115 *:wq* |
1137 :wq [++opt] Write the current file and quit. Writing fails when | 1116 :wq [++opt] Write the current file and quit. Writing fails when |
1138 the file is read-only or the buffer does not have a | 1117 the file is read-only or the buffer does not have a |
1139 name. Quitting fails when the last file in the | 1118 name. Quitting fails when the last file in the |
1167 current file, the file is written if it was modified | 1146 current file, the file is written if it was modified |
1168 and the window is closed). | 1147 and the window is closed). |
1169 | 1148 |
1170 *ZQ* | 1149 *ZQ* |
1171 ZQ Quit without checking for changes (same as ":q!"). | 1150 ZQ Quit without checking for changes (same as ":q!"). |
1172 {not in Vi} | 1151 |
1173 | 1152 |
1174 MULTIPLE WINDOWS AND BUFFERS *window-exit* | 1153 MULTIPLE WINDOWS AND BUFFERS *window-exit* |
1175 | 1154 |
1176 *:qa* *:qall* | 1155 *:qa* *:qall* |
1177 :qa[ll] Exit Vim, unless there are some buffers which have been | 1156 :qa[ll] Exit Vim, unless there are some buffers which have been |
1178 changed. (Use ":bmod" to go to the next modified buffer). | 1157 changed. (Use ":bmod" to go to the next modified buffer). |
1179 When 'autowriteall' is set all changed buffers will be | 1158 When 'autowriteall' is set all changed buffers will be |
1180 written, like |:wqall|. {not in Vi} | 1159 written, like |:wqall|. |
1181 | 1160 |
1182 :conf[irm] qa[ll] | 1161 :conf[irm] qa[ll] |
1183 Exit Vim. Bring up a prompt when some buffers have been | 1162 Exit Vim. Bring up a prompt when some buffers have been |
1184 changed. See |:confirm|. {not in Vi} | 1163 changed. See |:confirm|. |
1185 | 1164 |
1186 :qa[ll]! Exit Vim. Any changes to buffers are lost. {not in Vi} | 1165 :qa[ll]! Exit Vim. Any changes to buffers are lost. |
1187 Also see |:cquit|, it does the same but exits with a non-zero | 1166 Also see |:cquit|, it does the same but exits with a non-zero |
1188 value. | 1167 value. |
1189 | 1168 |
1190 *:quita* *:quitall* | 1169 *:quita* *:quitall* |
1191 :quita[ll][!] Same as ":qall". {not in Vi} | 1170 :quita[ll][!] Same as ":qall". |
1192 | 1171 |
1193 :wqa[ll] [++opt] *:wqa* *:wqall* *:xa* *:xall* | 1172 :wqa[ll] [++opt] *:wqa* *:wqall* *:xa* *:xall* |
1194 :xa[ll] Write all changed buffers and exit Vim. If there are buffers | 1173 :xa[ll] Write all changed buffers and exit Vim. If there are buffers |
1195 without a file name, which are readonly or which cannot be | 1174 without a file name, which are readonly or which cannot be |
1196 written for another reason, Vim will not quit. {not in Vi} | 1175 written for another reason, Vim will not quit. |
1197 | 1176 |
1198 :conf[irm] wqa[ll] [++opt] | 1177 :conf[irm] wqa[ll] [++opt] |
1199 :conf[irm] xa[ll] | 1178 :conf[irm] xa[ll] |
1200 Write all changed buffers and exit Vim. Bring up a prompt | 1179 Write all changed buffers and exit Vim. Bring up a prompt |
1201 when some buffers are readonly or cannot be written for | 1180 when some buffers are readonly or cannot be written for |
1202 another reason. See |:confirm|. {not in Vi} | 1181 another reason. See |:confirm|. |
1203 | 1182 |
1204 :wqa[ll]! [++opt] | 1183 :wqa[ll]! [++opt] |
1205 :xa[ll]! Write all changed buffers, even the ones that are readonly, | 1184 :xa[ll]! Write all changed buffers, even the ones that are readonly, |
1206 and exit Vim. If there are buffers without a file name or | 1185 and exit Vim. If there are buffers without a file name or |
1207 which cannot be written for another reason, or there is a | 1186 which cannot be written for another reason, or there is a |
1208 terminal with a running job, Vim will not quit. | 1187 terminal with a running job, Vim will not quit. |
1209 {not in Vi} | |
1210 | 1188 |
1211 ============================================================================== | 1189 ============================================================================== |
1212 6. Dialogs *edit-dialogs* | 1190 6. Dialogs *edit-dialogs* |
1213 | 1191 |
1214 *:confirm* *:conf* | 1192 *:confirm* *:conf* |
1315 *:cd* *E747* *E472* | 1293 *:cd* *E747* *E472* |
1316 :cd[!] On non-Unix systems: Print the current directory | 1294 :cd[!] On non-Unix systems: Print the current directory |
1317 name. On Unix systems: Change the current directory | 1295 name. On Unix systems: Change the current directory |
1318 to the home directory. Use |:pwd| to print the | 1296 to the home directory. Use |:pwd| to print the |
1319 current directory on all systems. | 1297 current directory on all systems. |
1298 On Unix systems: clear any window-local directory. | |
1320 | 1299 |
1321 :cd[!] {path} Change the current directory to {path}. | 1300 :cd[!] {path} Change the current directory to {path}. |
1322 If {path} is relative, it is searched for in the | 1301 If {path} is relative, it is searched for in the |
1323 directories listed in |'cdpath'|. | 1302 directories listed in |'cdpath'|. |
1303 Clear any window-local directory. | |
1324 Does not change the meaning of an already opened file, | 1304 Does not change the meaning of an already opened file, |
1325 because its full path name is remembered. Files from | 1305 because its full path name is remembered. Files from |
1326 the |arglist| may change though! | 1306 the |arglist| may change though! |
1327 On MS-DOS this also changes the active drive. | 1307 On MS-DOS this also changes the active drive. |
1328 To change to the directory of the current file: > | 1308 To change to the directory of the current file: > |
1329 :cd %:h | 1309 :cd %:h |
1330 < | 1310 < |
1331 *:cd-* *E186* | 1311 *:cd-* *E186* |
1332 :cd[!] - Change to the previous current directory (before the | 1312 :cd[!] - Change to the previous current directory (before the |
1333 previous ":cd {path}" command). {not in Vi} | 1313 previous ":cd {path}" command). |
1334 | 1314 |
1335 *:chd* *:chdir* | 1315 *:chd* *:chdir* |
1336 :chd[ir][!] [path] Same as |:cd|. | 1316 :chd[ir][!] [path] Same as |:cd|. |
1337 | 1317 |
1338 *:tcd* | 1318 *:tcd* |
1339 :tcd[!] {path} Like |:cd|, but only set the directory for the current | 1319 :tcd[!] {path} Like |:cd|, but only set the directory for the current |
1340 tab. The current window will also use this directory. | 1320 tab. The current window will also use this directory. |
1341 The current directory is not changed for windows in | 1321 The current directory is not changed for windows in |
1342 other tabs and for windows in the current tab that | 1322 other tabs and for windows in the current tab that |
1343 have their own window-local directory. | 1323 have their own window-local directory. |
1344 {not in Vi} | |
1345 | 1324 |
1346 *:tch* *:tchdir* | 1325 *:tch* *:tchdir* |
1347 :tch[dir][!] Same as |:tcd|. {not in Vi} | 1326 :tch[dir][!] Same as |:tcd|. |
1348 | 1327 |
1349 *:lc* *:lcd* | 1328 *:lc* *:lcd* |
1350 :lc[d][!] {path} Like |:cd|, but only set the current directory when | 1329 :lc[d][!] {path} Like |:cd|, but only set the current directory when |
1351 the cursor is in the current window. The current | 1330 the cursor is in the current window. The current |
1352 directory for other windows is not changed, switching | 1331 directory for other windows is not changed, switching |
1353 to another window will stop using {path}. | 1332 to another window will stop using {path}. |
1354 {not in Vi} | |
1355 | 1333 |
1356 *:lch* *:lchdir* | 1334 *:lch* *:lchdir* |
1357 :lch[dir][!] Same as |:lcd|. {not in Vi} | 1335 :lch[dir][!] Same as |:lcd|. |
1358 | 1336 |
1359 *:pw* *:pwd* *E187* | 1337 *:pw* *:pwd* *E187* |
1360 :pw[d] Print the current directory name. {Vi: no pwd} | 1338 :pw[d] Print the current directory name. {Vi: no pwd} |
1361 Also see |getcwd()|. | 1339 Also see |getcwd()|. |
1362 | 1340 |
1414 reading the file. | 1392 reading the file. |
1415 - Make sure the 'binary' option is set BEFORE loading the | 1393 - Make sure the 'binary' option is set BEFORE loading the |
1416 file. Otherwise both <CR> <NL> and <NL> are considered to end a line | 1394 file. Otherwise both <CR> <NL> and <NL> are considered to end a line |
1417 and when the file is written the <NL> will be replaced with <CR> <NL>. | 1395 and when the file is written the <NL> will be replaced with <CR> <NL>. |
1418 - <Nul> characters are shown on the screen as ^@. You can enter them with | 1396 - <Nul> characters are shown on the screen as ^@. You can enter them with |
1419 "CTRL-V CTRL-@" or "CTRL-V 000" {Vi cannot handle <Nul> characters in the | 1397 "CTRL-V CTRL-@" or "CTRL-V 000" |
1420 file} | |
1421 - To insert a <NL> character in the file split a line. When writing the | 1398 - To insert a <NL> character in the file split a line. When writing the |
1422 buffer to a file a <NL> will be written for the <EOL>. | 1399 buffer to a file a <NL> will be written for the <EOL>. |
1423 - Vim normally appends an <EOL> at the end of the file if there is none. | 1400 - Vim normally appends an <EOL> at the end of the file if there is none. |
1424 Setting the 'binary' option prevents this. If you want to add the final | 1401 Setting the 'binary' option prevents this. If you want to add the final |
1425 <EOL>, set the 'endofline' option. You can also read the value of this | 1402 <EOL>, set the 'endofline' option. You can also read the value of this |