filetree: Update treemacs layer.

This commit is contained in:
Alexander Miller 2018-05-25 07:39:15 +02:00 committed by Codruț Constantin Gușoi
parent aeac113452
commit 3ff7f4adce
2 changed files with 58 additions and 47 deletions

View file

@ -25,8 +25,13 @@ 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.
@ -84,10 +89,9 @@ Default value is 3 (or 0 when python is not installed).
| ~M-0~ | Selected the treemacs window. Actually selects window #10, which is always assigned to treemacs. |
| ~SPC 0~ | Open 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 B~ | Find 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 p~ | Same as ~SPC f t~, but when creating a new buffer open it in the current project's root. |
| ~SPC f P~ | Open treemacs in the current project's root. With a prefix arg manually select the project instead. |
| ~SPC f t~ | Hide/show existing treemacs buffer. Create one for the current directory if no buffer exists. |
| ~SPC f T~ | Manually focus the treemacs view on the currently selected file. Not needed when =treemacs-follow-mode= is enabled. |
| ~SPC f M-t~ | Manually 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,
@ -95,35 +99,47 @@ 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 Binding | Description |
|-------------+---------------------------------------------------------------------------------------------------------------------------------------|
| ~?~ | Summon the helpful hydra to show you the treemacs keymap. |
| ~M-j/M-n~ | Select next node at the same depth as currently selected node, if possible. |
| ~Q~ | Kill the treemacs buffer. |
| ~RET~ | Do what I mean. (Run the action defined in ~treemacs-default-actions~ for the current button.) |
| ~R~ | Rename the currently selected node. Reload buffers visiting renamed files or files in renamed direcotries. |
| ~TAB~ | Push the button in the current line to open/close the selected node. |
| ~cd~ | Create a directory. |
| ~cf~ | Create a file. |
| ~d~ | Delete node at point. A delete action must always be confirmed. Directories are deleted recursively. |
| ~g/r/gr~ | Refresh and rebuild the treemacs buffer. |
| ~h~ | Switch treemacs' root directory to current root's parent, if possible. |
| ~j/n~ | Goto next/prev line. |
| ~l~ | Use currently selected directory as new root. Do nothing for files. |
| ~mouse1~ | Do the same as TAB when mouse1 clicking on an icon. Clicking anywhere other than an icon does nothing. |
| ~oaa~ | Open current file or tag, using ace-window to decide which buffer to open the file in. Stay in current window with a prefix argument. |
| ~oah~ | Open current file or tag by horizontally splitting a buffer selected by ace-window. Stay in current window with a prefix argument. |
| ~oav~ | Open current file or tag by vertically splitting a buffer selected by ace-window. Stay in current window with a prefix argument. |
| ~oh~ | Open current file or tag by horizontally splitting next-window. Stay in current window with a prefix argument. |
| ~oo/RET~ | Open current file or tag, performing no split and using next-window directly. Stay in current window with a prefix argument. |
| ~ov~ | Open current file or tag by vertically splitting next-window. Stay in current window with a prefix argument. |
| ~ox~ | Open current file or dir, using the xdg-open shell-command. |
| ~q~ | Hide/show an existing treemacs buffer. |
| ~ta~ | treemacs-filewatch-mode. |
| ~tf~ | Toggle treemacs-follow-mode. |
| ~th~ | Toggle the hiding and displaying of dotfiles. |
| ~tw~ | Toggle whether the treemacs buffer should have a fixed width. |
| ~u~ | Select parent of selected node, if possible. |
| ~w~ | Reset the width of the treemacs buffer to its default. With a prefix arg set a new default first. |
| ~yr~ | Copy the absolute path of the current treemacs root. |
| ~yy~ | Copy the absolute path of the node at point. |
| Key Binding | Description |
|-------------+----------------------------------------------------------------------------------------------------------------|
| ~?~ | Summon the helpful hydra to show you the treemacs keymap. |
| ~M-j/M-n~ | Select next node at the same depth as currently selected node, if possible. |
| ~j/n~ | Goto next line. |
| ~k/p~ | Goto previous line. |
| ~M-J/N~ | Go to the next line in ~next-window~. |
| ~M-K/P~ | Go to the previous line in ~next-window~.. |
| ~M-j/M-n~ | Select next node at the same depth as currently selected node, if possible. |
| ~M-k/M-p~ | Select previous node at the same depth as currently selected node, if possible. |
| ~C-p a~ | Select a new project to add to the treemacs workspace. |
| ~C-p p~ | Select a projectile project to add to the workspace. |
| ~C-p d~ | Remove project at point from the workspace. |
| ~C-p r~ | Rename project at point. |
| ~th~ | Toggle the hiding and displaying of dotfiles. |
| ~tw~ | Toggle whether the treemacs buffer should have a fixed width. |
| ~tf~ | Toggle treemacs-follow-mode. |
| ~ta~ | treemacs-filewatch-mode. |
| ~w~ | Set a new value for the width of the treemacs window. |
| ~TAB~ | Do what I mean (as defined in ~treemacs-TAB-actions-config~). Prefers expanding nodes by default. |
| ~RET~ | Do what I mean (as defined in ~treemacs-RET-actions-config~). Prefers visiting nodes by default. |
| ~mouse1~ | Move point to clicked line |
| ~2x mouse1~ | Do what I mean (as defined in ~treemacs-doubleclick-actions-config~). Behavious like ~RET~ by default. |
| ~g/r/gr~ | Refresh and rebuild the treemacs buffer. |
| ~d~ | Delete node at point. A delete action must always be confirmed. Directories are deleted recursively. |
| ~cf~ | Create a file. |
| ~cd~ | Create a directory. |
| ~R~ | Rename the currently selected node. Reload buffers visiting renamed files or files in renamed direcotries. |
| ~u~ | Select parent of selected node, if possible. |
| ~q~ | Hide/show an existing treemacs buffer. |
| ~Q~ | Kill the treemacs buffer. |
| ~ov~ | Open current file or tag by vertically splitting ~next-window~. |
| ~oh~ | Open current file or tag by horizontally splitting ~next-window~. |
| ~oo~ | Open current file or tag, performing no split and using ~next-window~ directly. |
| ~oaa~ | Open current file or tag, using ace-window to decide which window to open the file in. |
| ~oah~ | Open current file or tag by horizontally splitting a window selected by ace-window. |
| ~oav~ | Open current file or tag by vertically splitting a window selected by ace-window. |
| ~ox~ | Open current file according to its mime type in an external application. Linux, Windows and Mac are supported. |
| ~ta~ | Toggle ~treemacs-filewatch-mode~. |
| ~tf~ | Toggle ~treemacs-follow-mode~. |
| ~th~ | Toggle the hiding and displaying of dotfiles. |
| ~tw~ | Toggle whether the treemacs buffer should have a fixed width. |
| ~yr~ | Copy the absolute path of the nearest project node at point. |
| ~yy~ | Copy the absolute path of the node at point. |

