Add config module

Issue #4 new
repo owner created an issue

This module should search runtimepath for configuration files under {{{{rtp}/config/{_cfgdir}/{requested_config_file}}}}.

Comments (3)

  1. ZyX_I reporter

    It should also be able to list all files that can be found for completion purposes. Maybe this listing should even go as FWC function.

  2. ZyX_I reporter

    It should also use some sort of caching (finally add @/cache module or @/decorators/cache?) and getftime() that works on directories as well as on files.

  3. ZyX_I reporter

    Proposed API:

    let s:_cfgdir='directory' " Search configuration inside {rtp}/config/directory.
                              " Defaults to the second component of plugin ID.
                              " Unlike s:_oprefix this component goes unmodified.
    let s:_config={'loader': s:F.lines_to_value,
                  \'ext': 'json',
                  \'subdir': 'subdir',}

    When called as s:_f.config.load({request}) module tries to load plugins from {rtp}/config/directory/subdir/{request}.json. It is assumed that one plugin file needs only one type of configuration file. Defaults: no extension (use zero to specify this explicitely), id loader (returns list of lines) and last component of plugin ID as subdir or zero (i.e. no subdirectory) if it is equivalent to the cfgdir (to the second component of plugin ID by default).

    To list: s:_f.config.list().

  4. Log in to comment