~pkg-vim/vim/pkg-vim-mirror-unstable

« back to all changes in this revision

Viewing changes to runtime/doc/usr_40.txt

  • Committer: Bram Moolenaar
  • Date: 2013-08-10 13:00:24 UTC
  • mto: (2438.1.2)
  • mto: This revision was merged to the branch mainline in revision 2370.
  • Revision ID: git-v1:cc2cb4822fbddbd2d8820885d61af93d04a79728
releaseĀ versionĀ 7.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
*usr_40.txt*    For Vim version 7.4b.  Last change: 2006 Jun 21
 
1
*usr_40.txt*    For Vim version 7.4.  Last change: 2013 Aug 05
2
2
 
3
3
                     VIM USER MANUAL - by Bram Moolenaar
4
4
 
440
440
        :  read !date
441
441
        :endfunction
442
442
 
443
 
You want this function to be called each time, just before a file is written.
444
 
This will make that happen: >
445
 
 
446
 
        :autocmd FileWritePre *  call DateInsert()
447
 
 
448
 
"FileWritePre" is the event for which this autocommand is triggered: Just
449
 
before (pre) writing a file.  The "*" is a pattern to match with the file
450
 
name.  In this case it matches all files.
 
443
You want this function to be called each time, just before a buffer is written
 
444
to a file.  This will make that happen: >
 
445
 
 
446
        :autocmd BufWritePre *  call DateInsert()
 
447
 
 
448
"BufWritePre" is the event for which this autocommand is triggered: Just
 
449
before (pre) writing a buffer to a file.  The "*" is a pattern to match with
 
450
the file name.  In this case it matches all files.
451
451
   With this command enabled, when you do a ":write", Vim checks for any
452
 
matching FileWritePre autocommands and executes them, and then it
 
452
matching BufWritePre autocommands and executes them, and then it
453
453
performs the ":write".
454
454
   The general form of the :autocmd command is as follows: >
455
455