1 Star 0 Fork 0

Aggron/treemacs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
Loading...
README
GPL-3.0

https://badges.gitter.im/Alexander-Miller/treemacs.png https://melpa.org/packages/treemacs-badge.svg https://stable.melpa.org/packages/treemacs-badge.svg https://travis-ci.org/Alexander-Miller/treemacs.svg?branch=master https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg

Treemacs - a tree layout file explorer for Emacs

screenshots/screenshot.png

Content

Quick Feature Overview

Treemacs is a file and project explorer similar to NeoTree or vim’s NerdTree, but largely inspired by the Project Explorer in Eclipse. It shows the file system outlines of your projects in a simple tree layout allowing quick navigation and exploration, while also possessing basic file management utilities. Specifically a quick feature overview looks as follows:

Project management
Treemacs lets you view multiple file trees - projects - at once and quickly add or remove them, and groups projects in workspaces.
Easy navigation
quickly move between projects or use shortcuts to jump to parent or neighbouring nodes.
Versatile file access
decide exactly how and where a file will be opened, including using ace-window to choose a window or launching an external application.
Understanding of frames
every frame will receive its own treemacs buffer that will live and die with that frame.
Finding of files and tags
Treemacs can follow along and keep in focus the currently selected file or even the tag at point using, either manually or automatically using either treemacs-follow-mode or treemacs-tag-follow-mode.
Git Integration
Treemacs can use different faces for files and directories based on their git status. The git process is run asynchronously, minimizing its performance impact.
Winum & ace-window compatibility
The presence of treemacs will not interfere with winum’s and ace-window’s usual layouts.
Projectile integration
the treemacs-projectile package lets you quickly add your projectile projects to the treemacs workspace.
Simple mouse interface
Left clicks will work the same as you’re used to from with graphical applications
Session persistence
Treemacs automatically saves and restores your workspaces.
Dashing good looks
Treemacs uses (optionally resizable) png images in HD 22x22 resolution for its icons (quantity is, of course, another matter). When run in a terminal a simple fallback is used.
Tag view
Treemacs can display files’ tags. All file types that Emacs can generate a (semantic) imenu index for are supported.
Visual feedback
When it would otherwise be difficult to see the message in the minibuffer success/failure is indicated with pulse.el.
Theming support
Treemacs supports using multiple icon themes that can be changed at will.
Ease of use
Treemacs offers many configuration options, but comes with a set of (what hopefully should be) sane defaults. Installation aside there are two obligatory pieces of setup: 1) Choosing convenient keybindings to run treemacs and 2) If you use evil: requiring treemacs-evil to integrate treemacs with evil and enable j/k navigation. More on both below. You can also summon a helpful hydra with ? that will remind you of treemacs’ many keybindings and features.
Bookmark integration
Running bookmark-set on a Treemacs item will store a bookmark to Treemacs buffer for that item.

Fancy Gifs!

Various ways to open files: screenshots/open-files.gif

Workspace administration with org-mode: screenshots/workspace-edit.gif

Automatic reaction to changes in the file system: screenshots/filewatch.gif

Automatic reaction to changes in git: screenshots/git.gif

Full-featured mouse interface: screenshots/mouse-interface.gif

Resizable icons: screenshots/icon-resize.gif

Quick Start

If you don’t care about reading the full readme here’s a list of some bare bones basics to get you started:

  • First of all: press ? to summon the helpful hydra: screenshots/hydra.png
  • If you use evil don’t forget to also install treemacs-evil
  • If you use projectile you can install treemacs-projectile to allow quickly add your projectile projects to treemacs.
  • Treemacs doesn’t bind any global keys, you need to use whatever fits you best. A full install setup can be found below. Otherwise just add a keybind for treemacs.
  • For navigation use n/p (j/k when evil), M-n/M-p to move to same-height neighbour u to go to parent, and C-n/C-k to move between projects.
  • There’s half a dozen different ways to open nodes, all bound under o as prefix. Pick your favourite.
  • TAB and RET are particularly configurable. See treemacs-TAB/RET-actions-config.
  • Projects administration is bound under the C-c C-p prefix.

Detailed Feature List

Projects and Workspaces

If you’ve previously used a different explorer like NeoTree or NerdTree - or an earlier version of treemacs for that matter - you are probably used to a display system wherein you see exactly a single file tree whose exact root you can arbitrarily change. This system makes it difficult to work on and switch between multiple projects. Treemacs used to (and still does) remedy that limitation by making every treemacs buffer unique to its frame, but it has now been redesigned to be able to display multiple file trees - projects - at once.

In treemacs a workspace is simply a (named) collection of projects, while a project mostly consists of 2 things: its location in the file system and its name. This is the info that you need to provide when you want to add a new project to your workspace. Just like projects you can add, remove, rename and switch between workspaces at any time.

This design approach has various advantages and disadvantages. It is now no longer possible to “free roam” in the file system with treemacs, i.e. you can no longer arbitrarily switch the single file tree’s root to the directory at point or the current root’s parent. Another restriction is that the same part of the file system may not appear more than once as part of the workspace. For example it is not possible to have both /Documents and /Documents/ProjectX as projects in the same workspace, since internally treemacs heavily relies on every node having a unique natural key in its absolute path. Nonetheless the pros certainly outweigh the cons, as a multiroot setup allows to work on multiple projects with any combination concern/buffer separating frameworks, be it persp/perspective, eyebrowse, or projectile. It also opens the potential for concurrent display not only of the file system, but e.g. the currently open buffers.

Workspace Selection

When a workspace is first needed, treemacs will select a workspace in the following manner:

If the current buffer is editing a file then treemacs will try to find the first workspace with a project containing that file. If that fails treemacs will resort to using the fallback workspace which is defined as simply the first element in the list of all workspace.

