Thursday, May 25, 2017

Re: Bug in ftdetect?

Frew Schmidt wrote:

> I'm glad you were able to come up with a solution! So I guess `vim *` goes
> through a different codepath than `:args *`? Note that this also affects the
> quickfix, the location list, and the local args list. Initially I discovered
> this issue with `:cexpr` and reproduced it with `:lexpr` and
> `:args`/`:largs`, but it was easiest to reproduce with `:args *`.
>
> Maybe a dumb question, but why would BufNew be more expensive than BufRead?
> Shouldn't the filetype stuff get run either way? I wouldn't expect BufRead
> to take 500ms and BufNew to take multiple seconds, would you?

Loading syntax, indent and other plugins takes time. No way to avoid that.
The filetype is only detected (and side effects applied) when the buffer is
actually used (loaded), exactly to avoid that overhead.

Even detecting the file type may require loading the file (e.g. for shell
scripts), thus creating the buffer is too early for that.

--
Friends? I have lots of friends! In fact, I have all episodes ever made.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: