From 4e330bbf216ca93827778c2dcc8aa1a8f053c9e1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Dec 2005 21:04:31 +0000 Subject: updated for version 7.0164 --- runtime/doc/autocmd.txt | 785 ++++++++++++++++++++++++++++-------------------- runtime/doc/eval.txt | 22 +- runtime/doc/tags | 12 +- 3 files changed, 482 insertions(+), 337 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 37a51ad99d..6deeaeaf7d 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.0aa. Last change: 2005 Nov 21 +*autocmd.txt* For Vim version 7.0aa. Last change: 2005 Dec 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -169,18 +169,195 @@ See |:verbose-cmd| for more information. ============================================================================== 5. Events *autocmd-events* *E215* *E216* +You can specify a comma-separated list of event names. No white space can be +used in this list. The command applies to all the events in the list. + +For READING FILES there are four kinds of events possible: + BufNewFile starting to edit a non-existent file + BufReadPre BufReadPost starting to edit an existing file + FilterReadPre FilterReadPost read the temp file with filter output + FileReadPre FileReadPost any other file read +Vim uses only one of these four kinds when reading a file. The "Pre" and +"Post" events are both triggered, before and after reading the file. + +Note that the autocommands for the *ReadPre events and all the Filter events +are not allowed to change the current buffer (you will get an error message if +this happens). This is to prevent the file to be read into the wrong buffer. + +Note that the 'modified' flag is reset AFTER executing the BufReadPost +and BufNewFile autocommands. But when the 'modified' option was set by the +autocommands, this doesn't happen. + +You can use the 'eventignore' option to ignore a number of events or all +events. *autocommand-events* *{event}* Vim recognizes the following events. Vim ignores the case of event names (e.g., you can use "BUFread" or "bufread" instead of "BufRead"). +First an overview by function with a short explanation. Then the list +alpabetically with full explanations |autocmd-events-abc|. + +Name triggered by ~ + + Reading +|BufNewFile| starting to edit a file that doesn't exist +|BufReadPre| starting to edit a new buffer, before reading the file +|BufRead| starting to edit a new buffer, after reading the file +|BufReadPost| starting to edit a new buffer, after reading the file +|BufReadCmd| before starting to edit a new buffer |Cmd-event| + +|FileReadPre| before reading a file with a ":read" command +|FileReadPost| after reading a file with a ":read" command +|FileReadCmd| before reading a file with a ":read" comman |Cmd-event| + +|FilterReadPre| before reading a file from a filter command +|FilterReadPost| after reading a file from a filter command + +|StdinReadPre| before reading from stdin into the buffer +|StdinReadPost| After reading from the stdin into the buffer + + Writing +|BufWrite| starting to write the whole buffer to a file +|BufWritePre| starting to write the whole buffer to a file +|BufWritePost| after writing the whole buffer to a file +|BufWriteCmd| before writing the whole buffer to a file |Cmd-event| + +|FileWritePre| starting to write part of a buffer to a file +|FileWritePost| after writing part of a buffer to a file +|FileWriteCmd| before writing part of a buffer to a file |Cmd-event| + +|FileAppendPre| starting to append to a file +|FileAppendPost| after appending to a file +|FileAppendCmd| before appending to a file |Cmd-event| + +|FilterWritePre| starting to write a file for a filter command or diff +|FilterWritePost| after writing a file for a filter command or diff + + Buffers +|BufAdd| just after adding a buffer to the buffer list +|BufCreate| just after adding a buffer to the buffer list +|BufDelete| before deleting a buffer from the buffer list +|BufWipeout| before completely deleting a buffer + +|BufFilePre| before changing the name of the current buffer +|BufFilePost| after changing the name of the current buffer + +|BufEnter| after entering a buffer +|BufLeave| before leaving to another buffer +|BufWinEnter| after a buffer is displayed in a window +|BufWinLeave| before a buffer is removed from a window + +|BufUnload| before unloading a buffer +|BufHidden| just after a buffer has become hidden +|BufNew| just after creating a new buffer + +|SwapExists| detected an existing swap file + + Options +|FileType| when the 'filetype' option has been set +|Syntax| when the 'syntax' option has been set +|EncodingChanged| after the 'encoding' option has been changed +|TermChanged| after the value of 'term' has changed + + Startup and exit +|VimEnter| after doing all the startup stuff +|GUIEnter| after starting the GUI successfully +|TermResponse| after the termainal response to |t_RV| is received + +|VimLeavePre| before exiting Vim, before writing the viminfo file +|VimLeave| before exiting Vim, after writing the viminfo file + + Various +|FileChangedShell| Vim notices that a file changed since editing started +|FileChangedRO| before making the first change to a read-only file + +|FuncUndefined| a user function is used but it isn't defined + +|FocusGained| Vim got input focus +|FocusLost| Vim lost input focus +|CursorHold| the user doesn't press a key for a while + +|WinEnter| after entering another window +|WinLeave| before leaving a window +|CmdwinEnter| after entering the command-line window +|CmdwinLeave| before leaving the command-line window + +|InsertEnter| starting Insert mode +|InsertChange| when typing while in Insert or Replace mode +|InsertLeave| when leaving Insert mode + +|ColorScheme| after loading a color scheme + +|RemoteReply| a reply from a server Vim was received + +|QuickFixCmdPre| before a quickfix command is run +|QuickFixCmdPost| after a quickfix command is run + +|SessionLoadPost| after loading a session file + +|MenuPopup| just before showing the popup menu + +|User| to be used in combination with ":doautocmd" + + +The alphabetical list of autocommand events: *autocmd-events-abc* + + *BufCreate* *BufAdd* +BufAdd or BufCreate Just after creating a new buffer which is + added to the buffer list, or adding a buffer + to the buffer list. + Also used just after a buffer in the buffer + list has been renamed. + The BufCreate event is for historic reasons. + NOTE: When this autocommand is executed, the + current buffer "%" may be different from the + buffer being created "". + *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: When this autocommand is executed, the + current buffer "%" may be different from the + buffer being deleted "". + *BufEnter* +BufEnter After entering a buffer. Useful for setting + options for a file type. Also executed when + starting to edit a buffer, after the + BufReadPost autocommands. + *BufFilePost* +BufFilePost After changing the name of the current buffer + with the ":file" or ":saveas" command. + *BufReadCmd* +BufFilePre Before changing the name of the current buffer + with the ":file" or ":saveas" command. + *BufHidden* +BufHidden Just after a buffer has become hidden. That + is, when there are no longer windows that show + the buffer, but the buffer is not unloaded or + deleted. Not used for ":qa" or ":q" when + exiting Vim. + NOTE: When this autocommand is executed, the + current buffer "%" may be different from the + buffer being unloaded "". + *BufLeave* +BufLeave Before leaving to another buffer. Also when + leaving or closing the current window and the + new current window is not for the same buffer. + Not used for ":qa" or ":q" when exiting Vim. + *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: When this autocommand is executed, the + current buffer "%" may be different from the + buffer being created "". *BufNewFile* BufNewFile When starting to edit a file that doesn't exist. Can be used to read in a skeleton file. - *BufReadPre* *E200* *E201* -BufReadPre When starting to edit a new buffer, before - reading the file into the buffer. Not used - if the file doesn't exist. *BufRead* *BufReadPost* BufRead or BufReadPost When starting to edit a new buffer, after reading the file into the buffer, before @@ -190,189 +367,22 @@ BufRead or BufReadPost When starting to edit a new buffer, after This does NOT work for ":r file". Not used when the file doesn't exist. Also used after successfully recovering a file. - *BufReadCmd* + *BufReadPre* *E200* *E201* BufReadCmd Before starting to edit a new buffer. Should read the file into the buffer. |Cmd-event| *BufFilePre* -BufFilePre Before changing the name of the current buffer - with the ":file" or ":saveas" command. - *BufFilePost* -BufFilePost After changing the name of the current buffer - with the ":file" or ":saveas" command. - *FileReadPre* -FileReadPre Before reading a file with a ":read" command. - *FileReadPost* -FileReadPost After reading a file with a ":read" command. - Note that Vim sets the '[ and '] marks to the - first and last line of the read. This can be - used to operate on the lines just read. - *FileReadCmd* -FileReadCmd Before reading a file with a ":read" command. - Should do the reading of the file. |Cmd-event| - *FilterReadPre* *E135* -FilterReadPre Before reading a file from a filter command. - Vim checks the pattern against the name of - the current buffer, not the name of the - temporary file that is the output of the - filter command. - Not triggered when 'shelltemp' is off. - *FilterReadPost* -FilterReadPost After reading a file from a filter command. - Vim checks the pattern against the name of - the current buffer as with FilterReadPre. - Not triggered when 'shelltemp' is off. - *FileType* -FileType When the 'filetype' option has been set. - can be used for the name of the file - where this option was set, and for - the new value of 'filetype'. - See |filetypes|. - *Syntax* -Syntax When the 'syntax' option has been set. - can be used for the name of the file - where this option was set, and for - the new value of 'syntax'. - See |:syn-on|. - *StdinReadPre* -StdinReadPre Before reading from stdin into the buffer. - Only used when the "-" argument was used when - Vim was started |--|. - *StdinReadPost* -StdinReadPost After reading from the stdin into the buffer, - before executing the modelines. Only used - when the "-" argument was used when Vim was - started |--|. - *BufWrite* *BufWritePre* -BufWrite or BufWritePre Before writing the whole buffer to a file. - *BufWritePost* -BufWritePost After writing the whole buffer to a file - (should undo the commands for BufWritePre). - *BufWriteCmd* -BufWriteCmd Before writing the whole buffer to a file. - Should do the writing of the file and reset - 'modified' if successful, unless '+' is in - 'cpo' and writing to another file |cpo-+|. - The buffer contents should not be changed. - |Cmd-event| - *FileWritePre* -FileWritePre Before writing to a file, when not writing the - whole buffer. Use the '[ and '] marks for the - range of lines. - *FileWritePost* -FileWritePost After writing to a file, when not writing the - whole buffer. - *FileWriteCmd* -FileWriteCmd Before writing to a file, when not writing the - whole buffer. Should do the writing to the - file. Should not change the buffer. Use the - '[ and '] marks for the range of lines. - |Cmd-event| - *FileAppendPre* -FileAppendPre Before appending to a file. Use the '[ and '] - marks for the range of lines. - *FileAppendPost* -FileAppendPost After appending to a file. - *FileAppendCmd* -FileAppendCmd Before appending to a file. Should do the - appending to the file. Use the '[ and '] - marks for the range of lines.|Cmd-event| - *FilterWritePre* -FilterWritePre Before writing a file for a filter command or - making a diff. - Vim checks the pattern against the name of - the current buffer, not the name of the - temporary file that is the output of the - filter command. - Not triggered when 'shelltemp' is off. - *FilterWritePost* -FilterWritePost After writing a file for a filter command or - making a diff. - Vim checks the pattern against the name of - the current buffer as with FilterWritePre. - Not triggered when 'shelltemp' is off. - *FileChangedShell* -FileChangedShell When Vim notices that the modification time of - a file has changed since editing started. - Also when the file attributes of the file - change. |timestamp| - Mostly triggered after executing a shell - command, but also with a |:checktime| command - or when Gvim regains input focus. - This autocommand is triggered for each changed - file. It is not used when 'autoread' is set - and the buffer was not changed. If a - FileChangedShell autocommand is present the - warning message and prompt is not given. - This is useful for reloading related buffers - which are affected by a single command. - The |v:fcs_reason| variable is set to indicate - what happened and |v:fcs_choice| can be used - to tell Vim what to do next. +BufReadPre When starting to edit a new buffer, before + reading the file into the buffer. Not used + if the file doesn't exist. + *BufUnload* +BufUnload Before unloading a buffer. This is when the + text in the buffer is going to be freed. This + may be after a BufWritePost and before a + BufDelete. Also used for all buffers that are + loaded when Vim is going to exit. NOTE: When this autocommand is executed, the current buffer "%" may be different from the - buffer that was changed "". - NOTE: The commands must not change the current - buffer, jump to another buffer or delete a - buffer. *E246* - NOTE: This event never nests, to avoid an - endless loop. This means that while executing - commands for the FileChangedShell event no - other FileChangedShell event will be - triggered. - *FileChangedRO* -FileChangedRO Before making the first change to a read-only - file. Can be used to check-out the file from - a source control system. Not triggered when - the change was caused by an autocommand. - This event is triggered when making the first - change in a buffer or the first change after - 'readonly' was set, - just before the change is applied to the text. - WARNING: If the autocommand moves the cursor - the effect of the change is undefined. - *FocusGained* -FocusGained When Vim got input focus. Only for the GUI - version and a few console versions where this - can be detected. - *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. - *FuncUndefined* -FuncUndefined When a user function is used but it isn't - defined. Useful for defining a function only - when it's used. Both and are - set to the name of the function. - See |autoload-functions|. - *CursorHold* -CursorHold When the user doesn't press a key for the time - specified with 'updatetime'. Not re-triggered - until the user has pressed a key (i.e. doesn't - fire every 'updatetime' ms if you leave Vim to - make some coffee. :) See |CursorHold-example| - for previewing tags. - This event is only triggered in Normal mode. - Note: Interactive commands cannot be used for - this event. There is no hit-enter prompt, - the screen is updated directly (when needed). - Note: In the future there will probably be - another option to set the time. - Hint: to force an update of the status lines - use: > - :let &ro = &ro -< {only on Amiga, Unix, Win32, MSDOS and all GUI - versions} - *BufEnter* -BufEnter After entering a buffer. Useful for setting - options for a file type. Also executed when - starting to edit a buffer, after the - BufReadPost autocommands. - *BufLeave* -BufLeave Before leaving to another buffer. Also when - leaving or closing the current window and the - new current window is not for the same buffer. - Not used for ":qa" or ":q" when exiting Vim. + buffer being unloaded "". *BufWinEnter* BufWinEnter After a buffer is displayed in a window. This can be when the buffer is loaded (after @@ -388,51 +398,6 @@ BufWinLeave Before a buffer is removed from a window. NOTE: When this autocommand is executed, the current buffer "%" may be different from the buffer being unloaded "". - *BufUnload* -BufUnload Before unloading a buffer. This is when the - text in the buffer is going to be freed. This - may be after a BufWritePost and before a - BufDelete. Also used for all buffers that are - loaded when Vim is going to exit. - NOTE: When this autocommand is executed, the - current buffer "%" may be different from the - buffer being unloaded "". - *BufHidden* -BufHidden Just after a buffer has become hidden. That - is, when there are no longer windows that show - the buffer, but the buffer is not unloaded or - deleted. Not used for ":qa" or ":q" when - exiting Vim. - NOTE: When this autocommand is executed, the - current buffer "%" may be different from the - buffer being unloaded "". - *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: When this autocommand is executed, the - current buffer "%" may be different from the - buffer being created "". - *BufCreate* *BufAdd* -BufAdd or BufCreate Just after creating a new buffer which is - added to the buffer list, or adding a buffer - to the buffer list. - Also used just after a buffer in the buffer - list has been renamed. - The BufCreate event is for historic reasons. - NOTE: When this autocommand is executed, the - current buffer "%" may be different from the - buffer being created "". - *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: When this autocommand is executed, the - current buffer "%" may be different from the - buffer being deleted "". *BufWipeout* BufWipeout Before completely deleting a buffer. The BufUnload and BufDelete events may be called @@ -443,22 +408,18 @@ BufWipeout Before completely deleting a buffer. The NOTE: When this autocommand is executed, the current buffer "%" may be different from the buffer being deleted "". - *WinEnter* -WinEnter After entering another window. Not done for - the first window, when Vim has just started. - Useful for setting the window height. - If the window is for another buffer, Vim - executes the BufEnter autocommands after the - WinEnter autocommands. - Note: When using ":split fname" the WinEnter - event is triggered after the split but before - the file "fname" is loaded. - *WinLeave* -WinLeave Before leaving a window. If the window to be - entered next is for a different buffer, Vim - executes the BufLeave autocommands before the - WinLeave autocommands (but not for ":new"). - Not used for ":qa" or ":q" when exiting Vim. + *BufWrite* *BufWritePre* +BufWrite or BufWritePre Before writing the whole buffer to a file. + *BufWriteCmd* +BufWriteCmd Before writing the whole buffer to a file. + Should do the writing of the file and reset + 'modified' if successful, unless '+' is in + 'cpo' and writing to another file |cpo-+|. + The buffer contents should not be changed. + |Cmd-event| + *BufWritePost* +BufWritePost After writing the whole buffer to a file + (should undo the commands for BufWritePre). *CmdwinEnter* CmdwinEnter After entering the command-line window. Useful for setting options specifically for @@ -475,53 +436,198 @@ CmdwinLeave Before leaving the command-line window. is set to a single character, indicating the type of command-line. |cmdwin-char| + *ColorScheme* +ColorScheme After loading a color scheme. |:colorscheme| + *CursorHold* +CursorHold When the user doesn't press a key for the time + specified with 'updatetime'. Not re-triggered + until the user has pressed a key (i.e. doesn't + fire every 'updatetime' ms if you leave Vim to + make some coffee. :) See |CursorHold-example| + for previewing tags. + This event is only triggered in Normal mode. + Note: Interactive commands cannot be used for + this event. There is no hit-enter prompt, + the screen is updated directly (when needed). + Note: In the future there will probably be + another option to set the time. + Hint: to force an update of the status lines + use: > + :let &ro = &ro +< {only on Amiga, Unix, Win32, MSDOS and all GUI + versions} + *EncodingChanged* +EncodingChanged Fires off after the 'encoding' option has been + changed. Useful to set up fonts, for example. + *FileAppendCmd* +FileAppendCmd Before appending to a file. Should do the + appending to the file. Use the '[ and '] + marks for the range of lines.|Cmd-event| + *FileAppendPost* +FileAppendPost After appending to a file. + *FileAppendPre* +FileAppendPre Before appending to a file. Use the '[ and '] + marks for the range of lines. + *FileChangedRO* +FileChangedRO Before making the first change to a read-only + file. Can be used to check-out the file from + a source control system. Not triggered when + the change was caused by an autocommand. + This event is triggered when making the first + change in a buffer or the first change after + 'readonly' was set, + just before the change is applied to the text. + WARNING: If the autocommand moves the cursor + the effect of the change is undefined. + *FileChangedShell* +FileChangedShell When Vim notices that the modification time of + a file has changed since editing started. + Also when the file attributes of the file + change. |timestamp| + Mostly triggered after executing a shell + command, but also with a |:checktime| command + or when Gvim regains input focus. + This autocommand is triggered for each changed + file. It is not used when 'autoread' is set + and the buffer was not changed. If a + FileChangedShell autocommand is present the + warning message and prompt is not given. + This is useful for reloading related buffers + which are affected by a single command. + The |v:fcs_reason| variable is set to indicate + what happened and |v:fcs_choice| can be used + to tell Vim what to do next. + NOTE: When this autocommand is executed, the + current buffer "%" may be different from the + buffer that was changed "". + NOTE: The commands must not change the current + buffer, jump to another buffer or delete a + buffer. *E246* + NOTE: This event never nests, to avoid an + endless loop. This means that while executing + commands for the FileChangedShell event no + other FileChangedShell event will be + triggered. + *FileEncoding* +FileEncoding Obsolete. It still works and is equivalent + to |EncodingChanged|. + *FileReadCmd* +FileReadCmd Before reading a file with a ":read" command. + Should do the reading of the file. |Cmd-event| + *FileReadPost* +FileReadPost After reading a file with a ":read" command. + Note that Vim sets the '[ and '] marks to the + first and last line of the read. This can be + used to operate on the lines just read. + *FileReadPre* +FileReadPre Before reading a file with a ":read" command. + *FileType* +FileType When the 'filetype' option has been set. + can be used for the name of the file + where this option was set, and for + the new value of 'filetype'. + See |filetypes|. + *FileWriteCmd* +FileWriteCmd Before writing to a file, when not writing the + whole buffer. Should do the writing to the + file. Should not change the buffer. Use the + '[ and '] marks for the range of lines. + |Cmd-event| + *FileWritePost* +FileWritePost After writing to a file, when not writing the + whole buffer. + *FileWritePre* +FileWritePre Before writing to a file, when not writing the + whole buffer. Use the '[ and '] marks for the + range of lines. + *FilterReadPost* +FilterReadPost After reading a file from a filter command. + Vim checks the pattern against the name of + the current buffer as with FilterReadPre. + Not triggered when 'shelltemp' is off. + *FilterReadPre* *E135* +FilterReadPre Before reading a file from a filter command. + Vim checks the pattern against the name of + the current buffer, not the name of the + temporary file that is the output of the + filter command. + Not triggered when 'shelltemp' is off. + *FilterWritePost* +FilterWritePost After writing a file for a filter command or + making a diff. + Vim checks the pattern against the name of + the current buffer as with FilterWritePre. + Not triggered when 'shelltemp' is off. + *FilterWritePre* +FilterWritePre Before writing a file for a filter command or + making a diff. + Vim checks the pattern against the name of + the current buffer, not the name of the + temporary file that is the output of the + filter command. + Not triggered when 'shelltemp' is off. + *FocusGained* +FocusGained When Vim got input focus. Only for the GUI + version and a few console versions where this + can be detected. + *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. + *FuncUndefined* +FuncUndefined When a user function is used but it isn't + defined. Useful for defining a function only + when it's used. Both and are + set to the name of the function. + See |autoload-functions|. *GUIEnter* GUIEnter After starting the GUI successfully, and after opening the window. It is triggered before VimEnter when using gvim. Can be used to position the window from a .gvimrc file: > :autocmd GUIEnter * winpos 100 50 -< *VimEnter* -VimEnter After doing all the startup stuff, including - loading .vimrc files, executing the "-c cmd" - arguments, creating all windows and loading - the buffers in them. - *VimLeavePre* -VimLeavePre Before exiting Vim, just before writing the - .viminfo file. This is executed only once, - if there is a match with the name of what - happens to be the current buffer when exiting. - Mostly useful with a "*" pattern. > - :autocmd VimLeavePre * call CleanupStuff() -< To detect an abnormal exit use |v:dying|. - *VimLeave* -VimLeave Before exiting Vim, just after writing the - .viminfo file. Executed only once, like - VimLeavePre. - To detect an abnormal exit use |v:dying|. - *EncodingChanged* -EncodingChanged Fires off after the 'encoding' option has been - changed. Useful to set up fonts, for example. +< *InsertChange* +InsertChange When typing while in Insert or + Replace mode. The |v:insertmode| variable + indicates the new mode. + Be careful not to move the cursor or do + anything else that the user does not expect. *InsertEnter* InsertEnter When starting Insert mode. Also for Replace mode and Virtual Replace mode. The |v:insertmode| variable indicates the mode. Be careful not to move the cursor or do - anything else that the user does not expect. - *InsertChange* -InsertChange When typing while in Insert or - Replace mode. The |v:insertmode| variable - indicates the new mode. - Be careful not to move the cursor or do anything else that the user does not expect. *InsertLeave* InsertLeave When leaving Insert mode. Also when using CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|. - *FileEncoding* -FileEncoding Obsolete. It still works and is equivalent - to |EncodingChanged|. - *ColorScheme* -ColorScheme After loading a color scheme. |:colorscheme| + *MenuPopup* +MenuPopup Just before showing the popup menu (under the + right mouse button). Useful for adjusting the + menu for what is under the cursor or mouse + pointer. + The pattern is matched against a single + character representing the mode: + n Normal + v Visual + o Operator-pending + i Insert + c Commmand line + *QuickFixCmdPre* +QuickFixCmdPre Before a quickfix command is run (|:make|, + |:grep|, |:grepadd|, |:vimgrep|, + |:vimgrepadd|). The pattern is matched against + the command being run. When |:grep| is used + but 'grepprg' is set to "internal" it still + matches "grep". + This command cannot be used to set the + 'makeprg' and 'grepprg' variables. + If this command causes an error, the quickfix + command is not executed. + *QuickFixCmdPost* +QuickFixCmdPost Like QuickFixCmdPre, but after a quickfix + command is run. *RemoteReply* RemoteReply When a reply from a Vim that functions as server was received |server2client()|. @@ -531,6 +637,44 @@ RemoteReply When a reply from a Vim that functions as Note that even if an autocommand is defined, the reply should be read with |remote_read()| to consume it. + *SessionLoadPost* +SessionLoadPost After loading the session file created using + the |:mksession| command. + *StdinReadPost* +StdinReadPost After reading from the stdin into the buffer, + before executing the modelines. Only used + when the "-" argument was used when Vim was + started |--|. + *StdinReadPre* +StdinReadPre Before reading from stdin into the buffer. + Only used when the "-" argument was used when + Vim was started |--|. + *SwapExists* +SwapExists Detected an existing swap file when starting + to edit a file. Only when it is possible to + select a way to handle the situation, when Vim + would ask the user what to do. + The |v:swapname| variable holds the name of + the swap file found. + The |v:swapchoice| variable should be set to + a string with one character to tell what Vim + should do next: + 'o' open read-only + 'e' edit the file anyway + 'r' recover + 'd' delete the swap file + 'q' quit, don't edit the file + 'a' abort, like hitting CTRL-C + When set to an empty string the user will be + asked, as if there was no SwapExists autocmd. + Note: Do not try to change the buffer, the + results are unpredictable. + *Syntax* +Syntax When the 'syntax' option has been set. + can be used for the name of the file + where this option was set, and for + the new value of 'syntax'. + See |:syn-on|. *TermChanged* TermChanged After the value of 'term' has changed. Useful for re-loading the syntax file to update the @@ -541,63 +685,46 @@ TermResponse After the response to |t_RV| is received from the terminal. The value of |v:termresponse| can be used to do things depending on the terminal version. -QuickFixCmdPre *QuickFixCmdPre* - Before a quickfix command is run (|:make|, - |:grep|, |:grepadd|, |:vimgrep|, - |:vimgrepadd|). The pattern is matched against - the command being run. When |:grep| is used - but 'grepprg' is set to "internal" it still - matches "grep". - This command cannot be used to set the - 'makeprg' and 'grepprg' variables. - If this command causes an error, the quickfix - command is not executed. -QuickFixCmdPost *QuickFixCmdPost* - like QuickFixCmdPre, but after a quickfix - command is run. - *SessionLoadPost* -SessionLoadPost After loading the session file created using - the |:mksession| command. - *MenuPopup* -MenuPopup Just before showing the popup menu (under the - right mouse button). Useful for adjusting the - menu for what is under the cursor or mouse - pointer. - The pattern is matched against a single - character representing the mode: - n Normal - v Visual - o Operator-pending - i Insert - c Commmand line - *UserGettingBored* -UserGettingBored When the user hits CTRL-C. Just kidding! :-) *User* User Never executed automatically. To be used for autocommands that are only executed with ":doautocmd". - -You can specify a comma-separated list of event names. No white space can be -used in this list. The command applies to all the events in the list. - -For READING FILES there are four kinds of events possible: - BufNewFile starting to edit a non-existent file - BufReadPre BufReadPost starting to edit an existing file - FilterReadPre FilterReadPost read the temp file with filter output - FileReadPre FileReadPost any other file read -Vim uses only one of these four kinds when reading a file. The "Pre" and -"Post" events are both triggered, before and after reading the file. - -Note that the autocommands for the *ReadPre events and all the Filter events -are not allowed to change the current buffer (you will get an error message if -this happens). This is to prevent the file to be read into the wrong buffer. - -Note that the 'modified' flag is reset AFTER executing the BufReadPost -and BufNewFile autocommands. But when the 'modified' option was set by the -autocommands, this doesn't happen. - -You can use the 'eventignore' option to ignore a number of events or all -events. + *UserGettingBored* +UserGettingBored When the user hits CTRL-C. Just kidding! :-) + *VimEnter* +VimEnter After doing all the startup stuff, including + loading .vimrc files, executing the "-c cmd" + arguments, creating all windows and loading + the buffers in them. + *VimLeave* +VimLeave Before exiting Vim, just after writing the + .viminfo file. Executed only once, like + VimLeavePre. + To detect an abnormal exit use |v:dying|. + *VimLeavePre* +VimLeavePre Before exiting Vim, just before writing the + .viminfo file. This is executed only once, + if there is a match with the name of what + happens to be the current buffer when exiting. + Mostly useful with a "*" pattern. > + :autocmd VimLeavePre * call CleanupStuff() +< To detect an abnormal exit use |v:dying|. + *WinEnter* +WinEnter After entering another window. Not done for + the first window, when Vim has just started. + Useful for setting the window height. + If the window is for another buffer, Vim + executes the BufEnter autocommands after the + WinEnter autocommands. + Note: When using ":split fname" the WinEnter + event is triggered after the split but before + the file "fname" is loaded. + *WinLeave* +WinLeave Before leaving a window. If the window to be + entered next is for a different buffer, Vim + executes the BufLeave autocommands before the + WinLeave autocommands (but not for ":new"). + Not used for ":qa" or ":q" when exiting Vim. ============================================================================== 6. Patterns *autocmd-patterns* *{pat}* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index eeb07a2597..db88572bca 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Dec 06 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Dec 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1272,12 +1272,13 @@ v:fcs_choice What should happen after a |FileChangedShell| event was Vim behaves like it is empty, there is no warning message. *v:fname_in* *fname_in-variable* -v:fname_in The name of the input file. Only valid while evaluating: +v:fname_in The name of the input file. Valid while evaluating: option used for ~ 'charconvert' file to be converted 'diffexpr' original file 'patchexpr' original file 'printexpr' file to be printed + And set to the swap file name for |SwapExits|. *v:fname_out* *fname_out-variable* v:fname_out The name of the output file. Only valid while @@ -1400,6 +1401,23 @@ v:shell_error Result of the last shell command. When non-zero, the last *v:statusmsg* *statusmsg-variable* v:statusmsg Last given status message. It's allowed to set this variable. + *v:swapname* *swapname-variable* +v:swapname Only valid when executing |SwapExists| autocommands: Name of + the swap file found. Read-only. + + *v:swapchoice* *swapchoice-variable* +v:swapchoice |SwapExists| autocommands can set this to the selected choice + for handling an existing swap file: + 'o' Open read-only + 'e' Edit anyway + 'r' Recover + 'd' Delete swapfile + 'q' Quit + 'a' Abort + The value should be a single-character string. An empty value + results in the user being asked, as would happen when there is + no SwapExists autocommand. The default is empty. + *v:termresponse* *termresponse-variable* v:termresponse The escape sequence returned by the terminal for the |t_RV| termcap entry. It is set when Vim receives an escape sequence diff --git a/runtime/doc/tags b/runtime/doc/tags index 965719d275..0344a30a07 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -3034,7 +3034,6 @@ CursorHold autocmd.txt /*CursorHold* CursorHold-example windows.txt /*CursorHold-example* CursorIM mbyte.txt /*CursorIM* D change.txt /*D* -DCOP gui_x11.txt /*DCOP* DOS os_dos.txt /*DOS* DOS-format editing.txt /*DOS-format* DOS-format-write editing.txt /*DOS-format-write* @@ -3979,6 +3978,7 @@ SessionLoad-variable starting.txt /*SessionLoad-variable* SessionLoadPost autocmd.txt /*SessionLoadPost* StdinReadPost autocmd.txt /*StdinReadPost* StdinReadPre autocmd.txt /*StdinReadPre* +SwapExists autocmd.txt /*SwapExists* Syntax autocmd.txt /*Syntax* T motion.txt /*T* TCL if_tcl.txt /*TCL* @@ -4197,7 +4197,6 @@ alt-input debugger.txt /*alt-input* alternate-file editing.txt /*alternate-file* amiga-window starting.txt /*amiga-window* ant.vim syntax.txt /*ant.vim* -antialias gui_x11.txt /*antialias* ap motion.txt /*ap* apache.vim syntax.txt /*apache.vim* append() eval.txt /*append()* @@ -4229,6 +4228,7 @@ autocmd-buflocal autocmd.txt /*autocmd-buflocal* autocmd-changes autocmd.txt /*autocmd-changes* autocmd-define autocmd.txt /*autocmd-define* autocmd-events autocmd.txt /*autocmd-events* +autocmd-events-abc autocmd.txt /*autocmd-events-abc* autocmd-execute autocmd.txt /*autocmd-execute* autocmd-groups autocmd.txt /*autocmd-groups* autocmd-intro autocmd.txt /*autocmd-intro* @@ -5624,7 +5624,6 @@ jumpto-diffs diff.txt /*jumpto-diffs* k motion.txt /*k* kcc uganda.txt /*kcc* kde gui_x11.txt /*kde* -kde-toolbar gui_x11.txt /*kde-toolbar* key-codes intro.txt /*key-codes* key-codes-changed version4.txt /*key-codes-changed* key-mapping map.txt /*key-mapping* @@ -5975,7 +5974,6 @@ new-5 version5.txt /*new-5* new-6 version6.txt /*new-6* new-7 version7.txt /*new-7* new-GTK-GUI version5.txt /*new-GTK-GUI* -new-KDE version7.txt /*new-KDE* new-MzScheme version7.txt /*new-MzScheme* new-Select-mode version5.txt /*new-Select-mode* new-View version6.txt /*new-View* @@ -6570,7 +6568,9 @@ substitute-CR version6.txt /*substitute-CR* suffixes cmdline.txt /*suffixes* suspend starting.txt /*suspend* swap-file recover.txt /*swap-file* +swapchoice-variable eval.txt /*swapchoice-variable* swapfile-changed version4.txt /*swapfile-changed* +swapname-variable eval.txt /*swapname-variable* syn-sync-grouphere syntax.txt /*syn-sync-grouphere* syn-sync-groupthere syntax.txt /*syn-sync-groupthere* syn-sync-linecont syntax.txt /*syn-sync-linecont* @@ -6992,6 +6992,8 @@ v:scrollstart eval.txt /*v:scrollstart* v:servername eval.txt /*v:servername* v:shell_error eval.txt /*v:shell_error* v:statusmsg eval.txt /*v:statusmsg* +v:swapchoice eval.txt /*v:swapchoice* +v:swapname eval.txt /*v:swapname* v:termresponse eval.txt /*v:termresponse* v:this_session eval.txt /*v:this_session* v:throwpoint eval.txt /*v:throwpoint* @@ -7140,7 +7142,6 @@ vim-announce intro.txt /*vim-announce* vim-arguments starting.txt /*vim-arguments* vim-default-editor gui_w32.txt /*vim-default-editor* vim-dev intro.txt /*vim-dev* -vim-kpart gui_x11.txt /*vim-kpart* vim-mac intro.txt /*vim-mac* vim-modes intro.txt /*vim-modes* vim-modes-intro intro.txt /*vim-modes-intro* @@ -7160,7 +7161,6 @@ viminfo-file-marks starting.txt /*viminfo-file-marks* viminfo-file-name starting.txt /*viminfo-file-name* viminfo-read starting.txt /*viminfo-read* viminfo-write starting.txt /*viminfo-write* -vimpart gui_x11.txt /*vimpart* vimrc starting.txt /*vimrc* vimrc-filetype usr_05.txt /*vimrc-filetype* vimrc-intro usr_05.txt /*vimrc-intro* -- cgit v1.2.3