Loading ...
Sorry, an error occurred while loading the content.

Re: BufRead not reexecuted when returning to a buffer?

Expand Messages
  • Marcin Szamotulski
    ... Good point, indeed I use hidden. Regards, Marcin -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the
    Message 1 of 8 , Jul 20, 2013
    • 0 Attachment
      On 00:30 Sun 21 Jul , Nikolay Pavlov wrote:
      > On Jul 20, 2013 7:41 PM, "Marcin Szamotulski" <mszamot@...> wrote:
      > >
      > > On 16:49 Sat 20 Jul , 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.
      > > >
      > > > As to the question of why the coloring goes away when I leave a buffer,
      > I
      > > > thought that might point to the problem, but then I discovered that if I
      > > > say,
      > > >
      > > > vim known-file unknown-file
      > > >
      > > > on the command line, known-file colorizes according to its suffix, but
      > > > unknown-file doen't But
      > > >
      > > > vim unknown-file
      > > >
      > > > does colorize properly (until I switch buffers)
      > > >
      > > > ah, important information forgotten to be supplied - it is a known type,
      > > > just the wrong one. It's some file type called "conf". So, the
      > > > recognition algorithm keeps looking ...
      > >
      > > Just try them:
      > >
      > > autocmd BufEnter * :echom 'BufEnter '.expand('<afile>:p')
      > > autocmd BufRead * :echom 'BufRead '.expand('<afile>:p')
      > > autocmd BufNewFile * :echom 'BufNewFile'
      > >
      > > Open files, open new files change the buffers: you will see taht BufRead
      > > only fires when vim is reading a file from the disc (this is usually
      > > done once, where vim starts or when you use :edit command) and BufEnter is
      > > fired whenever you change the buffer, i.e. when you enter a buffer: for
      > > example whenever you use the :b command or ^W normal commands to switch
      > > between windows with different buffers.
      >
      > You forgot about 'hidden' option. By default it is not set and vim reads
      > buffer from disk each time it disappears from all windows and then is
      > viewed again. Thus if one does not use windows and have default setting for
      > 'hidden' there are less differences. BufRead is not fired for new files
      > though.


      Good point, indeed I use hidden.

      Regards,
      Marcin

      --
      --
      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 vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    Your message has been successfully submitted and would be delivered to recipients shortly.