updated for version 7.0164

This commit is contained in:
Bram Moolenaar
2005-12-07 21:04:31 +00:00
parent b815dac061
commit 4e330bbf21
6 changed files with 528 additions and 380 deletions

View File

@ -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 VIM REFERENCE MANUAL by Bram Moolenaar
@ -169,18 +169,195 @@ See |:verbose-cmd| for more information.
============================================================================== ==============================================================================
5. Events *autocmd-events* *E215* *E216* 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}* *autocommand-events* *{event}*
Vim recognizes the following events. Vim ignores the case of event names Vim recognizes the following events. Vim ignores the case of event names
(e.g., you can use "BUFread" or "bufread" instead of "BufRead"). (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 <Insert> 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 "<afile>".
*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 "<afile>".
*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 "<afile>".
*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 "<afile>".
*BufNewFile* *BufNewFile*
BufNewFile When starting to edit a file that doesn't BufNewFile When starting to edit a file that doesn't
exist. Can be used to read in a skeleton exist. Can be used to read in a skeleton
file. 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* *BufReadPost*
BufRead or BufReadPost When starting to edit a new buffer, after BufRead or BufReadPost When starting to edit a new buffer, after
reading the file into the buffer, before reading the file into the buffer, before
@ -190,63 +367,49 @@ BufRead or BufReadPost When starting to edit a new buffer, after
This does NOT work for ":r file". Not used This does NOT work for ":r file". Not used
when the file doesn't exist. Also used after when the file doesn't exist. Also used after
successfully recovering a file. successfully recovering a file.
*BufReadCmd* *BufReadPre* *E200* *E201*
BufReadCmd Before starting to edit a new buffer. Should BufReadCmd Before starting to edit a new buffer. Should
read the file into the buffer. |Cmd-event| read the file into the buffer. |Cmd-event|
*BufFilePre* *BufFilePre*
BufFilePre Before changing the name of the current buffer BufReadPre When starting to edit a new buffer, before
with the ":file" or ":saveas" command. reading the file into the buffer. Not used
*BufFilePost* if the file doesn't exist.
BufFilePost After changing the name of the current buffer *BufUnload*
with the ":file" or ":saveas" command. BufUnload Before unloading a buffer. This is when the
*FileReadPre* text in the buffer is going to be freed. This
FileReadPre Before reading a file with a ":read" command. may be after a BufWritePost and before a
*FileReadPost* BufDelete. Also used for all buffers that are
FileReadPost After reading a file with a ":read" command. loaded when Vim is going to exit.
Note that Vim sets the '[ and '] marks to the NOTE: When this autocommand is executed, the
first and last line of the read. This can be current buffer "%" may be different from the
used to operate on the lines just read. buffer being unloaded "<afile>".
*FileReadCmd* *BufWinEnter*
FileReadCmd Before reading a file with a ":read" command. BufWinEnter After a buffer is displayed in a window. This
Should do the reading of the file. |Cmd-event| can be when the buffer is loaded (after
*FilterReadPre* *E135* processing the modelines), when a hidden
FilterReadPre Before reading a file from a filter command. buffer is displayed in a window (and is no
Vim checks the pattern against the name of longer hidden) or a buffer already visible in
the current buffer, not the name of the a window is also displayed in another window.
temporary file that is the output of the *BufWinLeave*
filter command. BufWinLeave Before a buffer is removed from a window.
Not triggered when 'shelltemp' is off. Not when it's still visible in another window.
*FilterReadPost* Also triggered when exiting. It's triggered
FilterReadPost After reading a file from a filter command. before BufUnload or BufHidden.
Vim checks the pattern against the name of NOTE: When this autocommand is executed, the
the current buffer as with FilterReadPre. current buffer "%" may be different from the
Not triggered when 'shelltemp' is off. buffer being unloaded "<afile>".
*FileType* *BufWipeout*
FileType When the 'filetype' option has been set. BufWipeout Before completely deleting a buffer. The
<afile> can be used for the name of the file BufUnload and BufDelete events may be called
where this option was set, and <amatch> for first (if the buffer was loaded and was in the
the new value of 'filetype'. buffer list). Also used just before a buffer
See |filetypes|. is renamed (also when it's not in the buffer
*Syntax* list).
Syntax When the 'syntax' option has been set. NOTE: When this autocommand is executed, the
<afile> can be used for the name of the file current buffer "%" may be different from the
where this option was set, and <amatch> for buffer being deleted "<afile>".
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* *BufWritePre*
BufWrite or BufWritePre Before writing the whole buffer to a file. 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*
BufWriteCmd Before writing the whole buffer to a file. BufWriteCmd Before writing the whole buffer to a file.
Should do the writing of the file and reset Should do the writing of the file and reset
@ -254,42 +417,68 @@ BufWriteCmd Before writing the whole buffer to a file.
'cpo' and writing to another file |cpo-+|. 'cpo' and writing to another file |cpo-+|.
The buffer contents should not be changed. The buffer contents should not be changed.
|Cmd-event| |Cmd-event|
*FileWritePre* *BufWritePost*
FileWritePre Before writing to a file, when not writing the BufWritePost After writing the whole buffer to a file
whole buffer. Use the '[ and '] marks for the (should undo the commands for BufWritePre).
range of lines. *CmdwinEnter*
*FileWritePost* CmdwinEnter After entering the command-line window.
FileWritePost After writing to a file, when not writing the Useful for setting options specifically for
whole buffer. this special type of window. This is
*FileWriteCmd* triggered _instead_ of BufEnter and WinEnter.
FileWriteCmd Before writing to a file, when not writing the <afile> is set to a single character,
whole buffer. Should do the writing to the indicating the type of command-line.
file. Should not change the buffer. Use the |cmdwin-char|
'[ and '] marks for the range of lines. *CmdwinLeave*
|Cmd-event| CmdwinLeave Before leaving the command-line window.
*FileAppendPre* Useful to clean up any global setting done
FileAppendPre Before appending to a file. Use the '[ and '] with CmdwinEnter. This is triggered _instead_
marks for the range of lines. of BufLeave and WinLeave.
*FileAppendPost* <afile> is set to a single character,
FileAppendPost After appending to a file. 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*
FileAppendCmd Before appending to a file. Should do the FileAppendCmd Before appending to a file. Should do the
appending to the file. Use the '[ and '] appending to the file. Use the '[ and ']
marks for the range of lines.|Cmd-event| marks for the range of lines.|Cmd-event|
*FilterWritePre* *FileAppendPost*
FilterWritePre Before writing a file for a filter command or FileAppendPost After appending to a file.
making a diff. *FileAppendPre*
Vim checks the pattern against the name of FileAppendPre Before appending to a file. Use the '[ and ']
the current buffer, not the name of the marks for the range of lines.
temporary file that is the output of the *FileChangedRO*
filter command. FileChangedRO Before making the first change to a read-only
Not triggered when 'shelltemp' is off. file. Can be used to check-out the file from
*FilterWritePost* a source control system. Not triggered when
FilterWritePost After writing a file for a filter command or the change was caused by an autocommand.
making a diff. This event is triggered when making the first
Vim checks the pattern against the name of change in a buffer or the first change after
the current buffer as with FilterWritePre. 'readonly' was set,
Not triggered when 'shelltemp' is off. 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*
FileChangedShell When Vim notices that the modification time of FileChangedShell When Vim notices that the modification time of
a file has changed since editing started. a file has changed since editing started.
@ -319,17 +508,64 @@ FileChangedShell When Vim notices that the modification time of
commands for the FileChangedShell event no commands for the FileChangedShell event no
other FileChangedShell event will be other FileChangedShell event will be
triggered. triggered.
*FileChangedRO* *FileEncoding*
FileChangedRO Before making the first change to a read-only FileEncoding Obsolete. It still works and is equivalent
file. Can be used to check-out the file from to |EncodingChanged|.
a source control system. Not triggered when *FileReadCmd*
the change was caused by an autocommand. FileReadCmd Before reading a file with a ":read" command.
This event is triggered when making the first Should do the reading of the file. |Cmd-event|
change in a buffer or the first change after *FileReadPost*
'readonly' was set, FileReadPost After reading a file with a ":read" command.
just before the change is applied to the text. Note that Vim sets the '[ and '] marks to the
WARNING: If the autocommand moves the cursor first and last line of the read. This can be
the effect of the change is undefined. 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.
<afile> can be used for the name of the file
where this option was set, and <amatch> 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*
FocusGained When Vim got input focus. Only for the GUI FocusGained When Vim got input focus. Only for the GUI
version and a few console versions where this version and a few console versions where this
@ -345,104 +581,134 @@ FuncUndefined When a user function is used but it isn't
when it's used. Both <amatch> and <afile> are when it's used. Both <amatch> and <afile> are
set to the name of the function. set to the name of the function.
See |autoload-functions|. See |autoload-functions|.
*CursorHold* *GUIEnter*
CursorHold When the user doesn't press a key for the time GUIEnter After starting the GUI successfully, and after
specified with 'updatetime'. Not re-triggered opening the window. It is triggered before
until the user has pressed a key (i.e. doesn't VimEnter when using gvim. Can be used to
fire every 'updatetime' ms if you leave Vim to position the window from a .gvimrc file: >
make some coffee. :) See |CursorHold-example| :autocmd GUIEnter * winpos 100 50
for previewing tags. < *InsertChange*
This event is only triggered in Normal mode. InsertChange When typing <Insert> while in Insert or
Note: Interactive commands cannot be used for Replace mode. The |v:insertmode| variable
this event. There is no hit-enter prompt, indicates the new mode.
the screen is updated directly (when needed). Be careful not to move the cursor or do
Note: In the future there will probably be anything else that the user does not expect.
another option to set the time. *InsertEnter*
Hint: to force an update of the status lines InsertEnter When starting Insert mode. Also for Replace
use: > mode and Virtual Replace mode. The
:let &ro = &ro |v:insertmode| variable indicates the mode.
< {only on Amiga, Unix, Win32, MSDOS and all GUI Be careful not to move the cursor or do
versions} anything else that the user does not expect.
*BufEnter* *InsertLeave*
BufEnter After entering a buffer. Useful for setting InsertLeave When leaving Insert mode. Also when using
options for a file type. Also executed when CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
starting to edit a buffer, after the *MenuPopup*
BufReadPost autocommands. MenuPopup Just before showing the popup menu (under the
*BufLeave* right mouse button). Useful for adjusting the
BufLeave Before leaving to another buffer. Also when menu for what is under the cursor or mouse
leaving or closing the current window and the pointer.
new current window is not for the same buffer. The pattern is matched against a single
Not used for ":qa" or ":q" when exiting Vim. character representing the mode:
*BufWinEnter* n Normal
BufWinEnter After a buffer is displayed in a window. This v Visual
can be when the buffer is loaded (after o Operator-pending
processing the modelines), when a hidden i Insert
buffer is displayed in a window (and is no c Commmand line
longer hidden) or a buffer already visible in *QuickFixCmdPre*
a window is also displayed in another window. QuickFixCmdPre Before a quickfix command is run (|:make|,
*BufWinLeave* |:grep|, |:grepadd|, |:vimgrep|,
BufWinLeave Before a buffer is removed from a window. |:vimgrepadd|). The pattern is matched against
Not when it's still visible in another window. the command being run. When |:grep| is used
Also triggered when exiting. It's triggered but 'grepprg' is set to "internal" it still
before BufUnload or BufHidden. matches "grep".
NOTE: When this autocommand is executed, the This command cannot be used to set the
current buffer "%" may be different from the 'makeprg' and 'grepprg' variables.
buffer being unloaded "<afile>". If this command causes an error, the quickfix
*BufUnload* command is not executed.
BufUnload Before unloading a buffer. This is when the *QuickFixCmdPost*
text in the buffer is going to be freed. This QuickFixCmdPost Like QuickFixCmdPre, but after a quickfix
may be after a BufWritePost and before a command is run.
BufDelete. Also used for all buffers that are *RemoteReply*
loaded when Vim is going to exit. RemoteReply When a reply from a Vim that functions as
NOTE: When this autocommand is executed, the server was received |server2client()|.
current buffer "%" may be different from the <amatch> is equal to the {serverid} from which
buffer being unloaded "<afile>". the reply was sent, and <afile> is the actual
*BufHidden* reply string.
BufHidden Just after a buffer has become hidden. That Note that even if an autocommand is defined,
is, when there are no longer windows that show the reply should be read with |remote_read()|
the buffer, but the buffer is not unloaded or to consume it.
deleted. Not used for ":qa" or ":q" when *SessionLoadPost*
exiting Vim. SessionLoadPost After loading the session file created using
NOTE: When this autocommand is executed, the the |:mksession| command.
current buffer "%" may be different from the *StdinReadPost*
buffer being unloaded "<afile>". StdinReadPost After reading from the stdin into the buffer,
*BufNew* before executing the modelines. Only used
BufNew Just after creating a new buffer. Also used when the "-" argument was used when Vim was
just after a buffer has been renamed. When started |--|.
the buffer is added to the buffer list BufAdd *StdinReadPre*
will be triggered too. StdinReadPre Before reading from stdin into the buffer.
NOTE: When this autocommand is executed, the Only used when the "-" argument was used when
current buffer "%" may be different from the Vim was started |--|.
buffer being created "<afile>". *SwapExists*
*BufCreate* *BufAdd* SwapExists Detected an existing swap file when starting
BufAdd or BufCreate Just after creating a new buffer which is to edit a file. Only when it is possible to
added to the buffer list, or adding a buffer select a way to handle the situation, when Vim
to the buffer list. would ask the user what to do.
Also used just after a buffer in the buffer The |v:swapname| variable holds the name of
list has been renamed. the swap file found.
The BufCreate event is for historic reasons. The |v:swapchoice| variable should be set to
NOTE: When this autocommand is executed, the a string with one character to tell what Vim
current buffer "%" may be different from the should do next:
buffer being created "<afile>". 'o' open read-only
*BufDelete* 'e' edit the file anyway
BufDelete Before deleting a buffer from the buffer list. 'r' recover
The BufUnload may be called first (if the 'd' delete the swap file
buffer was loaded). 'q' quit, don't edit the file
Also used just before a buffer in the buffer 'a' abort, like hitting CTRL-C
list is renamed. When set to an empty string the user will be
NOTE: When this autocommand is executed, the asked, as if there was no SwapExists autocmd.
current buffer "%" may be different from the Note: Do not try to change the buffer, the
buffer being deleted "<afile>". results are unpredictable.
*BufWipeout* *Syntax*
BufWipeout Before completely deleting a buffer. The Syntax When the 'syntax' option has been set.
BufUnload and BufDelete events may be called <afile> can be used for the name of the file
first (if the buffer was loaded and was in the where this option was set, and <amatch> for
buffer list). Also used just before a buffer the new value of 'syntax'.
is renamed (also when it's not in the buffer See |:syn-on|.
list). *TermChanged*
NOTE: When this autocommand is executed, the TermChanged After the value of 'term' has changed. Useful
current buffer "%" may be different from the for re-loading the syntax file to update the
buffer being deleted "<afile>". colors, fonts and other terminal-dependent
settings. Executed for all loaded buffers.
*TermResponse*
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.
*User*
User Never executed automatically. To be used for
autocommands that are only executed with
":doautocmd".
*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*
WinEnter After entering another window. Not done for WinEnter After entering another window. Not done for
the first window, when Vim has just started. the first window, when Vim has just started.
@ -459,145 +725,6 @@ WinLeave Before leaving a window. If the window to be
executes the BufLeave autocommands before the executes the BufLeave autocommands before the
WinLeave autocommands (but not for ":new"). WinLeave autocommands (but not for ":new").
Not used for ":qa" or ":q" when exiting Vim. Not used for ":qa" or ":q" when exiting Vim.
*CmdwinEnter*
CmdwinEnter After entering the command-line window.
Useful for setting options specifically for
this special type of window. This is
triggered _instead_ of BufEnter and WinEnter.
<afile> is set to a single character,
indicating the type of command-line.
|cmdwin-char|
*CmdwinLeave*
CmdwinLeave Before leaving the command-line window.
Useful to clean up any global setting done
with CmdwinEnter. This is triggered _instead_
of BufLeave and WinLeave.
<afile> is set to a single character,
indicating the type of command-line.
|cmdwin-char|
*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.
*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 <Insert> 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|
*RemoteReply*
RemoteReply When a reply from a Vim that functions as
server was received |server2client()|.
<amatch> is equal to the {serverid} from which
the reply was sent, and <afile> is the actual
reply string.
Note that even if an autocommand is defined,
the reply should be read with |remote_read()|
to consume it.
*TermChanged*
TermChanged After the value of 'term' has changed. Useful
for re-loading the syntax file to update the
colors, fonts and other terminal-dependent
settings. Executed for all loaded buffers.
*TermResponse*
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.
============================================================================== ==============================================================================
6. Patterns *autocmd-patterns* *{pat}* 6. Patterns *autocmd-patterns* *{pat}*