The order of workspaces is the same that you see when calling treemacs-edit-workspaces (see next chapter). You can interactively set the fall backback workspace by calling treemacs-set-fallback-workspace.

This selection will happen when treemacs is first started (with a command like treemacs-select-window) or when a function that requires the current workspace to be known is used (like adding or removing a project).

Conveniently Editing Your Projects and Workspaces

There are two ways to edit your projects and workspaces: call up single add/remove/rename/switch commands under either the C-c C-p or C-c C-w prefix, or call treemacs-edit-workspaces and edit your entire layout in the form of a single org-mode buffer.

The used org-format is quite simple: level 1 headlines are names of workspaces, level 2 headlines are names of projects in a workspace, and every project’s path is given as a description list, starting with a - (and an optional leading space). Empty lines and lines starting with # are ignored, and everything else leads to an error.

You needn’t worry about making mistakes either. If there’s something wrong when you call treemacs-finish-edit (C-c C-c) then treemacs will point you at the incorrect line and tell you what’s missing:

screenshots/workspace-edit.png

(Note that the list with the path property allows an indentation of 0 or 1 spaces only. The much greater visible indentation is caused by org-indent-mode)

Navigation without Projects and Workspaces

If a strict workspace and project structure, as described above, is too stringent for your use-case you can, under certain circumstances, use treemacs to freely navigate through your your file system, similar to dired: When your workspace contains exactly a single project you can use h and l (or treemacs-root-up and treemacs-root-down) to arbitrarily change the single project’s root. h will navigate one level upward in the file system, l will move into the directory at point.

You can also use treemacs-display-current-project-exclusively to switch to the current project (deleting any others that might be present).

Frame Locality

Treemacs buffers have a limited scope they are visible in: the frames they are created in. A treemacs buffer, once created, lives alongside and inside its frame, and is also destroyed with that frame. Calling treemacs while inside a new frame will create a new buffer for it, regardless how many other treemacs buffers already exist. While there can be multiple unique treemacs buffer they will all still show the same workspace and the same projects.

A treemacs buffer that does not belong to a frame may still be made visible by manually selecting in the buffer list. This would break various assumptions in treemacs’ code base and effectively falls under undefined behaviour - a bad idea all around.

Mouse Interface

Treemacs handles left clicks in much the same way as modern graphical applications do: a single click sets the focus, a double click expands or collapses a directory or tag section node and visits a file/moves to a tag for a file/tag node.

Additionally tag sections can be expanded or collapsed by a single click on the file/tag section icon.

If you prefer to expand/collpase nodes with a single mouse click you can also use treemacs-single-click-expand-action:

(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action)

A right click popup-menu is also available:

screenshots/right-click.png

You can also open a file in a specific window by dragging using left click from treemacs to the required window.

Follow-mode

treemacs-follow-mode is a global minor mode which allows the treemacs view to always move its focus to the currently selected file. This mode runs on an idle timer - the exact duration of inactivity (in seconds) before a move is called is determined by treemacs-tag-follow-delay.

Tag-follow-mode

treemacs-tag-follow-mode is a global minor mode which extends and effectively replaces treemacs-follow-mode. When activated it follows not just the current file, but also the current tag. This works alongside treemacs’ integration with imenu, so all file types providing an imenu implementation are compatible.

This mode, like follow-mode, runs on an idle timer - the exact duration of inactivity (in seconds) before a move is called is determined by treemacs-tag-follow-delay.

Note that in order to move to a tag in treemacs the treemacs buffer’s window needs to be temporarily selected, which will reset blink-cursor-mode’s timer if it is enabled. This will result in the cursor blinking seemingly pausing for a short time and giving the appearance of the tag follow action lasting much longer than it really does.

Fringe-indicator-mode

treemacs-fringe-indicator-mode is a global minor mode that displays a little icon in the fringe that moves with the cursor. It can make the selected line more visible if hl-line-mode doesn’t stand out with your theme.

Git-mode

treemacs-git-mode is a global minor mode which enables treemacs to check for files’ and directories’ git status information and highlight them accordingly (see also the treemacs-git-... faces). The mode is available in 3 variants: simple, extended and deferred:

  • The simple variant starts a git status process and parses its output in elisp. The parsing is kept quick and simple, so some info is missed: this version includes git status information only for files, but not directories.
  • The extended variant highlights both files and directories. This greatly increases the complexity and length of the parsing process, and is therefore done in an asynchronous python process for the sake of performance. The extended variant requires python3 to work.
  • The deferred variant is the same as extended, except the tasks of rendering nodes and highlighting them are separated. The former happens immediately, the latter after treemacs-deferred-git-apply-delay seconds of idle time. This may be faster (if not in truth then at least in appereance) as the git process is given a much greater amount of time to finish. The downside is that the effect of nodes changing their colors may be somewhat jarring, though this effect is largely mitigated due to the use of a caching layer.

When called interactively treemacs-git-mode will ask for the variant to use. In lisp code an appropriate symbol can be directly passed to the minor mode function:

