Fix up eshell config
This commit is contained in:
parent
12d9fe25f6
commit
323a1c7900
@ -111,19 +111,31 @@
|
|||||||
;; --------------------------------------------------------------------------
|
;; --------------------------------------------------------------------------
|
||||||
|
|
||||||
(use-package eshell
|
(use-package eshell
|
||||||
:init
|
:config
|
||||||
|
(defun eshell-pop (name)
|
||||||
|
"Launch terminal in (preferably) other window."
|
||||||
|
(let ((esh-buf nil)
|
||||||
|
(cur-buf (current-buffer)))
|
||||||
|
(setq esh-buf (eshell name))
|
||||||
|
(switch-to-buffer cur-buf)
|
||||||
|
(switch-to-buffer-other-window esh-buf)))
|
||||||
|
|
||||||
(defun eshell-here ()
|
(defun eshell-here ()
|
||||||
"Opens up a new shell in the directory associated with the
|
|
||||||
current buffer's file."
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((parent (file-name-directory (buffer-file-name)))
|
(let* ((parent default-directory)
|
||||||
(name (car
|
(name (car
|
||||||
(last
|
(last
|
||||||
(split-string parent "/" t)))))
|
(split-string parent "/" t))))
|
||||||
(split-window-vertically)
|
(esh-buf-name (concat "*eshell: " name "*"))
|
||||||
(other-window 1)
|
(is-esh (string= "eshell-mode" major-mode))
|
||||||
(eshell "new")
|
(esh-buf (first-matching-buffer esh-buf-name)))
|
||||||
(rename-buffer (concat "*eshell: " name "*"))
|
|
||||||
|
(unless is-esh
|
||||||
|
(if esh-buf
|
||||||
|
(switch-to-buffer-other-window esh-buf)
|
||||||
|
(progn
|
||||||
|
(eshell-pop "new")
|
||||||
|
(rename-buffer esh-buf-name))))
|
||||||
|
|
||||||
(insert (concat "ls"))
|
(insert (concat "ls"))
|
||||||
(eshell-send-input)))
|
(eshell-send-input)))
|
||||||
@ -149,8 +161,7 @@
|
|||||||
|
|
||||||
(add-hook 'eshell-mode-hook 'eshell-setup t)
|
(add-hook 'eshell-mode-hook 'eshell-setup t)
|
||||||
|
|
||||||
(global-set-key (kbd "C-x /") 'eshell-here)
|
(global-set-key (kbd "C-x /") 'eshell-here))
|
||||||
)
|
|
||||||
|
|
||||||
(use-package em-smart
|
(use-package em-smart
|
||||||
:config
|
:config
|
||||||
|
Reference in New Issue
Block a user