From: Bram Moolenaar Date: Thu, 9 Nov 2017 18:45:48 +0000 (+0100) Subject: patch 8.0.1279: initializing menus can be slow X-Git-Tag: v8.0.1279 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=040c1feb212568cf04265e59b26182f8b76057aa;p=vim patch 8.0.1279: initializing menus can be slow Problem: Initializing menus can be slow, especially when there are many keymaps, color schemes, etc. Solution: Do the globbing for runtime files lazlily. (Ken Takata) --- diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 62276d6f7..e6902a2cd 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -1,4 +1,4 @@ -*gui.txt* For Vim version 8.0. Last change: 2017 Sep 23 +*gui.txt* For Vim version 8.0. Last change: 2017 Nov 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -499,6 +499,17 @@ in the menu (which can take a bit of time to load). If you want to have all filetypes already present at startup, add: > :let do_syntax_sel_menu = 1 +The following menuitems show all available color schemes, keymaps and compiler +settings: + Edit > Color Scheme ~ + Edit > Keymap ~ + Tools > Set Compiler ~ +However, they can also take a bit of time to load, because they search all +related files from the directories in 'runtimepath'. Therefore they are +loaded lazily (by the |CursorHold| event), or you can also load them manually. +If you want to have all these items already present at startup, add: > + :let do_no_lazyload_menus = 1 + Note that the menu.vim is sourced when `:syntax on` or `:filetype on` is executed or after your .vimrc file is sourced. This means that the 'encoding' option and the language of messages (`:language messages`) must be set before diff --git a/runtime/menu.vim b/runtime/menu.vim index 87ac937a1..0c9b743f6 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar -" Last Change: 2017 Mar 04 +" Last Change: 2017 Nov 09 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -159,7 +159,7 @@ nnoremenu 20.370 &Edit.Put\ &Before[p [p inoremenu &Edit.Put\ &Before[p [p nnoremenu 20.380 &Edit.Put\ &After]p ]p inoremenu &Edit.Put\ &After]p ]p -if has("win32") || has("win16") +if has("win32") vnoremenu 20.390 &Edit.&Deletex x endif noremenu