On 3/6/07, Bram Moolenaar <[EMAIL PROTECTED]> wrote:

It will help a lot to understand what you are talking about if you
include an example script.  Details might matter.

Well. In my _vimrc I set up an autocommand

autocmd BufWritePre * ks|call TimeStamp()|'s

I believe that content of TimeStamp is irrelevant, but just in case it matters:

function! TimeStamp()
 let lines = line("$") < 10 ? line("$") : 10
 let pattern1 = '\(Last [Cc]hange:\s\+\)\d\d\d\d \u\l\l \d\d'
 let replace1 = '\1' . strftime("%Y %b %d")
 execute printf('1,%ds/\C\m%s/%s/e', lines, pattern1, replace1)
 execute printf('$-%d+1,$s/\C\m%s/%s/e', lines, pattern1, replace1)
 let pattern2 = '\($Id: \f\+ \d\+\.\d\+\(\.\d\+\.\d\+\)*\)\(+\(\d\+\)\)\?'
 let replace2 = '\=submatch(1) . "+" . (submatch(4) + 1)'
 execute printf('1,%ds/\C\m%s/%s/e', lines, pattern2, replace2)
 execute printf('$-%d+1,$s/\C\m%s/%s/e', lines, pattern2, replace2)
endfunction

When I save buffer with :w -- it works.
When I save buffer with :wq -- it works.
But when I save buffer with :wqa -- it doesn't work.
Vim 7.0, not patched, win32 and dos32 versions.

My whole _vimrc is at http://45.free.net/~slobin/vim/_vimrc.html if this helps.

--
Cyril Slobin <[EMAIL PROTECTED]> `When I use a word,' Humpty Dumpty said,
<http://45.free.net/~slobin> `it means just what I choose it to mean'

Reply via email to