At work I'm forced to work on custom mapping-files which map relations between objects of different systems.
These mappings, which are basically Jinja templates, are unfortunately stored in single lines, so that a simple mapping like (just made that up for illustration purposes):
{% for color in colors %}
{% if color == 'white' or color == 'blue' or color == 'magenta' %}
FF
{% endif %}
{% endfor %}
Would be stored in the CSV, together with some additional attributes, like this:
Name,SomeFlag,Mapping
Mapping_Blue,TRUE,`{% for color in colors %}{% if color == 'white' or color == 'blue' or color == 'magenta' %}FF{% endif %}{% endfor %}`
As you can imagine, this is a pain to work with during day to day editing, for reviews, etc. In practice I typically find myself substituting }
with line breaks and then do the indentation manually.
I wonder if there's a way to do this in vim, so that I could view the described CSV in a format similar to this:
Name,SomeFlag,Mapping Mapping_Blue,TRUE,` {% for color in colors %} {% if color == 'white' or color == 'blue' or color == 'magenta' %} FF {% endif %} {% endfor %}`
Ideally, it would also collapse it back into one line when saving the file. Is there a way to achieve this? I'm using vim, but switching to neovim would be possible.
Best, Phil