vim autocmd не работает

535
social_loser

Вот мой файл vimrc:

set nocompatible  filetype on   function Dateinsert() $read !date endfunction  :autocmd FileWritePre * :call Dateinsert() 

Я ожидал вставить метку времени каждый раз при записи в файл. Но это никогда не работает. Как я могу это исправить?

1

1 ответ на вопрос

0
Ingo Karkat

:help FileWritePre дает подсказку:

FileWritePre Before writing to a file, when not writing the whole buffer. 

Правильное событие autocmd для обычных :writes BufWritePre:

BufWrite or BufWritePre Before writing the whole buffer to a file.