If I'm not mistaken, NerdTree and Fern are for viewing directories, not for editing general trees (Ordered trees of strings in CS terms)
If so, is there a way to edit general trees in Vim? (It should preserve the order of the leaves/branches instead of sorting them)
I don't care about the file format, so long as Vim shows it as a tree, similar to how NerdTree does it
but I want to edit this tree and the order of the nodes should be preserved.
The functionality I would expect from a tree editor:
- expand node
- collapse node
- expand node recursively
- collapse node recursively
- delete node and its subnodes
- copy/paste node and its subnodes
- move a node and its subnodes
- promote/demote a node and all its subnodes
All these operations are easy in a tree editor (1 or 2 keystrokes, no counting lines or selecting text).
Most important, a tree editor reads a tree and saves a tree. It does not allow it to turn into a non-tree at any time (I do not believe "vim outliners" fulfill this requirement, but I'd be happy to be corrected, if I'm wrong)
:set foldmethod=indent
and some key mappings gets you most of the way there.