Skip to content

Instantly share code, notes, and snippets.

@hage
Created March 4, 2013 06:48
Show Gist options
  • Save hage/5080476 to your computer and use it in GitHub Desktop.
Save hage/5080476 to your computer and use it in GitHub Desktop.
(when (featurep 'popwin)
(push '("*eshell*" :height 0.5) popwin:special-display-config)
(defun eshell-pop (universal-argument)
"open eshell window using popwin-elf"
(interactive "P")
(let* ((eshell-buffer-name "*eshell*")
(eshell-buffer (get-buffer eshell-buffer-name))
(file-name (buffer-file-name (current-buffer)))
(current-directory (with-current-buffer (current-buffer) default-directory)))
(if eshell-buffer
(popwin:display-buffer eshell-buffer)
(eshell))
(when (and universal-argument file-name)
(eshell-kill-input)
(insert (concat "cd " current-directory))
(eshell-send-input)
(end-of-buffer))))
(global-set-key "¥C-w¥C-w" 'eshell-pop))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment