nyxwulf / treemacs

treemacs layer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Treemacs layer

img/treemacs.png

Table of Contents

Description

This layer brings in Treemacs to replace Neotree as the default file and project explorer:

Features:

An detailed overview over Treemacs’ available features is available in its readme. In a short summary Treemacs offers the following:

  • Simple and powerful navigation and ability to detail exactly how and where a file should be opened
  • Good looking png icons.
  • Display of multiple file trees organized as projects residing in a workpsace.
  • Ability to show tags contained in files. Tags are provided by imenu, so nearly every filetype is supported.
  • Mouse interface for single and double left clicks in line with modern GUI standards. (Clicking on an icon will also display a file’s tags)
  • Locational awareness: commands like find-file or magit-status will use the location of the node at point (with $HOME as fallback)
  • Optionally fontifying files based on their git status.
  • Optionally collapsing single-dir-child directories into one.
  • Doing both asynchronously for an imperceptible performance cost.
  • Optional follow-mode to automatically focus the currently selected file.
  • Optional filewatch-mode to automatically refresh the view after (and only after) changes to the shown filesystem.

Install

To use this layer, add treemacs to the existing dotspacemacs-configuration-layers in your dotspacemacs file.

Configuration

Follow mode

To have treemacs automatically sync with your current buffer set the layer variable treemacs-use-follow-mode to non-nil.

(setq-default dotspacemacs-configuration-layers '(
  (treemacs :variables treemacs-use-follow-mode t)))

Default is t.

File watch

To automatically refresh the Treemacs buffer when there is a change in the part of the file system shown by treemacs set the layer variable treemacs-use-filewatch-mode to non-nil.

(setq-default dotspacemacs-configuration-layers '(
  (treemacs :variables treemacs-use-filewatch-mode t)))

Default is t.

Collapsed directories

This feature requires python to be installed.

Treemacs tries to collapse empty directory names into one name. It is possible to control how deep Treemacs will search for empty directories by settings the layer variable treemacs-use-collapsed-directories to a positive number.

(setq-default dotspacemacs-configuration-layers '(
  (treemacs :variables treemacs-use-collapsed-directories 3)))

Default is 3 (or 0 when python is not installed).

Locking width

To have the width of the treemacs window locked by default, meaning not manually resizable, set the variable treemacs-lock-width to non-nil. It will still be resizable through Treemacs commands and keybindings.

(setq-default dotspacemacs-configuration-layers '(
  (treemacs :variables treemacs-lock-width t)))

Default is nil.

Key Bindings

Global

Key BindingDescription
M-0Selected the treemacs window. Actually selects window #10, which is always assigned to treemacs.
SPC 0Open treemacs in the current directory. When not visiting a file use $HOME as fallback. With a prefix arg manually select the root instead.
SPC f BFind and select a bookmark. If it cannot be found rebuild view with the bookmark’s location as root. Also open the bookmark with a prefix arg.
SPC f tHide/show existing treemacs buffer. Create one for the current directory if no buffer exists.
SPC f TManually focus the treemacs view on the currently selected file. Not needed when treemacs-follow-mode is enabled.
SPC f M-tManually focus the treemacs view on the currently selected file and tag.

Inside Treemacs

Treemacs will use either j/k or n/p to go to the next/previous line, depending on whether vim/hybrid editing style is used. Likewise refresh is only bound to g when emacs editing style is used, since under vim g is a prefix for many other commands.

Key BindingDescription
?Summon the helpful hydra to show you the treemacs keymap.
M-j/M-nSelect next node at the same depth as currently selected node, if possible.
j/nGoto next line.
k/pGoto previous line.
M-J/NGo to the next line in next-window.
M-K/PGo to the previous line in next-window..
M-j/M-nSelect next node at the same depth as currently selected node, if possible.
M-k/M-pSelect previous node at the same depth as currently selected node, if possible.
C-p aSelect a new project to add to the treemacs workspace.
C-p pSelect a projectile project to add to the workspace.
C-p dRemove project at point from the workspace.
C-p rRename project at point.
thToggle the hiding and displaying of dotfiles.
twToggle whether the treemacs buffer should have a fixed width.
tfToggle treemacs-follow-mode.
tatreemacs-filewatch-mode.
wSet a new value for the width of the treemacs window.
TABDo what I mean (as defined in treemacs-TAB-actions-config). Prefers expanding nodes by default.
RETDo what I mean (as defined in treemacs-RET-actions-config). Prefers visiting nodes by default.
mouse1Move point to clicked line
2x mouse1Do what I mean (as defined in treemacs-doubleclick-actions-config). Behavious like RET by default.
g/r/grRefresh and rebuild the treemacs buffer.
dDelete node at point. A delete action must always be confirmed. Directories are deleted recursively.
cfCreate a file.
cdCreate a directory.
RRename the currently selected node. Reload buffers visiting renamed files or files in renamed direcotries.
uSelect parent of selected node, if possible.
qHide/show an existing treemacs buffer.
QKill the treemacs buffer.
ovOpen current file or tag by vertically splitting next-window.
ohOpen current file or tag by horizontally splitting next-window.
ooOpen current file or tag, performing no split and using next-window directly.
oaaOpen current file or tag, using ace-window to decide which window to open the file in.
oahOpen current file or tag by horizontally splitting a window selected by ace-window.
oavOpen current file or tag by vertically splitting a window selected by ace-window.
oxOpen current file according to its mime type in an external application. Linux, Windows and Mac are supported.
taToggle treemacs-filewatch-mode.
tfToggle treemacs-follow-mode.
thToggle the hiding and displaying of dotfiles.
twToggle whether the treemacs buffer should have a fixed width.
yrCopy the absolute path of the nearest project node at point.
yyCopy the absolute path of the node at point.

About

treemacs layer


Languages

Language:Emacs Lisp 100.0%