summaryrefslogtreecommitdiffstats
path: root/lisp/init-eshell.el
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2024-03-06 12:45:32 +0100
committerMartin Polden <mpolden@mpolden.no>2024-03-06 12:49:38 +0100
commit70c829959c1f6e8a73fa4bb4bda73f373cb9f24e (patch)
treeec9e2450063d967bd5b03672cc6da7eadc8fcba5 /lisp/init-eshell.el
parent0ad26684430e4c5e9cab64d324611c46acfc115d (diff)
eshell: C-c e opens eshell in another window
Diffstat (limited to 'lisp/init-eshell.el')
-rw-r--r--lisp/init-eshell.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/init-eshell.el b/lisp/init-eshell.el
new file mode 100644
index 0000000..952989a
--- /dev/null
+++ b/lisp/init-eshell.el
@@ -0,0 +1,23 @@
+;;; init-eshell.el --- configure eshell -*- lexical-binding:t -*-
+;;; Commentary:
+;;; Code:
+
+(defun mpolden/eshell-other-window ()
+ "Create a new Eshell buffer in another window.
+
+If `default-directory' is determined to be a project by
+`project-current', the Eshell buffer will be created with
+`project-shell' instead of `eshell'."
+ (interactive)
+ (let ((buf (if (project-current)
+ (project-eshell)
+ (eshell))))
+ (switch-to-buffer (other-buffer buf))
+ (switch-to-buffer-other-window buf)))
+
+(use-package eshell
+ :bind (("C-c e" . mpolden/eshell-other-window)))
+
+(provide 'init-eshell)
+
+;;; init-eshell.el ends here