[..]
/core/autoload/plugins/buffer/utility.vim
[..]
A typical plugin looks like this:
the default.ask = 1 settings will cause another function to be added
automatically setting the default value. A similar setting is
listMax = 20 on the image..
=========== snip
let s:file = expand('<sfile>')
function! plugins#buffer#utility#PluginCreateDirOnBufWrite()
let d = {
\ 'Tags': ['buffer','demo'],
\ 'Info': 'create directories before writing files',
\ }
function! d.Load()
" can't use self here :-(
exec "autocmd BufWritePre * call tofl#plugin_management#Plugin(".string(self['pluginName']).").CreateDir()"
endfunction
function! d.CreateDir()
let dir = expand('%:h')
let cfg = config#Get(self.pluginName, {'default' : {}})
if !isdirectory(dir) && dir != ""
if (get(cfg, 'ask', 1))
echo "create dir ".dir." ? [y/n]"
if getchar() != char2nr('y')
return
endif
endif
call mkdir(dir, 'p')
endif
endfunction
let d['defaults'] = { 'ask' : 1 }
return d
endfunction
=========== snip
Still much can be improved. For examples the plugins itself can't tell
the framework that they should be loaded before other plugins yet.
If you want to try it I highly recommend the PluginVL_RepoStuff and
PluginOnThingHandler. They will give you a gf mapping which will take
you to the definition of a function. You also should have completion
support for vim script files then. Also there is an experimental
:FixPrefixesOfAutoloadFunctions which can help you a lot when moving
files and functions aroun within the autload directory. Sometimes it
gets things wrong so make a copy :)
The PluginGlobOpen defines a mapping <m-g><m-o> letting you enter a glob
expression showing a list of all matches. I've been using that for over
a year. I think it's one of the fastest way opening files within a
project you know the name of.. (Don't do it within huge directories such
as / though :)
Enjoy, give feedback!
Thanks Marc