Last active
August 29, 2015 14:10
-
-
Save germ13/9d2644c0926fad9dd90d to your computer and use it in GitHub Desktop.
Creates a buffer on the bottom 3rd of the frame. The buffers is an Emacs Eshell, that opens up to the current working directory of the current buffer. Borrowed from http://www.howardism.org/Technical/Emacs/eshell-fun.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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." | |
(interactive) | |
(let* ((parent (if (buffer-file-name) | |
(file-name-directory (buffer-file-name)) | |
default-directory)) | |
(height (/ (window-total-height) 3)) | |
(name (car (last (split-string parent "/" t))))) | |
(split-window-vertically (- height)) | |
(other-window 1) | |
(eshell "new") | |
(rename-buffer (concat "*eshell: " name "*")) | |
(insert (concat "ls")) | |
(eshell-send-input))) | |
(global-set-key (kbd "C-!") 'eshell-here) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment