|
@@ -0,0 +1,27 @@
|
|
|
+; http://www.howardism.org/Technical/Emacs/eshell-fun.html
|
|
|
+
|
|
|
+(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)
|
|
|
+
|
|
|
+(defun eshell/x ()
|
|
|
+ (insert "exit")
|
|
|
+ (eshell-send-input)
|
|
|
+ (delete-window))
|
|
|
+
|