Raúl Núñez de Arenas Coronado wrote: > > Saluton Patrick :) > > Patrick Gen-Paul skribis: >> Raúl Núñez de Arenas Coronado wrote: >>> Patrick Gen-Paul skribis: >>>> Currently, I append them to my ~/.vimrc but I guess it would be >>>> preferable to place them in a separate file (or files) and source it >>>> via commands in my vimrc? >>>> >>>> Or, should I create a plugin for each function (or functionally >>>> related functions) and place the code in my ~/.vim/plugin directory? >>> >>> My policy, which may be utterly wrong, is to put them in my ~/.vimrc >>> if the function is generic (that is, not related to any particular >>> filetype), and in some "after" file if it has to do with some >>> particular filetype. Using a plugin for defining some functions is a >>> bit overkill for me and would require much more effort than I'm >>> willing to put ;) >> >> Dunno if it's wrong but it makes excellent sense. > > The problem is that it doesn't scale well. If you write a lot of > *generic* functions, not applicable to any particular filetype, your > best bet is probably to put them in autoload plugins or something along > these lines.
Of course, autoload functions aren't a silver bullet, either. If you have a function that you use every time vim starts (either because it's called by a plugin, or your vimrc, or a statusline, etc), then it's almost certainly slower to put it in an autoload script, even if that's nicer for organization. In those cases, the function still needs to get loaded every startup, so the autoload only changes when the overhead of interpreting it happens. It adds the cost of an extra open(), though, which isn't a cheap operation, even when compared to interpreting the file, and it is even more expensive for those working with NFS or samba mounted home directories. Personally, I tend to put all the functions for my scripts into plugins/ and then, once the scripts become too large, or I notice that a lot of overhead goes into interpreting code that's rarely used, etc, I start pushing things out to autoload functions. I try to keep my vimrc free of functions that aren't directly used by it, though. ~Matt --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
