From 026964d3c51d6eebc559d128b9a77404e3b4bda2 Mon Sep 17 00:00:00 2001 From: Dela Anthonio Date: Sun, 26 Nov 2017 10:00:04 -0500 Subject: [PATCH] filetree: Press ~SPC 0~ to open the neotree and treemacs windows Resolve #9313 Window 0 is reserved for file trees. Let's open the file tree window using ~SPC 0~ instead of ~SPC f T~ since it's less key strokes. --- layers/+filetree/neotree/README.org | 6 +++--- layers/+filetree/neotree/packages.el | 16 ++++++++++------ layers/+filetree/treemacs/README.org | 2 +- layers/+filetree/treemacs/packages.el | 5 +++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/layers/+filetree/neotree/README.org b/layers/+filetree/neotree/README.org index 8893b2fd9..fc7da92a5 100644 --- a/layers/+filetree/neotree/README.org +++ b/layers/+filetree/neotree/README.org @@ -76,11 +76,11 @@ See https://github.com/jaypei/emacs-neotree/issues/126 for more information. This layer provides a quick and simple way to navigate in an unknown project file tree with [[https://github.com/jaypei/emacs-neotree][NeoTree]]. -To toggle the =NeoTree= buffer press ~SPC f t~ or ~SPC p t~ (the latter open +To toggle the =NeoTree= buffer, press ~SPC f t~ or ~SPC p t~ (the latter opens NeoTree with the root set to the projectile project root). -The NeoTree window always has the number =0= so it does not shift the current -number of the other windows. To select the NeoTree window you then use ~SPC 0~. +To select the NeoTree window, press ~SPC 0~. The NeoTree window always has the +number =0= so it does not shift the current number of the other windows. VCS integration is supported, the file color will change depending on its current state. With default =spacemacs-dark= theme: diff --git a/layers/+filetree/neotree/packages.el b/layers/+filetree/neotree/packages.el index f5c8677ad..95560c30b 100644 --- a/layers/+filetree/neotree/packages.el +++ b/layers/+filetree/neotree/packages.el @@ -9,11 +9,11 @@ ;; ;;; License: GPLv3 -(setq neotree-packages - '( - neotree - winum - )) +(defconst neotree-packages + '( + neotree + winum + )) (defun neotree/init-neotree () (use-package neotree @@ -103,7 +103,6 @@ Navigation^^^^ Actions^^ Visual actions/config^^^ (spacemacs/set-leader-keys "ft" 'neotree-toggle - "fT" 'neotree-show "pt" 'neotree-find-project-root)) :config (spacemacs//neotree-key-bindings))) @@ -112,3 +111,8 @@ Navigation^^^^ Actions^^ Visual actions/config^^^ (spacemacs|use-package-add-hook winum :post-config (add-to-list 'winum-assign-functions #'spacemacs//winum-neotree-assign-func))) + +(defun neotree/post-init-winum () + (spacemacs/set-leader-keys + ;; window 0 is reserved for file trees + "0" 'neotree-show)) diff --git a/layers/+filetree/treemacs/README.org b/layers/+filetree/treemacs/README.org index a64368fc9..6a83e88f2 100644 --- a/layers/+filetree/treemacs/README.org +++ b/layers/+filetree/treemacs/README.org @@ -81,8 +81,8 @@ Default value is 3 (or 0 when python is not installed). | Key Binding | Description | |-------------+------------------------------------------------------------------------------------------------------------------------------------------------| +| ~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 t~ | Hide/show existing treemacs buffer. Create one for the current directory if no buffer exists. | -| ~SPC f T~ | 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 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 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. | diff --git a/layers/+filetree/treemacs/packages.el b/layers/+filetree/treemacs/packages.el index 656d71130..5af5705da 100644 --- a/layers/+filetree/treemacs/packages.el +++ b/layers/+filetree/treemacs/packages.el @@ -29,7 +29,6 @@ :init (spacemacs/set-leader-keys "ft" #'treemacs-toggle - "fT" #'treemacs "fB" #'treemacs-bookmark "f C-t" #'treemacs-find-file) :config @@ -76,4 +75,6 @@ (defun treemacs/pre-init-winum () (spacemacs|use-package-add-hook winum :post-config - (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))) + (progn + (spacemacs/set-leader-keys "0" #'treemacs) + (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))))