View file

@ -28,9 +28,10 @@
:defer t
:init
(spacemacs/set-leader-keys
"fB" #'treemacs-bookmark
"ft" #'treemacs
"fT" #'treemacs-find-file)
"ft" #'treemacs
"fB" #'treemacs-bookmark
"fT" #'treemacs-find-file
"f M-t" #'treemacs-find-tag)
:config
(progn
(spacemacs/define-evil-state-face "treemacs" "MediumPurple1")
@ -53,11 +54,8 @@
(when treemacs-use-filewatch-mode
(treemacs-filewatch-mode t))
;; this boundp check guards against a new feature that not all treemacs installations will have
;; TODO remove this guard in a few weeks
(when (boundp 'treemacs-git-mode)
(when (memq treemacs-use-git-mode '(simple extended))
(treemacs-git-mode treemacs-use-git-mode))))))
(when (memq treemacs-use-git-mode '(simple extended))
(treemacs-git-mode treemacs-use-git-mode)))))
(defun treemacs/init-treemacs-evil ()
(use-package treemacs-evil
@ -66,11 +64,8 @@
(defun treemacs/init-treemacs-projectile ()
(use-package treemacs-projectile
:defer t
:init
(spacemacs/set-leader-keys
"fp" #'treemacs-projectile-toggle
"fP" #'treemacs-projectile)))
:after treemacs
:defer t))
(defun treemacs/pre-init-winum ()
(spacemacs|use-package-add-hook winum