I am implementing Plain Text/Source Code File Header for Vim and I need my parser to run after the file, since it needs the first 60 lines of the buffer. I successfully made a manual parser, but it needs me to run call PtScParse()
on each buffer by hand. Is there a way to make PtScParse()
automatically run on each buffer?
My parser is on this DARCS repo . Look for the ptsc-header.vim
file.
Reading the documentation in :help initialization
and :help :autocmd
I found my solution. All I had to do was to add the following line at the end of the script:
autocmd VimEnter * call PtScHeaderParse()
It calls PtScHeaderParse()
on all files on event VimEnter
. Now every time I open a file, the function runs and shows my code properly :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.