(treemacs-git-mode 'deferred)

All versions use an asynchronous git process and are optimized to not do more work than necessary, so their performance cost should, for the most part, be the constant amount of time it takes to fork a subprocess. For repositories where this is not the case treemacs-max-git-entries (default value 5000) will limit the number of git status entries treemacs will process before ignoring the rest.

Filewatch-mode

treemacs-filewatch-mode is a global minor mode which enables treemacs to watch the files it is displaying for changes and automatically refresh itself when it detects a change in the file system that it decides is relevant.

A change event is relevant for treemacs if a new file has been created or deleted or a file has been changed and treemacs-git-mode is enabled. Events caused by files that are ignored as per treemacs-ignored-file-predicates are likewise counted as not relevant.

The refresh is not called immediately after an event was received, treemacs instead waits treemacs-file-event-delay ms to see if any more files have changed to avoid having to refresh multiple times over a short period of time. Treemacs will not refresh the entire view to make the detected changes visible, but will instead only make updates to the directories where the change(s) happened. Using this mode is therefore by far not as expensive as a full refresh on every change and save.

The mode only applies to directories opened after this mode has been activated. This means that to enable file watching in an already existing treemacs buffer it needs to be killed and rebuilt. Turning off this mode is, on the other hand, instantaneous - it will immediately turn off all existing file watch processes and outstanding refresh actions.

Known limitations: Staging and committing changes does not produce any file change events of its own, if you use treemacs-git-mode you still need to do a manual refresh to see your files’ faces go from ‘changed’ and ‘untracked’ to ‘unchanged’ after a commit.

Session Persistence

Treemacs’ sessions - your workspace and the projects it contains - are saved when Emacs shuts down and restored when treemacs is first loaded. This persistence process is fully automatic and independant, and should therefore be fully compatible with desktop-save-mode.

The persisted state is saved under user-emacs-directory/.cache/treemacs-persist by default. The exact file location is saved in the variable treemacs-persist-file.

If something goes wrong when loading the file the erroneous state will be saved in treemacs-last-error-persist-file for debugging.

Terminal Compatibility

When run in a terminal treemacs will fall back to a much simpler rendering system, foregoing its usual png icons and using simple + and - characters instead. The exact characters used are highly customizable.

Tag View

Treemacs is able to display not only the file system, but also tags found in individual files. The tags list is sourced using emacs’ builtin imenu functionality, so all file types that emacs can generate an imenu index for are supported.

Imenu caches its result, so to avoid stale tag lists setting imenu-auto-rescan to t is recommended. Tags generated with the help of semantic-mode are likewise supported.

ggtags

Treemacs can show the tags produced by ggtags if you switch a buffer’s imenu index function to use ggtags:

(setq-local imenu-create-index-function #'ggtags-build-imenu-index)

Current-Directory Awareness

Treemacs always sets the default-directory variable based on the (nearest) path at the current node, falling back to your home directory when there is no node or path at point. That means that various commands like find-file, magit-status or helm-projectile-ag will correctly act based on the current directory or project context.

Tramp Support

Treemacs supports projects on remote directories, e.g. /scp:remote-server:path/to/directory.

However tramp support has some restrictions: treemacs-use-collapsed-directories has no effect on remote directories.

Org Support

Treemacs supports storing links to its file nodes by means of org-store-link.

Theme Support

Using a different treemacs theme works the same way as using a different Emacs theme: just call treemacs-load-theme, either programmatically or interactively. In the former case you need to supply the name of the theme as a string, like this:

(treemacs-load-theme "Default")

Do keep in mind that by default treemacs’ theme support is all theory: the standard installation includes only the default theme; this feature is meant to easily allow others to extend, create and distribute themes for treemacs.

A detailed explanation on modifying themes and icons can be found in the Configuration section.

Additional Packages

Next to treemacs itself you can optionally install:

treemacs-evil

Must be installed and loaded if you use evil. The keybindings and the cursor will not be setup properly otherwise. It’ll also enable navigation with j/k instead of n/p.

treemacs-projectile

Allows to quickly add your projectile projects to the treemacs workspace.

treemacs-magit

A small utility package to fill the small gaps left by using filewatch-mode and git-mode in conjunction with magit: it will inform treemacs about (un)staging of files and commits happening in magit.

treemacs-icons-dired

Allows you to use treemacs icons in dired buffers with treemacs-icons-dired-mode: screenshots/dired-icons.png

treemacs-persp/treemacs-perspective

Integration with persp-mode or perspective.el that allows treemacs buffers to be unique inside the active perspective instead of the default frame-based buffer scope.

treemacs-all-the-icons

Provides a theme using all-the-icons.

Treemacs as a Framework

Treemacs can be extended to display arbitrary nodes as well as be used as a general rendering backend for any tree-like structures. See here for an extended tutorial and demonstration.

Installation

Treemacs is included in Spacemacs (for now only on the dev branch). If you are using the development version of Spacemacs you can simply add treemacs to dotspacemacs-configuration-layers to replace the default NeoTree. Check SPC h SPC treemacs for details. Otherwise you will need to add treemacs to dotspacemacs-additional-packages.

Treemacs is also available on MELPA. If you just want to quickly start using it grab the use-package example below, and customize it as needed (remove treemacs-evil if you don’t use it, customize the keybindings to you taste, etc).

Either way keep in mind that treemacs has no default keybindings for its globally callable initialization functions. Each user is supposed to select keybindings for functions like treemacs-find-file based on whatever they find convenient.

You can find an exhaustive overview of all functions, their keybindings and functions you need to bind yourself below.

The following use-package snippet includes a list of all of treemacs’ configuration variables in their default setting. Setting them all yourself is not necessary, they are only listed here to encourage discoverability.

(use-package treemacs
  :ensure t
  :defer t
  :init
  (with-eval-after-load 'winum
    (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
  :config
  (progn
    (setq treemacs-collapse-dirs                 (if treemacs-python-executable 3 0)
          treemacs-deferred-git-apply-delay      0.5
          treemacs-directory-name-transformer    #'identity
          treemacs-display-in-side-window        t
          treemacs-eldoc-display                 t
          treemacs-file-event-delay              5000
          treemacs-file-extension-regex          treemacs-last-period-regex-value
          treemacs-file-follow-delay             0.2
          treemacs-file-name-transformer         #'identity
          treemacs-follow-after-init             t
          treemacs-git-command-pipe              ""
          treemacs-goto-tag-strategy             'refetch-index
          treemacs-indentation                   2
          treemacs-indentation-string            " "
          treemacs-is-never-other-window         nil
          treemacs-max-git-entries               5000
          treemacs-missing-project-action        'ask
          treemacs-move-forward-on-expand        nil
          treemacs-no-png-images                 nil
          treemacs-no-delete-other-windows       t
          treemacs-project-follow-cleanup        nil
          treemacs-persist-file                  (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
          treemacs-position                      'left
          treemacs-recenter-distance             0.1
          treemacs-recenter-after-file-follow    nil
          treemacs-recenter-after-tag-follow     nil
          treemacs-recenter-after-project-jump   'always
          treemacs-recenter-after-project-expand 'on-distance
          treemacs-show-cursor                   nil
          treemacs-show-hidden-files             t
          treemacs-silent-filewatch              nil
          treemacs-silent-refresh                nil
          treemacs-sorting                       'alphabetic-asc
          treemacs-space-between-root-nodes      t
          treemacs-tag-follow-cleanup            t
          treemacs-tag-follow-delay              1.5
          treemacs-user-mode-line-format         nil
          treemacs-user-header-line-format       nil
          treemacs-width                         35
          treemacs-workspace-switch-cleanup      nil)

    ;; The default width and height of the icons is 22 pixels. If you are
    ;; using a Hi-DPI display, uncomment this to double the icon size.
    ;;(treemacs-resize-icons 44)

    (treemacs-follow-mode t)
    (treemacs-filewatch-mode t)
    (treemacs-fringe-indicator-mode t)
    (pcase (cons (not (null (executable-find "git")))
                 (not (null treemacs-python-executable)))
      (`(t . t)
       (treemacs-git-mode 'deferred))
      (`(t . _)
       (treemacs-git-mode 'simple))))
  :bind
  (:map global-map
        ("M-0"       . treemacs-select-window)
        ("C-x t 1"   . treemacs-delete-other-windows)
        ("C-x t t"   . treemacs)
        ("C-x t B"   . treemacs-bookmark)
        ("C-x t C-t" . treemacs-find-file)
        ("C-x t M-t" . treemacs-find-tag)))

(use-package treemacs-evil
  :after treemacs evil
  :ensure t)

(use-package treemacs-projectile
  :after treemacs projectile
  :ensure t)

(use-package treemacs-icons-dired
  :after treemacs dired
  :ensure t
  :config (treemacs-icons-dired-mode))

(use-package treemacs-magit
  :after treemacs magit
  :ensure t)

(use-package treemacs-persp ;;treemacs-persective if you use perspective.el vs. persp-mode
  :after treemacs persp-mode ;;or perspective vs. persp-mode
  :ensure t
  :config (treemacs-set-scope-type 'Perspectives))

Configuration

Variables

Treemacs offers the following configuration options (describe-variable will usually offers more details):

Variable Default Description
treemacs-indentation 2 The number of times each level is indented in the file tree. If specified as ‘(INTEGER px), indentation will be a single INTEGER pixels wide space.
treemacs-indentation-string ” ” The string that is used to create indentation when treemacs-indentation is not specified as pixels.
treemacs-width 35 Width of the treemacs window.
treemacs-show-hidden-files t Dotfiles will be shown if this is set to t and be hidden otherwise.
treemacs-follow-after-init nil When t follow the currently selected file after initializing the treemacs buffer, regardless of treemacs-follow-mode setting.
treemacs-sorting alphabetic-asc Indicates how treemacs will sort its files and directories. (Files will always be shown after directories.)
treemacs-ignored-file-predicates (treemacs–std-ignore-file-predicate) List of predicates to test for files and directories ignored by Emacs. Ignored files will never be shown in the treemacs buffer.
treemacs-pre-file-insert-predicates nil List of predicates to test for files and directories not to be rendered. Unlike treemacs-ignored-file-predicates these predicates apply when files’ git status information is available.
treemacs-file-event-delay 5000 How long (in milliseconds) to collect file events before refreshing. See also treemacs-filewatch-mode.
treemacs-goto-tag-strategy refetch-index Indicates how to move to a tag when its buffer is dead.
treemacs-default-visit-action treemacs-visit-node-no-split Default action for opening a node (e.g. file, directory, tag). treemacs-visit-file-default action in treemacs-*-actions-config calls this function.
treemacs-RET-actions-config Prefers visiting nodes over closing/opening Alist defining the behaviour of treemacs-RET-action.
treemacs-TAB-actions-config Prefers closing/opening nodes over visiting Alist defining the behaviour of treemacs-TAB-action.
treemacs-doubleclick-actions-config Closes/opens tags and visits files Alist defining the behaviour of treemacs-doubleclick-action.
treemacs-collapse-dirs 0 Collapse this many directories into one, when possible. A directory is collapsible when its content consists of nothing but another directory.
treemacs-silent-refresh nil When non-nil a completed refresh will not be announced with a log message. This applies both to manual refreshing as well as automatic (due to treemacs-filewatch-mode).
treemacs-silent-filewatch nil When non-nil a refresh due to filewatch-mode will cause no log message.
treemacs-is-never-other-window nil Prevents treemacs from being selected with other-window.
treemacs-position left Position of treemacs buffer. Valid values are left, right.
treemacs-tag-follow-delay 1.5 Delay in seconds of inactivity for treemacs-tag-follow-mode to trigger.
treemacs-tag-follow-cleanup t When non-nil treemacs-tag-follow-mode will keep only the current file’s tags visible.
treemacs-project-follow-cleanup nil When non-nil treemacs-follow-mode will keep only the current project expanded and all others closed.
treemacs-no-png-images nil When non-nil treemacs will use TUI string icons even when running in a GUI.
treemacs-python-executable (treemacs–find-python3) Python 3 binary used by treemacs.
treemacs-recenter-after-file-follow nil Decides if and when to call recenter when treemacs-follow-mode moves to a new file.
treemacs-recenter-after-tag-follow nil Decides if and when to call recenter when treemacs-tag-follow-mode moves to a new tag.
treemacs-recenter-after-project-jump ‘always Decides if and when to call recenter when navigating between projects.
treemacs-recenter-after-project-expand ‘on-distance Decides if and when to call recenter when expanding a project node.
treemacs-recenter-distance 0.1 Minimum distance from window top/bottom (0.1 = 10%) before treemacs calls recenter in tag/file-follow-mode.
treemacs-pulse-on-success t When non-nil treemacs will pulse the current line as a success indicator, e.g. when creating a file.
treemacs-pulse-on-failure t When non-nil treemacs will pulse the current line as a failure indicator, e.g. when failing to find a file’s tags.
treemacs-elisp-imenu-expression [too large to list] The imenu expression treemacs uses in elisp buffers.
treemacs-persist-file ~/.emacs.d/.cache/treemacs-persist Path to the file treemacs uses to persist its state.
treemacs-last-error-persist-file ~/.emacs.d/.cache/treemacs-persist-at-last-error Path to the file treemacs uses to persist its state.
treemacs-space-between-root-nodes t When non-nil treemacs will separate root nodes with an empty line.
treemacs-wrap-around t When non-nil treemacs will wrap around at the buffer edges when moving between lines.
treemacs–fringe-indicator-bitmap [vertical bar] The fringe bitmap used by the fringe-indicator minor mode.
treemacs-deferred-git-apply-delay 0.5 Seconds of idle time for git highlighting to apply when using the deferred treemacs-git-mode.
treemacs-file-follow-delay 0.2 Delay in seconds of idle time for treemacs to follow the selected window.
treemacs-display-in-side-window t When non-nil treemacs will use a dedicated side-window.
treemacs-max-git-entries 5000 Maximum number of git status entries treemacs will process. Anything above that number will be ignored.
treemacs-missing-project-action ask When a persisted project is missing from filesystem, ask will prompt for action, keep will keep the project in the project list, and remove will remove it from it without prompt.
treemacs-show-cursor nil When non-nil the cursor will stay visible in the treemacs buffer.
treemacs-git-command-pipe ”” Text to be appended to treemacs’ git command. Useful for filtering with something like grep.
treemacs-no-delete-other-windows t Prevents the treemacs window from being deleted by commands like delete-other-windows and magit-status.
treemacs-eldoc-display t Enables eldoc display of the file path at point. Requires eldoc-mode.
treemacs-bookmark-title-template “Treemacs - project:{label}” When using bookmark-set in Treemacs, the default template for a bookmark label. The following patterns are available: “project,{label}”, “label:N,{label-path}”, “labelpath:N,{file-path}”, “${file-path:N}”.
treemacs-file-extension-regex Text after last period Determines how treemacs detects a file extension. Can be set to use text after first or last period.
treemacs-directory-name-transformer identity Transformer function that is applied to directory names before rendering for any sort of cosmetic effect.
treemacs-file-name-transformer identity Transformer function that is applied to file names before rendering for any sort of cosmetic effect.
treemacs-user-mode-line-format nil When non-nil treemacs will use it as a mode line format (otherwise format provided by spaceline, moody-mode-line and doom-modeline will be used or, finally, “Treemacs” text will be displayed)
treemacs-user-header-line-format nil When non-nil treemacs will use it as a header line format
treemacs-move-forward-on-expand nil When non-nil treemacs will move to the first child of an expanded node.
treemacs-workspace-switch-cleanup nil Indicates which, if any, buffers should be deleted on a workspace switch. Valid values are nil, files, all.

Faces

Treemacs defines and uses the following faces:

Face Based on Description
treemacs-directory-face font-lock-function-name-face Face used for directories.
treemacs-directory-collapsed-face treemacs-directory-face Face used for collapsed part of directories.
treemacs-file-face default Face used for files.
treemacs-root-face font-lock-constant-face Face used for project roots.
treemacs-root-unreadable-face treemacs-root-face Face used for local unreadable project roots.
treemacs-root-remote-face font-lock-function-name-face, treemacs-root-face Face used for readable remote (Tramp) project roots.
treemacs-root-remote-unreadable-face treemacs-root-unreadable-face Face used for unreadable remote (Tramp) project roots.
treemacs-root-remote-disconnected-face warning, treemacs-root-face Face used for disconnected remote (Tramp) project roots.
treemacs-tags-face font-lock-builtin-face Face used for tags.
treemacs-help-title-face font-lock-constant-face Face used for the title of the helpful hydra.
treemacs-help-column-face font-lock-keyword-face Face used for the column headers of the helpful hydra.
treemacs-git-*-face various font lock faces Faces used by treemacs for various git states.
treemacs-term-node-face font-lock-string-face Face for directory node symbols used by treemacs when it runs in a terminal.
treemacs-on-success-pulse-face :fg #111111 :bg #669966 Pulse face used when pulsing on a successful action.
treemacs-on-failure-puse-face :fg #111111 :bg #ab3737 Pulse face used when pulsing on a failed action.

Evil compatibility

To make treemacs get along with evil-mode you need to install and load treemacs-evil. It does not define any functions or offer any configuration options, making sure it is loaded is sufficient.

Customizing Themes and Icons

Creating and Modifying Themes

Creating and modifying themes and icons is all done in a single step using dedicated macros.

To create a theme use treemacs-create-theme. It requires the name of the theme and accepts 3 optional keyword arguments: the directory the theme’s icons are stored in (if it’s using png icons), the name of the theme it’s extending and the config, a final form that’s responsible for creating all the theme’s icons. A config will typically consist of nothing but calls to treemacs-create-icon:

(treemacs-create-theme "Default"
  :icon-directory (f-join treemacs-dir "icons/default")
  :config
  (progn
    (treemacs-create-icon :file "root.png"   :fallback ""            :extensions (root))
    (treemacs-create-icon :file "emacs.png"  :fallback "🗏 "          :extensions ("el" "elc"))
    (treemacs-create-icon :file "readme.png" :fallback "🗏 "          :extensions ("readme.md"))
    (treemacs-create-icon :icon (all-the-icons-icon-for-file "yaml") :extensions ("yml" "yaml"))))

The :file argument is relative to the icon directory of the theme being created. When not using image icons the :icon-directory argument can be omitted and the :file argument can be switched for :icon to supply the icon string directly. The TUI fallback is also optional, ” ” is used by default. Finally the list of extensions determines which file extensions the icon should be used for.

For treemacs an extension is either the entire file name or the text after the last period (unless treemacs-file-extension-regex is customized). This means it can match normal file names like “init.el”, extensionless file names like “Makefile”. Because the full name is checked first it is possible to give special files their own icon, for example “Readme.md” can use a different icon than normal markdown files.

Instead of a string extension a symbol can also be used. In this case treemacs will also create a variable for that icon named treemacs-icon-$symbol. Treemacs uses several such icon variables and any new theme should define their own versions (it it’s not extending the default theme). The following icons are used:

  • root
  • dir-closed
  • dir-open
  • fallback
  • tag-open
  • tag-closed
  • tag-leaf
  • error
  • info
  • warning

Analogous to creating a new theme treemacs-modify-theme can be used to change, or add to, an existing theme:

(treemacs-modify-theme "Default"
  :icon-directory "/other/icons/dir"
  :config
  (progn
    (treemacs-create-icon :icon "+" :extensions (dir-closed))
    (treemacs-create-icon :icon "-" :extensions (dir-open))))

Finally keep in mind that treemacs’ icons are all buffer-local values, and will most likely not be defined when trying to access their values directly. When you need to programmatically access some of treemacs’ icons you should use treemacs-get-icon-value:

(treemacs-get-icon-value 'root nil "Default")
(treemacs-get-icon-value "org" t)

Custom Icons

Treemacs also offers a quick and straighforward way to add a (gui) icon to the currently active theme, without caring for its name or declaring icon directories:

(defvar treemacs-custom-html-icon (all-the-icons-icon-for-file "name.html"))
(treemacs-define-custom-icon treemacs-custom-html-icon "html" "htm")

Important: There is a restriction that all icons must must be exactly 2 characters long. That’s including the space that will separate an icon from the filename.

Icons according to auto-mode-alist

For some file extensions, like “.cc” or “.hh”, it is not immediately obvious which major mode will open these files, and thus which icon they should be assigned. Treemacs offers the option that automate this decision based on auto-mode-alist. You can use the function treemacs-map-icons-with-auto-mode-alist to change the assigned icons for a list of file extensions based on the major mode the icons are mapped to in auto-mode-alist.

treemacs-map-icons-with-auto-mode-alist takes 2 arguments: first a list of file extensions, then an alist that decides which icon should be used for which mapped major mode. For example the code to decide the icons for “.hh” and “.cc” files with auto-mode-alist would look like this:

(treemacs-map-icons-with-auto-mode-alist
 '(".cc" ".hh")
 '((c-mode   . (treemacs-get-icon-value "c"))
   (c++-mode . (treemacs-get-icon-value "cpp"))))

GUI vs TUI

It is possible to force treemacs to use the simple TUI icons in GUI mode by setting treemacs-no-png-images to t.

Resizing Icons

If your emacs has been compiled with Imagemagick support, or you’re using Emacs >= 27.1, you can arbitrarily change the size of treemacs’ icons by (interactively or programmatically) calling treemacs-resize-icons.

all-the-icons indent issues

Depending on your font you may experience the problem of treemacs’ icons seemingly jumping around left and right when they are expanded and collapsed when using the all-the-icons theme. The straighforward solution is to use a different font. You may also try a workaround of using a different font that applies onyl to the TAB characters used to align treemacs’ all-the-icons-based icons. To do that do not load treemacs-all-the-icons with require. Instead use the following alternative provided by treemacs itself:

(treemacs-load-all-the-icons-with-workaround-font "Hermit")

The Hermit font used here is just an example - you will need to pick a font that is available on your system and does not suffer from the tab width issue.

This line will load treemacs-all-the-icons (it must not have been loaded previously) and enable the all-the-icons theme. The given font argument will be used as the font for the alignment tabs used for the icons, hopefully alleviating the indentation problem. In addition treemacs-indentation and treemacs-indentation-string will be set to 1 and a (font-changed) TAB character respectively, so customizing them is (probably) not possible.

Indent guide

Not really part of the icons, but a useful visual feature nonetheless: An indent guide like effect can be created by selecting appropriate values for treemacs-indentation and treemacs-indentation-string:

(setq treemacs-indentation-string (propertize " ⫶ " 'face 'font-lock-comment-face)
      treemacs-indentation 1)

Keymap

Unbound functions

These functions are not bound to any keys by default. It’s left up to users to find the most convenient key binds.

Action Description
treemacs Show/Hide/Initialize treemacs.
treemacs-bookmark Find a bookmark in treemacs.
treemacs-find-file Find and focus the current file in treemacs.
treemacs-find-tag Find and focus the current tag in treemacs.
treemacs-select-window Select the treemacs window if it is visible. Call treemacs if it is not.
treemacs-delete-other-windows Same as delete-other-windows, but will not delete the treemacs window.
treemacs-show-changelog Opens a buffer showing the changelog.
treemacs-load-theme Load a different icon theme.
treemacs-icon-catalogue Showcases all themes and their icons.
treemacs-projectile Add a project from projectile to treemacs.
treemacs-add-and-display-current-project Add current project to treemacs and open it.
treemacs-display-current-project-exclusively Add current project to treemacs and open it, deleting all others.
treemacs-select-scope-type Select the scope of treemacs buffers in which they are unique

Default keymaps

Treemacs’ keybindings are distributed to several keymaps, based on common keybindings:

Project Keybinds (Prefix C-c C-p)

Key Action Description
C-c C-p a treemacs-add-project-to-workspace Select a new project to add to the treemacs workspace.
C-c C-p p treemacs-projectile Select a projectile project to add to the workspace.
C-c C-p d treemacs-remove-project-from-workspace Remove project at point from the workspace.
C-c C-p r treemacs-rename-project Rename project at point.
C-c C-p c c treemacs-collapse-project Collapse project at point.
C-c C-p c o/S-TAB treemacs-collapse-all-projects Collapse all projects.
C-c C-p c o treemacs-collapse-all-projects Collapse all projects except the project at point.

Workspaces Keybinds (Prefix C-c C-w)

Key Action Description
C-c C-w r treemacs-rename-workspace Rename a workspace.
C-c C-w a treemacs-create-workspace Create a new workspace.
C-c C-w d treemacs-remove-workspace Delete a workspace.
C-c C-w s treemacs-switch-workspace Switch the current workspace.
C-c C-w e treemacs-edit-workspaces Edit workspace layout via org-mode.
C-c C-w f treemacs-set-fallback-workspace Select the default fallback workspace.

Node Visit Keybinds (Prefix o)

Key Action Description
ov treemacs-visit-node-vertical-split Open current file or tag by vertically splitting next-window.
oh treemacs-visit-node-horizontal-split Open current file or tag by horizontally splitting next-window.
oo/RET treemacs-visit-node-no-split Open current file or tag, performing no split and using next-window directly.
oaa treemacs-visit-node-ace Open current file or tag, using ace-window to decide which window to open the file in.
oah treemacs-visit-node-ace-horizontal-split Open current file or tag by horizontally splitting a window selected by ace-window.
oav treemacs-visit-node-ace-vertical-split Open current file or tag by vertically splitting a window selected by ace-window.
or treemacs-visit-node-in-most-recently-used-window Open current file or tag in the most recently used window.
ox treemacs-visit-node-in-external-application Open current file according to its mime type in an external application. Linux, Windows and Mac are supported.

Toggle Keybinds (Prefix t)

Key Action Description
th treemacs-toggle-show-dotfiles Toggle the hiding and displaying of dotfiles.
tw treemacs-toggle-fixed-width Toggle whether the treemacs window should have a fixed width. See also treemacs-width.
tf treemacs-follow-mode Toggle treemacs-follow-mode.
ta treemacs-filewatch-mode Toggle treemacs-filewatch-mode.
tv treemacs-fringe-indicator-mode Toggle treemacs-fringe-indicator-mode.

Copy Keybinds (Prefix y)

Key Action Description
yy treemacs-copy-path-at-point Copy the absolute path of the node at point.
yr treemacs-copy-project-root Copy the absolute path of the project root for the node at point.
yf treemacs-copy-file Copy the file at point.

General Keybinds

Key Action Description
? treemacs-helpful-hydra Summon the helpful hydra to show you the treemacs keymap.
j/n treemacs-next-line Go to the next line.
k/p treemacs-previous-line Go to the previous line.
M-J/N treemacs-next-line-other-window Go to the next line in next-window.
M-K/P treemacs-previous-line-other-window Go to the previous line in next-window..
<PgUp> treemacs-next-page-other-window Go to the next page in next-window.
<PgDn> treemacs-previous-page-other-window Go to the previous page in next-window..
M-j/M-n treemacs-next-neighbour Go to the next same-level neighbour of the current node.
M-k/M-p treemacs-previous-neighbour Go to the previous same-level neighbour of the current node.
u treemacs-goto-parent-node Go to parent of node at point, if possible.
<M-Up> treemacs-move-project-up Switch positions of project at point and the one above it.
<M-Down> treemacs-move-project-down Switch positions of project at point and the one below it.
w treemacs-set-width Set a new value for the width of the treemacs window.
RET treemacs-RET-action Run the action defined in treemacs-RET-actions-config for the current node.
TAB treemacs-TAB-action Run the action defined in treemacs-TAB-actions-config for the current node.
g/r/gr treemacs-refresh Refresh the project at point.
d treemacs-delete Delete node at point.
R treemacs-rename Rename node at point.
cf treemacs-create-file Create a file.
cd treemacs-create-dir Create a directory.
q treemacs-quit Hide the treemacs window.
Q treemacs-kill-buffer Delete the treemacs buffer.
P treemacs-peek Peek at the file (or tag) at point without fully opening it.
yy treemacs-copy-path-at-point Copy the absolute path of the node at point.
yr treemacs-copy-project-root Copy the absolute path of the project root for the node at point.
yf treemacs-copy-file Copy the file at point.
m treemacs-move-file Move the file at point.
s treemacs-resort Set a new value for treemacs-sorting.
b treemacs-add-bookmark Bookmark the currently selected files’s, dir’s or tag’s location.
h treemacs-root-up Move treemacs’ root one level upward. Only works with a single project in the workspace.
l treemacs-root-down Move treemacs’ root into the directory at point. Only works with a single project in the workspace.
H treemacs-collapse-parent-node Collapse the parent of the node at point.
\! treemacs-run-shell-command-for-current-node Run an asynchronous shell command on the current node, replacing “$path” with its path.
M-! treemacs-run-shell-command-in-project-root Run an asynchronous shell command in the root of the current project, replacing “$path” with its path.

Compatibility

The correctness of treemacs’ display behaviour is, to a large degree, ensured through window properties and reacting to changes in the window configuration. The packages most likely to cause trouble for treemacs are therefore those that interfere with Emacs’ buffer spawning and window splitting behaviour. Treemacs is included in Spacemacs and I am a Spacemacs user, therefore treemacs guarantees first-class support & compatibility for window-managing packages used in Spacemacs, namely persp/perspective, eyebrowse, popwin and window-purpose, as well as shackle. For everything else there may be issues and, depending on the complexity of the problem, I may decide it is not worth fixing.

Aside from this there are the following known incompatibilities:

  • Any package invoking font-lock-ensure in the treemacs buffer. This will reset the faces of treemacs’ buttons (once) and is a known emacs bug.
  • A possible cause of this issue using an old version of swiper.
  • Rainbow mode activated in treemacs will likewise produce this behaviour. Make sure not to include rainbow-mode as part of special-mode-hook, since this is the mode treemacs-mode is derived from.

FAQ

  • How do I hide files I don’t want to see?

    You need to define a predicate function and add it to treemacs-ignored-file-predicates. This function accepts two arguments, a file’s name and its absolute path, and must return non-nil when treemacs should hide that file.

    For example the code to ignore files eiter called “foo” or located in ”x/y/z” would look like this:

    (with-eval-after-load 'treemacs
    
      (defun treemacs-ignore-example (filename absolute-path)
        (or (string-equal filename "foo")
            (string-prefix-p "/x/y/z/" absolute-path)))
    
      (add-to-list 'treemacs-ignored-file-predicates #'treemacs-ignore-example))
        
  • How do I keep treemacs from showing files that are ignored by git?

    Short answer:

    (treemacs-git-mode 'extended)
    (with-eval-after-load 'treemacs
      (add-to-list 'treemacs-pre-file-insert-predicates #'treemacs-is-file-git-ignored?))
        

    (simple git-mode would also work, but only for files. deferred mode with its delay would always use the last run’s git information, so it might look like it’s reacting incorrectly, especially on the first run)

    A slightly longer explanation about how you can hook into the render process can be found in the documentation string of treemacs-pre-file-insert-predicates.

  • Why am I seeing no file icons and only +/- for directories?

    Treemacs will permanently fall back on its simple TUI icons if it detects that the emacs instance it is run in cannot create images. You can test this by evaluating (create-image "" 'png). If this code returns an error like “Invalid image type ´png´” your emacs does not support images.

  • How do I get treemacs to stop telling me when it’s been refreshed, especially with filewatch-mode?

    See treemacs-silent-refresh and treemacs-silent-filewatch.

  • ENOSPC / No space left on device / no file descriptor left

    You may run into this error when you use filewatch-mode. The solution is to increase the number of allowed user watches, as described here for Linux and here for Mac.

    You will also want to see what’s responsible for setting all those file watches in the first place, since treemacs only watches the expanded directories it is displaying and so won’t produce more than a couple dozen watches at best.

  • Why is treemacs warning me about not being able to find some background colors and falling back to something else?

    Treemacs needs those colors to make sure that background colors of its icons correctly align with hl-line-mode. Png images’ backgrounds are not highlighted by hl-line-mode by default, treemacs is manually correcting this every time hl-line’s overlay is moved. To make that correction work it needs to know two colors: the current theme’s default background, and its hl-line background color. If treemacs cannot find hl-lines’s background color it falls back to the default background color. If it cannot even find the default background it will fall back to #2d2d31. The warnings serve to inform you of that fallback.

    If your theme does not define a required color you can set it yourself before treemacs loads like this:

    (set-face-attribute 'hl-line nil :background "#333333")
        

    If you just want to disable the warnings you can do so by defining the variable treemacs-no-load-time-warnings. Its exact value is irrelevant, all that matters is that it exists at all. Since the warnings are issues when treemacs is first being loaded the variable must be defined before treemacs is initialized. This is best achieved by adding the line (defvar treemacs-no-load-time-warnings t) to treemacs’ use-package :init block.

  • Can I expand everything under a node?

    Yes, you just need to expand it with a prefix argument. Closing nodes with a prefix argument works as well. In this case treemacs will forget about the nodes opened below the one that was closed and not reopen them automatically.

Contributing

Contributions are very much welcome, but should fit the general scope and style of treemacs. The following is a list of guidelines that should be met (exceptions confirm the rule):

  • There should be one commit per feature.
  • Commit messages should start with a note in brackets that roughly describes the area the commit relates to, for example [Icons] if you add an icon.
  • Code must be in the right place (what with the codebase being split in many small files). If there is no right place it probably goes into treemacs-core-utils.el which is where all the general implementation details go.
  • New features must be documented in the readme (for example mentioning new config options in the Config Table).
  • There must not be any compiler warnings.
  • The test suite must pass.

Treemacs uses cask to setup a local testing environment and a Makefile that simplifies compiling and testing the codebase. First run cask install to locally pull treemacs’ dependencies. Then you can use the following Makefile targets:

make prepare
Downloads and updates Cask’s dependencies. Is a dependency of the test and compile targets.
make compile
Compiles the code base (and treats compiler warnings as errors).
make clean
Removes the generated .elc files.
make lint
Runs first compile then clean, even if the former fails.
make test
Runs the testsuite, once in a graphical environment and once in the terminal.

Finally if you want to just add an icon you can take this commit as an example (though the icons have since been moved into their own module in treemacs-icons.el).

Working With The Code Base

If you want to delve into the treemacs’ code base, check out the wiki for some general pointers.

Dependencies

  • emacs >= 25.2
  • f.el
  • s.el
  • dash
  • cl-lib
  • ace-window
  • pfuture
  • ht
  • hydra
  • (optionally) evil
  • (optionally) projectile
  • (optionally) winum
  • (optionally) python(3)
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

简介

暂无描述 展开 收起
README
GPL-3.0
取消

发行版

暂无发行版

近期动态

4年多前创建了仓库
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aggronmagi/treemacs.git
git@gitee.com:aggronmagi/treemacs.git
aggronmagi
treemacs
treemacs
master

搜索帮助