diff options
Diffstat (limited to 'runtime/doc/autocmd.txt')
-rw-r--r-- | runtime/doc/autocmd.txt | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 037f89c..f200a30 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 9.1. Last change: 2024 May 05 +*autocmd.txt* For Vim version 9.1. Last change: 2024 Aug 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -54,20 +54,20 @@ Recommended use: without the autocommand being repeated. Example in Vim9 script: > - autocmd_add({replace: true, + autocmd_add([{replace: true, group: 'DemoGroup', event: 'BufEnter', pattern: '*.txt', cmd: 'call DemoBufEnter()' - }) + }]) In legacy script: > - call autocmd_add(#{replace: v:true, + call autocmd_add([#{replace: v:true, \ group: 'DemoGroup', \ event: 'BufEnter', \ pattern: '*.txt', \ cmd: 'call DemoBufEnter()' - \ }) + \ }]) ============================================================================== 2. Defining autocommands *autocmd-define* @@ -379,6 +379,7 @@ Name triggered by ~ |CursorHold| the user doesn't press a key for a while |CursorHoldI| the user doesn't press a key for a while in Insert mode |CursorMoved| the cursor was moved in Normal mode +|CursorMovedC| the cursor was moved in the |Command-line| |CursorMovedI| the cursor was moved in Insert mode |WinNewPre| before creating a new window @@ -438,6 +439,8 @@ Name triggered by ~ |CompleteDone| after Insert mode completion is done, after clearing info +|KeyInputPre| just before a key is processed + |User| to be used in combination with ":doautocmd" |SigUSR1| after the SIGUSR1 signal has been detected @@ -748,6 +751,13 @@ CursorMoved After the cursor was moved in Normal or Visual Careful: This is triggered very often, don't do anything that the user does not expect or that is slow. + *CursorMovedC* +CursorMovedC After the cursor was moved in the command + line. Be careful not to mess up the command + line, it may cause Vim to lock up. + <afile> is set to a single character, + indicating the type of command-line. + |cmdwin-char| *CursorMovedI* CursorMovedI After the cursor was moved in Insert mode. Not triggered when the popup menu is visible. @@ -906,12 +916,12 @@ FilterWritePre Before writing a file for a filter command or *FocusGained* FocusGained When Vim got input focus. Only for the GUI version and a few console versions where this - can be detected. + can be detected. |xterm-focus-event| *FocusLost* FocusLost When Vim lost input focus. Only for the GUI version and a few console versions where this - can be detected. May also happen when a - dialog pops up. + can be detected. |xterm-focus-event| + May also happen when a dialog pops up. *FuncUndefined* FuncUndefined When a user function is used but it isn't defined. Useful for defining a function only @@ -969,6 +979,26 @@ InsertLeavePre Just before leaving Insert mode. Also when *InsertLeave* InsertLeave Just after leaving Insert mode. Also when using CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|. + *KeyInputPre* +KeyInputPre Just before a key is processed after mappings + have been applied. The pattern is matched + against a string that indicates the current + mode, which is the same as what is returned by + `mode(1)`. + The |v:char| variable indicates the key typed + and can be changed during the event to process + a different key. When |v:char| is not a + single character or a special key, the first + character is used. + The following values of |v:event| are set: + typed The key is typed or not. + typedchar The (actual) typed key since + the last |KeyInputPre| call. + Note: "typedchar" may be empty if successive + |KeyInputPre| autocmds are processed. + It is not allowed to change the text + |textlock| or the current mode. + {only with the +eval feature} *MenuPopup* MenuPopup Just before showing the popup menu (under the right mouse button). Useful for adjusting the @@ -1400,8 +1430,10 @@ WinLeave Before leaving a window. If the window to be *WinNewPre* WinNewPre Before creating a new window. Triggered before commands that modify window layout by - creating a split or new tab page. Not done for - the first window, when Vim has just started. + creating a split. + Not done when creating tab pages and for the + first window, as the window structure is not + initialized yet and so is generally not safe. It is not allowed to modify window layout while executing commands for the WinNewPre event. |