- (defun eshell-here ()
- "Opens up a new shell in the directory associated with the
- current buffer's file. The eshell is renamed to match that
- directory to make multiple eshell windows easier."
+*** Toggle Eshell
+Toggle an eshell in split window below, refer [[http://www.howardism.org/Technical/Emacs/eshell-fun.html][eshell-here]]
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (defun sd/window-has-eshell ()
+ "Check if current windows list has a eshell buffer, and return the window"
+ (interactive)
+ (let ((ret nil))
+ (dolist (window (window-list))
+ (let ((modename (with-current-buffer (window-buffer window)
+ major-mode)))
+ (if (equal modename 'eshell-mode)
+ (setq ret window))))
+ ret))
+
+ (defun sd/toggle-eshell-here ()
+ "Toggle a eshell buffer vertically"