Mercurial > vim
diff runtime/doc/usr_41.txt @ 2325:f177a6431514 vim73
Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 17 Jul 2010 15:20:30 +0200 |
parents | 6f63294a1781 |
children | 12b829477c60 |
line wrap: on
line diff
--- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1711,15 +1711,23 @@ system administrator has dropped it in t user has his own plugin he wants to use. Then the user must have a chance to disable loading this specific plugin. This will make it possible: > - 6 if exists("loaded_typecorr") + 6 if exists("g:loaded_typecorr") 7 finish 8 endif - 9 let loaded_typecorr = 1 + 9 let g:loaded_typecorr = 1 This also avoids that when the script is loaded twice it would cause error messages for redefining functions and cause trouble for autocommands that are added twice. +The name is recommended to start with "loaded_" and then the file name of the +plugin, literally. The "g:" is prepended just to avoid mistakes when using +the variable in a function (without "g:" it would be a variable local to the +function). + +Using "finish" stops Vim from reading the rest of the file, it's much quicker +than using if-endif around the whole file. + MAPPING @@ -1896,10 +1904,10 @@ Here is the resulting complete example: 3 " Maintainer: Bram Moolenaar <Bram@vim.org> 4 " License: This file is placed in the public domain. 5 - 6 if exists("loaded_typecorr") + 6 if exists("g:loaded_typecorr") 7 finish 8 endif - 9 let loaded_typecorr = 1 + 9 let g:loaded_typecorr = 1 10 11 let s:save_cpo = &cpo 12 set cpo&vim