aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/autocmd.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/autocmd.txt')
-rw-r--r--runtime/doc/autocmd.txt59
1 files changed, 30 insertions, 29 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index a782be65e7..ffa7d6282a 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -212,28 +212,27 @@ events.
Nvim recognizes the following events. Names are case-insensitive.
*BufAdd*
-BufAdd Just after creating a new buffer which is
- added to the buffer list, or adding a buffer
- to the buffer list, a buffer in the buffer
- list was renamed.
- Not triggered for the initial buffers created
- during startup.
+BufAdd After adding a new buffer or existing unlisted
+ buffer to the buffer list (except during
+ startup, see |VimEnter|), or renaming a listed
+ buffer.
Before |BufEnter|.
- NOTE: Current buffer "%" may be different from
- the buffer being created "<afile>".
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>", "<abuf>". |<buffer=abuf>|
*BufDelete*
BufDelete Before deleting a buffer from the buffer list.
The BufUnload may be called first (if the
buffer was loaded).
Also used just before a buffer in the buffer
list is renamed.
- NOTE: Current buffer "%" may be different from
- the buffer being deleted "<afile>" and "<abuf>".
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>", "<abuf>". |<buffer=abuf>|
Do not change to another buffer.
*BufEnter*
-BufEnter After entering a buffer. Useful for setting
- options for a file type. Also executed when
- starting to edit a buffer.
+BufEnter After entering (visiting, switching-to) a new
+ or existing buffer. Useful for setting
+ filetype options. Compare |BufNew| which
+ does not trigger for existing buffers.
After |BufAdd|.
After |BufReadPost|.
*BufFilePost*
@@ -248,8 +247,8 @@ BufHidden Before a buffer becomes hidden: when there are
the buffer is not unloaded or deleted.
Not used for ":qa" or ":q" when exiting Vim.
- NOTE: current buffer "%" may be different from
- the buffer being unloaded "<afile>".
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>", "<abuf>". |<buffer=abuf>|
*BufLeave*
BufLeave Before leaving to another buffer. Also when
leaving or closing the current window and the
@@ -260,12 +259,14 @@ BufLeave Before leaving to another buffer. Also when
BufModifiedSet After the `'modified'` value of a buffer has
been changed.
*BufNew*
-BufNew Just after creating a new buffer. Also used
- just after a buffer has been renamed. When
- the buffer is added to the buffer list BufAdd
- will be triggered too.
- NOTE: Current buffer "%" may be different from
- the buffer being created "<afile>".
+BufNew After creating a new buffer (except during
+ startup, see |VimEnter|) or renaming an
+ existing buffer. Unlike |BufEnter|, visiting
+ (switching to) an existing buffer will not
+ trigger this again.
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>", "<abuf>". |<buffer=abuf>|
+ See also |BufAdd|, |BufNewFile|.
*BufNewFile*
BufNewFile When starting to edit a file that doesn't
exist. Can be used to read in a skeleton
@@ -298,8 +299,8 @@ BufUnload Before unloading a buffer, when the text in
Before BufDelete.
Triggers for all loaded buffers when Vim is
going to exit.
- NOTE: Current buffer "%" may be different from
- the buffer being unloaded "<afile>".
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>", "<abuf>". |<buffer=abuf>|
Do not switch buffers or windows!
Not triggered when exiting and v:dying is 2 or
more.
@@ -319,8 +320,8 @@ BufWinLeave Before a buffer is removed from a window.
Not when it's still visible in another window.
Also triggered when exiting.
Before BufUnload, BufHidden.
- NOTE: Current buffer "%" may be different from
- the buffer being unloaded "<afile>".
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>", "<abuf>". |<buffer=abuf>|
Not triggered when exiting and v:dying is 2 or
more.
*BufWipeout*
@@ -330,8 +331,8 @@ BufWipeout Before completely deleting a buffer. The
buffer list). Also used just before a buffer
is renamed (also when it's not in the buffer
list).
- NOTE: Current buffer "%" may be different from
- the buffer being deleted "<afile>".
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>", "<abuf>". |<buffer=abuf>|
Do not change to another buffer.
*BufWrite* *BufWritePre*
BufWrite or BufWritePre Before writing the whole buffer to a file.
@@ -597,8 +598,8 @@ FileChangedShell When Vim notices that the modification time of
prompt is not given.
|v:fcs_reason| indicates what happened. Set
|v:fcs_choice| to control what happens next.
- NOTE: Current buffer "%" may be different from
- the buffer that was changed "<afile>".
+ NOTE: Current buffer "%" is not the target
+ buffer "<afile>" and "<abuf>". |<buffer=abuf>|
*E246* *E811*
Cannot switch, jump to or delete buffers.
Non-recursive (event cannot trigger itself).