I am trying to set up a 2-pane writing setup in org-mode (similar to this). I'm using org-tree-to-indirect-buffer, and want to have the following functionality:
1. Opening a specific heading in a 2nd pane: Keeping the cursor is on a heading/ sub-heading and pressing a custom key should open a 2nd pane on the right with just that heading/ subheading in this new (editable) buffer.

Switch back and forth between the main document and the 2nd pane using keyboard shortcuts. (Done using C-x o, or custom shortcut in evil-mode.)

(This is where I'm stuck) Once in the main document (on the left) and at a different heading/subheading, pressing the same key as in #1 should open this new heading in the 2nd pane (and get rid of what was originally on the second pane). Again, this 2nd pane should be editable.

While I'm editing the buffer on the 2nd pane, headings on the main document (on the 1st pane on the left) should stay collapsed.

Problem: Once I have a 2-pane setup, and am in the main document, pressing the assigned key in Step 1 opens a 3rd pane with the new heading/subheading, but the 2nd pane continues to show in the frame.

Additional dream setup:
The 2nd pane should always open in olivetti-mode with a specific window size and font size (that is, the window with the main document (on the left) to occupy about a 25% - 30% of the frame).

For now, I am opening the 2nd pane as mentioned above, manually resizing the window, starting olivetti-mode for this second pane and increasing the font size. When done editing that section of the document, I close that window before starting a new 2nd pane for a different heading, resizing, starting, olivetti-mode, increasing font size... rinse and repeat. It works for now, but does not seem like an elegant solution.

(I'm not a programmer, and have no experience with elisp; most of my setup is cobbled using code snippets from configs shared by other helpful emacs users. I use org-mode primarily for writing prose and use vim's bindings using evil-mode.)

Other options: outline-toc comes close to what I'm trying to do. The package shackle looks like it can do what I'm trying here, but I'm not sure how. On another forum, I was told to try display-buffer-alist, but again, I'm unable to figure out how to use it.

I've tried to follow some ideas from the following sources, but haven't been able to make it work.

Yes, that code snippet by @blujay worked. As I mentioned in the post you (@éric) linked to, the I just needed to 'widen' the org document before using org-narrow-to-element. Took me quite a while to figure this out, but I blame my complete lack of experience with elisp (or any intermediate level of programming) :). But finding that post was felt like this xkcd gem xkcd.com/979
– nb3pt470Jan 19 at 16:02