Skip to content

Commit

Permalink
Merge pull request #34 from jianingy/fixed-issue-33
Browse files Browse the repository at this point in the history
Fixed issue 33
  • Loading branch information
jaypei committed Aug 9, 2014
2 parents 92bf5e2 + 16fd330 commit 96e51c8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion neotree.el
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ By default all filest starting with dot '.' including . and ..")
:type 'boolean
:group 'neotree)

(defcustom neo-dont-be-alone nil
"*If non-nil, you cannot left neotree window alone."
:type 'boolean
:group 'neotree)

;;
;; Faces
;;
Expand Down Expand Up @@ -286,6 +291,14 @@ it will be auto create neotree window and return it."
(cdr (window-list)))
ad-do-it))

(defadvice delete-window
(around neotree-delete-window activate)
(if (and neo-dont-be-alone
(eq (safe-length (window-list)) 2)
(string-equal (buffer-name (window-buffer (next-window))) neo-buffer-name))
(message "only one window other than neotree left. won't close")
ad-do-it))

(defadvice mouse-drag-vertical-line
(around neotree-drag-vertical-line (start-event) activate)
(neo-global--with-buffer
Expand Down Expand Up @@ -820,6 +833,11 @@ NeoTree buffer is BUFFER."
(neo-buffer--toggle-expand btn-full-path)
(neo-buffer--refresh t))
(progn
(if (eq (safe-length (window-list)) 1)
(neo-global--with-buffer
(neo-buffer--unlock-width)
(split-window-horizontally)
(neo-buffer--lock-width)))
(neo-global--when-window
(neo-window--zoom 'minimize))
(switch-to-buffer (other-buffer (current-buffer) 1))
Expand Down Expand Up @@ -896,7 +914,7 @@ NeoTree buffer is BUFFER."
(defun neotree-hidden-file-toggle ()
"Toggle show hidden files."
(interactive)
(neo-set-show-hidden-files (not neo-buffer--show-hidden-file-p)))
(neo-set-show-hidden-files (not neo-buffer--show-hidden-file-p)))

(defun neotree-empty-fn ()
"Used to bind the empty function to the shortcut."
Expand Down

0 comments on commit 96e51c8

Please sign in to comment.