tataku.vim define protocol between collector-processor, processor-processor, processor-emitter.
This plugin make easily to create plugin like call web API.
This plugin needs:
tataku.vim has some recipes define by user.
Recipe must have three parts.
-
CollectorCollectorcollect strings from some resources. -
ProcessorProcessorprocess strings and pass strings to next processor. -
EmitterEmitteroutput strings to some resources.
Recipe must be below format:
{
\ "collector": { "name": string, "options": dict, },
\ "processor": { "name": string, "options": dict, }[],
\ "emitter": { "name": string, "options": dict, },
\ }"Collector" and "Emitter" can be specified only one module. But "Processor" can be specified multiply.
Each module have two keys.
-
name
The module name. If you use
tataku-collector-current_line, specifycurrent_line. -
options
The options for the module.
-
tataku#call_recipe(recipe_name)Call recipe which registered in g:tataku_recipes.
-
tataku#call_oneshot(recipe)Call with recipe object. Convenient to call tataku with a dynamic recipe.
-
g:tataku_recipesThe recipe book. Default:
{} -
g:tataku_enable_operatorEnable operator mappings starts with
<Plug>(operator-tataku-. For details: tataku-operator Default:v:false
If set v:true to g:tataku_enable_operator, The operator mappings will be
enable.
The mappings starts with <Plug>(operator-tataku-.
If you registered foo and bar into g:tataku_recipes,
<Plug>(operator-tataku-foo) and <Plug>(operator-tataku-bar) will be enabled.
NOTE: If call recipe via operator, collector module is ignored and use
motion/textobj instead of its.
This section explain how to create module.
When call recipe, tataku.vim import module from
denops/@tataku/<module-type>/<module-name>.ts within &runtimepath.
The module must export function as default. The function must return corresponding stream:
- Collector:
ReadableStream<string[]> - Processor:
TransformStream<string[]> - Emitter:
WritableStream<string[]>