2020-05-21 09:59:06 +00:00
|
|
|
;;; packages.el --- Neotree Layer packages File for Spacemacs
|
2017-10-08 11:49:21 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2017-10-08 11:49:21 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2017-11-26 15:00:04 +00:00
|
|
|
(defconst neotree-packages
|
|
|
|
'(
|
|
|
|
neotree
|
|
|
|
winum
|
|
|
|
))
|
2017-10-08 11:49:21 +00:00
|
|
|
|
|
|
|
(defun neotree/init-neotree ()
|
|
|
|
(use-package neotree
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-10-08 11:49:21 +00:00
|
|
|
:commands neo-global--window-exists-p
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq neo-window-width 32
|
|
|
|
neo-create-file-auto-open t
|
|
|
|
neo-banner-message "Press ? for neotree help"
|
|
|
|
neo-show-updir-line nil
|
|
|
|
neo-mode-line-type 'neotree
|
|
|
|
neo-smart-open t
|
|
|
|
neo-dont-be-alone t
|
|
|
|
neo-persist-show nil
|
|
|
|
neo-show-hidden-files t
|
|
|
|
neo-auto-indent-point t
|
|
|
|
neo-modern-sidebar t
|
|
|
|
neo-vc-integration nil)
|
|
|
|
|
2018-05-27 12:27:50 +00:00
|
|
|
(when (eq 'darwin system-type)
|
|
|
|
(setq neo-default-system-application "open"))
|
|
|
|
|
2017-10-08 11:49:21 +00:00
|
|
|
(spacemacs|define-transient-state neotree
|
|
|
|
:title "NeoTree Key Hints"
|
|
|
|
:doc "
|
|
|
|
Navigation^^^^ Actions^^ Visual actions/config^^^
|
|
|
|
───────^^^^─────────────── ───────^^──────── ───────^^^────────────────
|
|
|
|
[_L_] next sibling^^ [_c_] create [_TAB_] shrink/enlarge
|
|
|
|
[_H_] previous sibling^^ [_C_] copy [_|_] vertical split
|
|
|
|
[_J_] goto child^^ [_d_] delete [_-_] horizontal split
|
|
|
|
[_K_] goto parent^^ [_r_] rename [_gr_] refresh^
|
|
|
|
[_l_] open/expand^^ [_R_] change root [_s_] hidden:^^^ %s(if neo-buffer--show-hidden-file-p \"on\" \"off\")
|
|
|
|
[_h_] up/collapse^^ ^^ ^^^
|
|
|
|
[_j_] line down^^ ^^ ^^^
|
|
|
|
[_k_] line up^^ ^^ ^^
|
|
|
|
[_'_] quick look ^^ ^^
|
|
|
|
[_RET_] open ^^^^ [_?_] close hints
|
|
|
|
"
|
|
|
|
:bindings
|
2018-05-17 11:47:11 +00:00
|
|
|
("RET" spacemacs/neotree-expand-or-open)
|
2017-10-08 11:49:21 +00:00
|
|
|
("TAB" neotree-stretch-toggle)
|
|
|
|
("|" neotree-enter-vertical-split)
|
|
|
|
("-" neotree-enter-horizontal-split)
|
|
|
|
("?" nil :exit t)
|
|
|
|
("'" neotree-quick-look)
|
|
|
|
("c" neotree-create-node)
|
|
|
|
("C" neotree-copy-node)
|
|
|
|
("d" neotree-delete-node)
|
|
|
|
("gr" neotree-refresh)
|
|
|
|
("h" spacemacs/neotree-collapse-or-up)
|
|
|
|
("H" neotree-select-previous-sibling-node)
|
|
|
|
("j" neotree-next-line)
|
|
|
|
("J" neotree-select-down-node)
|
|
|
|
("k" neotree-previous-line)
|
|
|
|
("K" neotree-select-up-node)
|
|
|
|
("l" spacemacs/neotree-expand-or-open)
|
|
|
|
("L" neotree-select-next-sibling-node)
|
|
|
|
("r" neotree-rename-node)
|
|
|
|
("R" neotree-change-root)
|
|
|
|
("s" neotree-hidden-file-toggle))
|
|
|
|
|
|
|
|
(defun spacemacs//neotree-key-bindings ()
|
|
|
|
"Set the key bindings for a neotree buffer."
|
|
|
|
(evilified-state-evilify-map neotree-mode-map
|
|
|
|
:mode neotree-mode
|
|
|
|
:bindings
|
|
|
|
(kbd "TAB") 'neotree-stretch-toggle
|
2018-05-17 11:47:11 +00:00
|
|
|
(kbd "RET") 'spacemacs/neotree-expand-or-open
|
2017-10-08 11:49:21 +00:00
|
|
|
(kbd "|") 'neotree-enter-vertical-split
|
|
|
|
(kbd "-") 'neotree-enter-horizontal-split
|
|
|
|
(kbd "'") 'neotree-quick-look
|
|
|
|
(kbd "c") 'neotree-create-node
|
|
|
|
(kbd "C") 'neotree-copy-node
|
|
|
|
(kbd "d") 'neotree-delete-node
|
|
|
|
(kbd "gr") 'neotree-refresh
|
|
|
|
(kbd "h") 'spacemacs/neotree-collapse-or-up
|
|
|
|
(kbd "H") 'neotree-select-previous-sibling-node
|
|
|
|
(kbd "j") 'neotree-next-line
|
|
|
|
(kbd "J") 'neotree-select-down-node
|
|
|
|
(kbd "k") 'neotree-previous-line
|
|
|
|
(kbd "K") 'neotree-select-up-node
|
|
|
|
(kbd "l") 'spacemacs/neotree-expand-or-open
|
|
|
|
(kbd "L") 'neotree-select-next-sibling-node
|
|
|
|
(kbd "q") 'neotree-hide
|
|
|
|
(kbd "r") 'neotree-rename-node
|
|
|
|
(kbd "R") 'neotree-change-root
|
|
|
|
(kbd "?") 'spacemacs/neotree-transient-state/body
|
|
|
|
(kbd "s") 'neotree-hidden-file-toggle))
|
|
|
|
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"ft" 'neotree-toggle
|
2018-02-02 19:15:21 +00:00
|
|
|
"fT" 'neotree-show
|
2017-10-08 11:49:21 +00:00
|
|
|
"pt" 'neotree-find-project-root))
|
|
|
|
:config
|
2018-05-14 21:05:07 +00:00
|
|
|
(progn
|
|
|
|
(spacemacs//neotree-key-bindings)
|
|
|
|
(add-to-list 'spacemacs-window-split-ignore-prefixes neo-buffer-name))))
|
2017-10-08 11:49:21 +00:00
|
|
|
|
|
|
|
(defun neotree/pre-init-winum ()
|
|
|
|
(spacemacs|use-package-add-hook winum
|
|
|
|
:post-config
|
2018-09-10 17:55:44 +00:00
|
|
|
;; `0', `M-0' and `C-x w 0' are bound to `winum-select-window-0-or-10'
|
|
|
|
(define-key winum-keymap [remap winum-select-window-0-or-10] #'neotree-show)
|
|
|
|
;; replace the which-key name
|
|
|
|
(push '((nil . "winum-select-window-0-or-10") . (nil . "neotree-show"))
|
|
|
|
which-key-replacement-alist)
|
|
|
|
(add-to-list 'winum-assign-functions
|
|
|
|
#'spacemacs//winum-neotree-assign-func)))
|