Simple functionality to show/hide eshell/ansi-term (or almost any other buffer, see eshell-toggle-init-function description below) at the bottom of active window with directory of its buffer.
(add-to-list 'load-path "/path/to/eshell-toggle.el")
(require 'eshell-toggle)
(global-set-key (kbd "s-`") 'eshell-toggle)
or using use-package and quelpa:
(use-package eshell-toggle
:custom
(eshell-toggle-size-fraction 3)
(eshell-toggle-find-project-root-package t) ;; for projectile
;;(eshell-toggle-find-project-root-package 'projectile) ;; for projectile
;; (eshell-toggle-use-projectile-root 'project) ;; for in-built project.el
(eshell-toggle-run-command nil)
(eshell-toggle-init-function #'eshell-toggle-init-ansi-term)
:quelpa
(eshell-toggle :repo "4DA/eshell-toggle" :fetcher github :version original)
:bind
("s-`" . eshell-toggle))
-
eshell-toggle-size-fraction(NB:eshell-toggle-height-fractionis obsolete since 0.10.0) Proportion of parent window size (seeeshell-toggle-window-sidebelow) and eshell window; -
eshell-toggle-window-side- Where to open eshell window, a value can be'below'(default),'above,'rightor'left; -
eshell-toggle-default-directoryDefault directory to open eshell at if buffer has no associated file; -
eshell-toggle-name-separatorString to separate directory paths when giving a name to buffer. -
eshell-toggle-use-projectile-rootis obsolete since 0.10.1, use the followingeshell-toggle-find-project-root-packageinstead. -
eshell-toggle-find-project-root-packageIf set to'projectit tries to use the built-inprojectto open an eshell at project root, if set to'projectileortit usesprojectile, and if set to nil it detects the current directory. -
eshell-toggle-run-command- command to run in a new shell. -
eshell-toggle-init-functionis a function to initialize toggled buffer, default one iseshell-toggle-init-eshell, but can be any function which takes a directory and buffer name as arguments and creates a buffer, ootb there areeshell-toggle-init-eshell,eshell-toggle-init-ansi-term,eshell-toggle-init-shellandeshell-toggle-init-tmuxand (you have to have tmux binary in your PATH),diredandmagit-statuswork too. -
eshell-toggle-init-term-char-modeIf not nil eshell-toggle starts ansi-term based buffers interm-char-mode
If you want to change these on a per-directory basis, you can use .dir-locals.el magic:
((nil . ((eshell-toggle-init-function . eshell-toggle-init-ansi-term))))