On 07/20/13 16:49, Charles Smith wrote:
Thank you gentlemen for your thoughts. I tried the BufEnter event
(adding it to the list) and it didn't help. Indeed, the existance of a
BufEnter event raises the question of why BufNewFile or BufRead events
... what the difference is between BufEnter and BufRead is.
Let's say you do the following (I've tried to display autocommand event
sequences correctly but maybe I've inverted some):
vim
--> sources your vimrc; I assume it sets :filettype plugin on and
:syntax on
--> sources global plugins
--> VimEnter event
:e file1.c
--> BufReadPre event
--> reads the file into a buffer and displays it in the current window
--> BufRead[Post] event
--> filetype.vim recognises it as type "c"
--> FileType event
--> sources c.vim filetype plugins
--> Syntax event
--> sources c.vim syntax plugins
--> BufWinEnter event (or maybe earlier?)
--> BufEnter event
:new file2.c
--> BufLeave event (for file1.c)
--> then the same as above but for file2.c, except the file is
displayed in a _new_ (split) window.
Ctrl-W W
--> BufLeave event (for file2.c) \ and nothing else, because both files
are already each loaded in a buffer and displayed in a window
--> BufEnter event (for file1.c) /
:qa " assuming the files haven't been modified
--> BufWinLeave event (once for each file)
--> BufLeave event (once for each file)
--> VimLeave event
--> quits
See in the help the description of each event, e.g. :help BufEnter
So you see, BufReadPre and BufReadPost are invoked when reading the file
from disk, BufEnter and/or BufLeave are invoked each time you make a
different file current.
Best regards,
Tony.
--
Eye have a spelling checker, it came with my PC;
It plainly marks four my revue mistakes I cannot sea.
I've run this poem threw it, I'm sure your please to no,
It's letter perfect in it's weigh, my checker tolled me sew!
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.