View File

@ -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 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. Vim behaves like it is empty, there is no warning message.
*v:fname_in* *fname_in-variable* *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 ~ option used for ~
'charconvert' file to be converted 'charconvert' file to be converted
'diffexpr' original file 'diffexpr' original file
'patchexpr' original file 'patchexpr' original file
'printexpr' file to be printed 'printexpr' file to be printed
And set to the swap file name for |SwapExits|.
*v:fname_out* *fname_out-variable* *v:fname_out* *fname_out-variable*
v:fname_out The name of the output file. Only valid while 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* *statusmsg-variable*
v:statusmsg Last given status message. It's allowed to set this 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* *termresponse-variable*
v:termresponse The escape sequence returned by the terminal for the |t_RV| v:termresponse The escape sequence returned by the terminal for the |t_RV|
termcap entry. It is set when Vim receives an escape sequence termcap entry. It is set when Vim receives an escape sequence

View File

@ -3034,7 +3034,6 @@ CursorHold autocmd.txt /*CursorHold*
CursorHold-example windows.txt /*CursorHold-example* CursorHold-example windows.txt /*CursorHold-example*
CursorIM mbyte.txt /*CursorIM* CursorIM mbyte.txt /*CursorIM*
D change.txt /*D* D change.txt /*D*
DCOP gui_x11.txt /*DCOP*
DOS os_dos.txt /*DOS* DOS os_dos.txt /*DOS*
DOS-format editing.txt /*DOS-format* DOS-format editing.txt /*DOS-format*
DOS-format-write editing.txt /*DOS-format-write* DOS-format-write editing.txt /*DOS-format-write*
@ -3979,6 +3978,7 @@ SessionLoad-variable starting.txt /*SessionLoad-variable*
SessionLoadPost autocmd.txt /*SessionLoadPost* SessionLoadPost autocmd.txt /*SessionLoadPost*
StdinReadPost autocmd.txt /*StdinReadPost* StdinReadPost autocmd.txt /*StdinReadPost*
StdinReadPre autocmd.txt /*StdinReadPre* StdinReadPre autocmd.txt /*StdinReadPre*
SwapExists autocmd.txt /*SwapExists*
Syntax autocmd.txt /*Syntax* Syntax autocmd.txt /*Syntax*
T motion.txt /*T* T motion.txt /*T*
TCL if_tcl.txt /*TCL* TCL if_tcl.txt /*TCL*
@ -4197,7 +4197,6 @@ alt-input debugger.txt /*alt-input*
alternate-file editing.txt /*alternate-file* alternate-file editing.txt /*alternate-file*
amiga-window starting.txt /*amiga-window* amiga-window starting.txt /*amiga-window*
ant.vim syntax.txt /*ant.vim* ant.vim syntax.txt /*ant.vim*
antialias gui_x11.txt /*antialias*
ap motion.txt /*ap* ap motion.txt /*ap*
apache.vim syntax.txt /*apache.vim* apache.vim syntax.txt /*apache.vim*
append() eval.txt /*append()* append() eval.txt /*append()*
@ -4229,6 +4228,7 @@ autocmd-buflocal autocmd.txt /*autocmd-buflocal*
autocmd-changes autocmd.txt /*autocmd-changes* autocmd-changes autocmd.txt /*autocmd-changes*
autocmd-define autocmd.txt /*autocmd-define* autocmd-define autocmd.txt /*autocmd-define*
autocmd-events autocmd.txt /*autocmd-events* autocmd-events autocmd.txt /*autocmd-events*
autocmd-events-abc autocmd.txt /*autocmd-events-abc*
autocmd-execute autocmd.txt /*autocmd-execute* autocmd-execute autocmd.txt /*autocmd-execute*
autocmd-groups autocmd.txt /*autocmd-groups* autocmd-groups autocmd.txt /*autocmd-groups*
autocmd-intro autocmd.txt /*autocmd-intro* autocmd-intro autocmd.txt /*autocmd-intro*
@ -5624,7 +5624,6 @@ jumpto-diffs diff.txt /*jumpto-diffs*
k motion.txt /*k* k motion.txt /*k*
kcc uganda.txt /*kcc* kcc uganda.txt /*kcc*
kde gui_x11.txt /*kde* kde gui_x11.txt /*kde*
kde-toolbar gui_x11.txt /*kde-toolbar*
key-codes intro.txt /*key-codes* key-codes intro.txt /*key-codes*
key-codes-changed version4.txt /*key-codes-changed* key-codes-changed version4.txt /*key-codes-changed*
key-mapping map.txt /*key-mapping* key-mapping map.txt /*key-mapping*
@ -5975,7 +5974,6 @@ new-5 version5.txt /*new-5*
new-6 version6.txt /*new-6* new-6 version6.txt /*new-6*
new-7 version7.txt /*new-7* new-7 version7.txt /*new-7*
new-GTK-GUI version5.txt /*new-GTK-GUI* new-GTK-GUI version5.txt /*new-GTK-GUI*
new-KDE version7.txt /*new-KDE*
new-MzScheme version7.txt /*new-MzScheme* new-MzScheme version7.txt /*new-MzScheme*
new-Select-mode version5.txt /*new-Select-mode* new-Select-mode version5.txt /*new-Select-mode*
new-View version6.txt /*new-View* new-View version6.txt /*new-View*
@ -6570,7 +6568,9 @@ substitute-CR version6.txt /*substitute-CR*
suffixes cmdline.txt /*suffixes* suffixes cmdline.txt /*suffixes*
suspend starting.txt /*suspend* suspend starting.txt /*suspend*
swap-file recover.txt /*swap-file* swap-file recover.txt /*swap-file*
swapchoice-variable eval.txt /*swapchoice-variable*
swapfile-changed version4.txt /*swapfile-changed* swapfile-changed version4.txt /*swapfile-changed*
swapname-variable eval.txt /*swapname-variable*
syn-sync-grouphere syntax.txt /*syn-sync-grouphere* syn-sync-grouphere syntax.txt /*syn-sync-grouphere*
syn-sync-groupthere syntax.txt /*syn-sync-groupthere* syn-sync-groupthere syntax.txt /*syn-sync-groupthere*
syn-sync-linecont syntax.txt /*syn-sync-linecont* 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:servername eval.txt /*v:servername*
v:shell_error eval.txt /*v:shell_error* v:shell_error eval.txt /*v:shell_error*
v:statusmsg eval.txt /*v:statusmsg* 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:termresponse eval.txt /*v:termresponse*
v:this_session eval.txt /*v:this_session* v:this_session eval.txt /*v:this_session*
v:throwpoint eval.txt /*v:throwpoint* v:throwpoint eval.txt /*v:throwpoint*
@ -7140,7 +7142,6 @@ vim-announce intro.txt /*vim-announce*
vim-arguments starting.txt /*vim-arguments* vim-arguments starting.txt /*vim-arguments*
vim-default-editor gui_w32.txt /*vim-default-editor* vim-default-editor gui_w32.txt /*vim-default-editor*
vim-dev intro.txt /*vim-dev* vim-dev intro.txt /*vim-dev*
vim-kpart gui_x11.txt /*vim-kpart*
vim-mac intro.txt /*vim-mac* vim-mac intro.txt /*vim-mac*
vim-modes intro.txt /*vim-modes* vim-modes intro.txt /*vim-modes*
vim-modes-intro intro.txt /*vim-modes-intro* 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-file-name starting.txt /*viminfo-file-name*
viminfo-read starting.txt /*viminfo-read* viminfo-read starting.txt /*viminfo-read*
viminfo-write starting.txt /*viminfo-write* viminfo-write starting.txt /*viminfo-write*
vimpart gui_x11.txt /*vimpart*
vimrc starting.txt /*vimrc* vimrc starting.txt /*vimrc*
vimrc-filetype usr_05.txt /*vimrc-filetype* vimrc-filetype usr_05.txt /*vimrc-filetype*
vimrc-intro usr_05.txt /*vimrc-intro* vimrc-intro usr_05.txt /*vimrc-intro*

View File

@ -841,9 +841,12 @@ EXTERN int msg_silent INIT(= 0); /* don't print messages */
EXTERN int emsg_silent INIT(= 0); /* don't print error messages */ EXTERN int emsg_silent INIT(= 0); /* don't print error messages */
EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */ EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \
EXTERN int swap_exists_action INIT(= 0); /* use dialog when swap file || defined(FEAT_AUTOCMD)
already exists */ # define HAS_SWAP_EXISTS_ACTION
EXTERN int swap_exists_action INIT(= SEA_NONE);
/* For dialog when swap file already
* exists. */
#endif #endif
EXTERN char_u *IObuff; /* sprintf's are done in this buffer, EXTERN char_u *IObuff; /* sprintf's are done in this buffer,

View File

@ -1,32 +1,32 @@
/* memline.c */ /* memline.c */
int ml_open __ARGS((void)); extern int ml_open __ARGS((void));
void ml_setname __ARGS((buf_T *buf)); extern void ml_setname __ARGS((buf_T *buf));
void ml_open_files __ARGS((void)); extern void ml_open_files __ARGS((void));
void ml_open_file __ARGS((buf_T *buf)); extern void ml_open_file __ARGS((buf_T *buf));
void check_need_swap __ARGS((int newfile)); extern void check_need_swap __ARGS((int newfile));
void ml_close __ARGS((buf_T *buf, int del_file)); extern void ml_close __ARGS((buf_T *buf, int del_file));
void ml_close_all __ARGS((int del_file)); extern void ml_close_all __ARGS((int del_file));
void ml_close_notmod __ARGS((void)); extern void ml_close_notmod __ARGS((void));
void ml_timestamp __ARGS((buf_T *buf)); extern void ml_timestamp __ARGS((buf_T *buf));
void ml_recover __ARGS((void)); extern void ml_recover __ARGS((void));
int recover_names __ARGS((char_u **fname, int list, int nr)); extern int recover_names __ARGS((char_u **fname, int list, int nr));
void ml_sync_all __ARGS((int check_file, int check_char)); extern void ml_sync_all __ARGS((int check_file, int check_char));
void ml_preserve __ARGS((buf_T *buf, int message)); extern void ml_preserve __ARGS((buf_T *buf, int message));
char_u *ml_get __ARGS((linenr_T lnum)); extern char_u *ml_get __ARGS((linenr_T lnum));
char_u *ml_get_pos __ARGS((pos_T *pos)); extern char_u *ml_get_pos __ARGS((pos_T *pos));
char_u *ml_get_curline __ARGS((void)); extern char_u *ml_get_curline __ARGS((void));
char_u *ml_get_cursor __ARGS((void)); extern char_u *ml_get_cursor __ARGS((void));
char_u *ml_get_buf __ARGS((buf_T *buf, linenr_T lnum, int will_change)); extern char_u *ml_get_buf __ARGS((buf_T *buf, linenr_T lnum, int will_change));
int ml_line_alloced __ARGS((void)); extern int ml_line_alloced __ARGS((void));
int ml_append __ARGS((linenr_T lnum, char_u *line, colnr_T len, int newfile)); extern int ml_append __ARGS((linenr_T lnum, char_u *line, colnr_T len, int newfile));
int ml_replace __ARGS((linenr_T lnum, char_u *line, int copy)); extern int ml_replace __ARGS((linenr_T lnum, char_u *line, int copy));
int ml_delete __ARGS((linenr_T lnum, int message)); extern int ml_delete __ARGS((linenr_T lnum, int message));
void ml_setmarked __ARGS((linenr_T lnum)); extern void ml_setmarked __ARGS((linenr_T lnum));
linenr_T ml_firstmarked __ARGS((void)); extern linenr_T ml_firstmarked __ARGS((void));
void ml_clearmarked __ARGS((void)); extern void ml_clearmarked __ARGS((void));
char_u *makeswapname __ARGS((char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name)); extern char_u *makeswapname __ARGS((char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name));
char_u *get_file_in_dir __ARGS((char_u *fname, char_u *dname)); extern char_u *get_file_in_dir __ARGS((char_u *fname, char_u *dname));
void ml_setflags __ARGS((buf_T *buf)); extern void ml_setflags __ARGS((buf_T *buf));
long ml_find_line_or_offset __ARGS((buf_T *buf, linenr_T lnum, long *offp)); extern long ml_find_line_or_offset __ARGS((buf_T *buf, linenr_T lnum, long *offp));
void goto_byte __ARGS((long cnt)); extern void goto_byte __ARGS((long cnt));
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA" #define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 6)" #define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 7)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 6, compiled " #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 7, compiled "