1

I'm using Doom Emacs with treemacs inside it.

When I look through each source file from side tree, I need to press Enter to open the file.

How to view the file content without Enter but just move the cursor in the tree menu?

enter image description here

1 Answers1

1

Press P on the treemacs sidebpar.

Once you do that, as and when you move the cursor on the sidebar the displayed file will change.


treemacs-peek-mode is an autoloaded interactive Lisp function in treemacs-peek-mode.el.


(treemacs-peek-mode &optional `ARG`)

Minor mode that allows you to peek at buffers before deciding to open them.

While the mode is active treemacs will automatically display the file at point, without leaving the treemacs window.

Peeking will stop when you leave the treemacs window, be it through a command like treemacs-RET-action or some other window selection change.

Files` buffers that have been opened for peeking will be cleaned up if they did not exist before peeking started.

The peeked window can be scrolled using treemacs-next/previous-line-other-window and treemacs-next/previous-page-other-window

This is a global minor mode. If called interactively, toggle the Treemacs-Peek mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value 'treemacs-peek-mode).

The mode`s hook is called both when the mode is enabled and when it is disabled.

treemacs-peek-mode is a variable defined in treemacs-autoloads.el.

Its value is nil

Non-nil if Treemacs-Peek mode is enabled. See the treemacs-peek-mode command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node Easy Customization) or call the function treemacs-peek-mode.

You can customize this variable.