Mercurial > vim
comparison runtime/doc/autocmd.txt @ 590:de152391f6f9
updated for version 7.0167
author | vimboss |
---|---|
date | Sun, 11 Dec 2005 21:33:32 +0000 |
parents | 1ef373b13126 |
children | cd3689efd90a |
comparison
equal
deleted
inserted
replaced
589:bc49ed25543d | 590:de152391f6f9 |
---|---|
1 *autocmd.txt* For Vim version 7.0aa. Last change: 2005 Dec 07 | 1 *autocmd.txt* For Vim version 7.0aa. Last change: 2005 Dec 11 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
16 6. Patterns |autocmd-patterns| | 16 6. Patterns |autocmd-patterns| |
17 7. Buffer-local autocommands |autocmd-buflocal| | 17 7. Buffer-local autocommands |autocmd-buflocal| |
18 8. Groups |autocmd-groups| | 18 8. Groups |autocmd-groups| |
19 9. Executing autocommands |autocmd-execute| | 19 9. Executing autocommands |autocmd-execute| |
20 10. Using autocommands |autocmd-use| | 20 10. Using autocommands |autocmd-use| |
21 11. Disabling autocommands |autocmd-disable| | |
21 | 22 |
22 {Vi does not have any of these commands} | 23 {Vi does not have any of these commands} |
23 {only when the |+autocmd| feature has not been disabled at compile time} | 24 {only when the |+autocmd| feature has not been disabled at compile time} |
24 | 25 |
25 ============================================================================== | 26 ============================================================================== |
653 SwapExists Detected an existing swap file when starting | 654 SwapExists Detected an existing swap file when starting |
654 to edit a file. Only when it is possible to | 655 to edit a file. Only when it is possible to |
655 select a way to handle the situation, when Vim | 656 select a way to handle the situation, when Vim |
656 would ask the user what to do. | 657 would ask the user what to do. |
657 The |v:swapname| variable holds the name of | 658 The |v:swapname| variable holds the name of |
658 the swap file found. | 659 the swap file found, <afile> the file being |
659 The |v:swapchoice| variable should be set to | 660 edited. |v:swapcommand| may contain a command |
660 a string with one character to tell what Vim | 661 to be executed in the opened file. |
661 should do next: | 662 The commands should set the |v:swapchoice| |
663 variable to a string with one character to | |
664 tell Vim what should be done next: | |
662 'o' open read-only | 665 'o' open read-only |
663 'e' edit the file anyway | 666 'e' edit the file anyway |
664 'r' recover | 667 'r' recover |
665 'd' delete the swap file | 668 'd' delete the swap file |
666 'q' quit, don't edit the file | 669 'q' quit, don't edit the file |
1050 | 1053 |
1051 It's possible to use the ":au" command in an autocommand. This can be a | 1054 It's possible to use the ":au" command in an autocommand. This can be a |
1052 self-modifying command! This can be useful for an autocommand that should | 1055 self-modifying command! This can be useful for an autocommand that should |
1053 execute only once. | 1056 execute only once. |
1054 | 1057 |
1055 There is currently no way to disable the autocommands. If you want to write a | 1058 If you want to skip autocommands for one command, use the |:noautocmd| command |
1056 file without executing the autocommands for that type of file, write it under | 1059 modifier or the 'eventignore' option. |
1057 another name and rename it with a shell command. In some situations you can | |
1058 use the 'eventignore' option. | |
1059 | 1060 |
1060 Note: When reading a file (with ":read file" or with a filter command) and the | 1061 Note: When reading a file (with ":read file" or with a filter command) and the |
1061 last line in the file does not have an <EOL>, Vim remembers this. At the next | 1062 last line in the file does not have an <EOL>, Vim remembers this. At the next |
1062 write (with ":write file" or with a filter command), if the same line is | 1063 write (with ":write file" or with a filter command), if the same line is |
1063 written again as the last line in a file AND 'binary' is set, Vim does not | 1064 written again as the last line in a file AND 'binary' is set, Vim does not |
1170 effective. These should be used for the command that reads/writes the file. | 1171 effective. These should be used for the command that reads/writes the file. |
1171 The |v:cmdbang| variable is one when "!" was used, zero otherwise. | 1172 The |v:cmdbang| variable is one when "!" was used, zero otherwise. |
1172 | 1173 |
1173 See the $VIMRUNTIME/plugin/netrw.vim for examples. | 1174 See the $VIMRUNTIME/plugin/netrw.vim for examples. |
1174 | 1175 |
1176 ============================================================================== | |
1177 11. Disabling autocommands *autocmd-disable* | |
1178 | |
1179 To disable autocommands for some time use the 'eventignore' option. Note that | |
1180 this may cause unexpected behavior, make sure you restore 'eventignore' | |
1181 afterwards, using a |:try| block with |:finally|. | |
1182 | |
1183 *:noautocmd* *:noa* | |
1184 To disable autocommands for just one command use the ":noautocmd" command | |
1185 modifier. This will set 'eventignore' to "all" for the duration of the | |
1186 following command. Example: > | |
1187 | |
1188 :noautocmd w fname.gz | |
1189 | |
1190 This will write the file without triggering the autocommands defined by the | |
1191 gzip plugin. | |
1192 | |
1175 | 1193 |
1176 vim:tw=78:ts=8:ft=help:norl: | 1194 vim:tw=78:ts=8:ft=help:norl: |