reddit / emacs

How to get this window configurations with treemacs?

maxle0312 · 2022-07-26 09:48
I would like to get a layout like this: ​ https://preview.redd.it/5z2towldvvd91.png?width=1920&format=png&auto=webp&s=5c6c79c3b9acc673bd9bf602362925b5e286b184 So treemacs will be made to be splittable, and below that I have a buffer for PDF (using pdf-tools). On the side, I will have a main window to view code and on its right will be a shell window (eshell, shell, term..etc). I managed to get this: ​ https://preview.redd.it/xa3str8rvvd91.png?width=1920&format=png&auto=webp&s=26405ddbf877251b8b2a3e4b618764c35e6d69bf So far so good, but then when I tried to open a new file from treemacs (pressing Enter on file name): ​ ​ https://preview.redd.it/myvqlx4yvvd91.png?width=1920&format=png&auto=webp&s=e0018edbb9c87ff5db67cbd543eb363db98d9d31 ​ Treemacs open the new file in the window where my PDF was. Every subsequent files open in the same wayt, i.e. takes up the window for my PDF. I would like it to use the main code window (window in the middle). Is there a way to do this? Thanks for any input.
[deleted] · 2022-07-26 12:37
I'm not sure if it is possible. Have you tried it using one of the configuration variables (see the github-page), for example `treemacs-default-visit-action` ? Maybe you find some help in [closed or open issues](https://github.com/Alexander-Miller/treemacs/issues).
maxle0312 · 2022-07-26 12:46
Hey thanks for the tip. I customized the default visit action for RET key, i.e. the variable treemacs-RET-action-config. Here, for both file node open and file node close, I set them to "visit with Ace window". Then, when I press RET in treemacs, it shows a tiny number on each of my other windows. I just press the according number and voila. Indeed, it is 1 more key stroke but it works.
[deleted] · 2022-07-26 12:50
Nice. And thank you for sharing your solution.
tmting · 2022-07-26 13:55
Really cool solution. I wonder if it would be possible to create a function using ace-window that always chooses the same window? So that you don't have to key stroke a number every time. That is, if that's useful to you of course
driden87 · 2022-09-26 18:43
Hey thanks for replying with your solution. I'm interested in something like that but I'm an emacs newb, would you mind sharing the code snippet ?