Sunday, July 16, 2023

Re: Improving vim startuptime

On Sun, Jul 16, 2023 at 10:55:04AM -0700, Gary Johnson wrote:
> It depends, of course, on why it is slow. You can start vim with
> the --startuptime option to get a better idea of where the slowdown
> is. See ":help --startuptime".
>
> For example, starting vim on my Cygwin system was really slow
> because I wrote my vimrc and some plugins as I would for Unix, where
> running external programs is really fast. I re-wrote those to make
> less use of external programs.
>
> As another example, starting vim on a remote Linux machine via ssh
> and X from a local Linux machine can be slow if the connection is
> slow because vim communicates with the X server and the terminal on
> the local machine. I don't know what to do in that case other than
> be patient or start vim with -X and forgo some of the features of X.
`startuptime` surprisingly shows me a mere 656ms, while hyperfine shows
me 2.7s. I am not sure how this discrepancy is arising. Here is the full
log. https://pastebin.mozilla.org/uTrJ7i8N

I see 234ms (out of those 656ms, ~35%) due to VimEnter autocommands. My
autocommands are just scattered throughout vimrc. Most of them are like:

au FileType <list> [mappings|calls]

Maybe there is a way to organize them better?

And there are a ton of plugins too. Is there any way to only source them
conditionally?

I can also try removing some of the old plugins. I haven't done a
cleanup in a while.

--
Manas

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e7jxfvixkmqzzqqbnjxsmfiiedgf5ctokpvgcantmrhh5vyttl%40o3wmiw3g3wqh.

No comments:

Post a Comment