comparison runtime/doc/autocmd.txt @ 28517:f73a9bdff3a3

Update runtime files Commit: https://github.com/vim/vim/commit/75ab590f8504a8912ca0b8c58f6b897bb7a34f07 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 18 15:36:40 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Mon, 18 Apr 2022 16:45:03 +0200
parents 21e96d9b66c0
children c5862dfaf0bd
comparison
equal deleted inserted replaced
28516:91556781726b 28517:f73a9bdff3a3
1 *autocmd.txt* For Vim version 8.2. Last change: 2022 Apr 08 1 *autocmd.txt* For Vim version 8.2. Last change: 2022 Apr 17
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
93 :au mine BufRead * set tw=70 93 :au mine BufRead * set tw=70
94 Or use `:execute`: > 94 Or use `:execute`: >
95 :augroup mine | exe "au! BufRead *" | augroup END 95 :augroup mine | exe "au! BufRead *" | augroup END
96 :augroup mine | exe "au BufRead * set tw=70" | augroup END 96 :augroup mine | exe "au BufRead * set tw=70" | augroup END
97 97
98 < *autocmd-expand*
98 Note that special characters (e.g., "%", "<cword>") in the ":autocmd" 99 Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
99 arguments are not expanded when the autocommand is defined. These will be 100 arguments are not expanded when the autocommand is defined. These will be
100 expanded when the Event is recognized, and the {cmd} is executed. The only 101 expanded when the Event is recognized, and the {cmd} is executed. The only
101 exception is that "<sfile>" is expanded when the autocmd is defined. Example: 102 exception is that "<sfile>" is expanded when the autocmd is defined. Example:
102 > 103 >
471 BufRead or BufReadPost When starting to edit a new buffer, after 472 BufRead or BufReadPost When starting to edit a new buffer, after
472 reading the file into the buffer, before 473 reading the file into the buffer, before
473 executing the modelines. See |BufWinEnter| 474 executing the modelines. See |BufWinEnter|
474 for when you need to do something after 475 for when you need to do something after
475 processing the modelines. 476 processing the modelines.
476 This does NOT work for ":r file". Not used 477 Also triggered:
477 when the file doesn't exist. Also used after 478 - when writing an unnamed buffer in a way that
478 successfully recovering a file. 479 the buffer gets a name
479 Also triggered for the filetypedetect group 480 - after successfully recovering a file
480 when executing ":filetype detect" and when 481 - for the filetypedetect group when executing
481 writing an unnamed buffer in a way that the 482 ":filetype detect"
482 buffer gets a name. 483 Not triggered:
484 - for the `:read file` command
485 - when the file doesn't exist
483 *BufReadCmd* 486 *BufReadCmd*
484 BufReadCmd Before starting to edit a new buffer. Should 487 BufReadCmd Before starting to edit a new buffer. Should
485 read the file into the buffer. |Cmd-event| 488 read the file into the buffer. |Cmd-event|
486 *BufReadPre* *E200* *E201* 489 *BufReadPre* *E200* *E201*
487 BufReadPre When starting to edit a new buffer, before 490 BufReadPre When starting to edit a new buffer, before
705 that is slow. 708 that is slow.
706 *CursorMovedI* 709 *CursorMovedI*
707 CursorMovedI After the cursor was moved in Insert mode. 710 CursorMovedI After the cursor was moved in Insert mode.
708 Not triggered when the popup menu is visible. 711 Not triggered when the popup menu is visible.
709 Otherwise the same as CursorMoved. 712 Otherwise the same as CursorMoved.
713 *DiffUpdated*
714 DiffUpdated After diffs have been updated. Depending on
715 what kind of diff is being used (internal or
716 external) this can be triggered on every
717 change or when doing |:diffupdate|.
718 *DirChangedPre*
719 DirChangedPre The working directory is going to be changed,
720 as with |DirChanged|. The pattern is like
721 with |DirChanged|. The new directory can be
722 found in v:event.directory.
723 *DirChanged*
724 DirChanged The working directory has changed in response
725 to the |:cd| or |:tcd| or |:lcd| commands, or
726 as a result of the 'autochdir' option.
727 The pattern can be:
728 "window" to trigger on `:lcd`
729 "tabpage" to trigger on `:tcd`
730 "global" to trigger on `:cd`
731 "auto" to trigger on 'autochdir'.
732 "drop" to trigger on editing a file
733 <afile> is set to the new directory name.
710 *EncodingChanged* 734 *EncodingChanged*
711 EncodingChanged Fires off after the 'encoding' option has been 735 EncodingChanged Fires off after the 'encoding' option has been
712 changed. Useful to set up fonts, for example. 736 changed. Useful to set up fonts, for example.
737 *ExitPre*
738 ExitPre When using `:quit`, `:wq` in a way it makes
739 Vim exit, or using `:qall`, just after
740 |QuitPre|. Can be used to close any
741 non-essential window. Exiting may still be
742 cancelled if there is a modified buffer that
743 isn't automatically saved, use |VimLeavePre|
744 for really exiting.
713 *FileAppendCmd* 745 *FileAppendCmd*
714 FileAppendCmd Before appending to a file. Should do the 746 FileAppendCmd Before appending to a file. Should do the
715 appending to the file. Use the '[ and '] 747 appending to the file. Use the '[ and ']
716 marks for the range of lines. |Cmd-event| 748 marks for the range of lines. |Cmd-event|
717 *FileAppendPost* 749 *FileAppendPost*
735 here. You can reload the buffer but not edit 767 here. You can reload the buffer but not edit
736 another one. 768 another one.
737 *E881* 769 *E881*
738 If the number of lines changes saving for undo 770 If the number of lines changes saving for undo
739 may fail and the change will be aborted. 771 may fail and the change will be aborted.
740 *DiffUpdated*
741 DiffUpdated After diffs have been updated. Depending on
742 what kind of diff is being used (internal or
743 external) this can be triggered on every
744 change or when doing |:diffupdate|.
745 *DirChangedPre*
746 DirChangedPre The working directory is going to be changed,
747 as with |DirChanged|. The pattern is like
748 with |DirChanged|. The new directory can be
749 found in v:event.directory.
750 *DirChanged*
751 DirChanged The working directory has changed in response
752 to the |:cd| or |:tcd| or |:lcd| commands, or
753 as a result of the 'autochdir' option.
754 The pattern can be:
755 "window" to trigger on `:lcd`
756 "tabpage" to trigger on `:tcd`
757 "global" to trigger on `:cd`
758 "auto" to trigger on 'autochdir'.
759 "drop" to trigger on editing a file
760 <afile> is set to the new directory name.
761 *ExitPre*
762 ExitPre When using `:quit`, `:wq` in a way it makes
763 Vim exit, or using `:qall`, just after
764 |QuitPre|. Can be used to close any
765 non-essential window. Exiting may still be
766 cancelled if there is a modified buffer that
767 isn't automatically saved, use |VimLeavePre|
768 for really exiting.
769 *FileChangedShell* 772 *FileChangedShell*
770 FileChangedShell When Vim notices that the modification time of 773 FileChangedShell When Vim notices that the modification time of
771 a file has changed since editing started. 774 a file has changed since editing started.
772 Also when the file attributes of the file 775 Also when the file attributes of the file
773 change or when the size of the file changes. 776 change or when the size of the file changes.