Use shell-pop to toggle shell/eshell

The advantages:

- Always pop at the bottom, never taking whole window. It's convenient
when we need a shell to run some commands, then put it out.

- Can track the directory of current buffer, so we won't have to change
directory to current directory if we want to have a shell to do
something. For example, we can navigate using Dired to a directory, then
open a shell with shell-pop to run some commands.
This commit is contained in:
Tu Do 2015-04-22 11:47:32 +07:00 committed by syl20bnr
parent a94808b040
commit 7d7928a21b
2 changed files with 20 additions and 2 deletions

View file

@ -48,8 +48,8 @@
"ac" 'calc-dispatch "ac" 'calc-dispatch
"ad" 'dired "ad" 'dired
"ap" 'proced "ap" 'proced
"ase" 'eshell "ase" 'shell-pop-eshell
"asi" 'shell "asi" 'shell-pop-shell
"au" 'undo-tree-visualize) "au" 'undo-tree-visualize)
;; buffers -------------------------------------------------------------------- ;; buffers --------------------------------------------------------------------
(evil-leader/set-key (evil-leader/set-key

View file

@ -90,6 +90,7 @@
recentf recentf
rfringe rfringe
shell shell
shell-pop
smartparens smartparens
smooth-scrolling smooth-scrolling
subword subword
@ -2602,6 +2603,23 @@ It is a string holding:
(add-hook 'eshell-mode-hook (lambda () (add-hook 'eshell-mode-hook (lambda ()
(setq pcomplete-cycle-completions nil)))) (setq pcomplete-cycle-completions nil))))
(defun spacemacs/init-shell-pop ()
(use-package shell-pop
:defer t
:init
(defmacro make-shell-pop-command (type &optional shell)
(let* ((name (symbol-name type)))
`(defun ,(intern (concat "shell-pop-" name)) (index)
(interactive "P")
(require 'shell-pop)
(shell-pop--set-shell-type 'shell-pop-shell-type (backquote (,name
,(concat "*" name "*")
(lambda nil (funcall ',type ,shell)))))
(shell-pop index))))
(make-shell-pop-command eshell)
(make-shell-pop-command shell)
(make-shell-pop-command term shell-pop-term-shell)))
(defun spacemacs/init-smartparens () (defun spacemacs/init-smartparens ()
(use-package smartparens (use-package smartparens
:defer t :defer t