Compare commits

..

2 Commits

Author SHA1 Message Date
8c6fccb87d More eshell window management tweaks 2025-06-21 21:50:02 -07:00
60b8734695 Just support 2025-06-21 21:49:48 -07:00
3 changed files with 50 additions and 2 deletions

4
.justfile Normal file
View File

@@ -0,0 +1,4 @@
# Run home-manager switch to update Nix environment
nixup:
cd "{{justfile_directory()}}`/nix" && home-manager switch --flake ".#std"

View File

@@ -512,7 +512,7 @@
"\\*Flycheck errors\\*"
help-mode
compilation-mode
"\\*eshell-popup\\*" eshell-mode))
"\\*eshell-popup\\*"))
(defun my/popper-window-height (window)
"Make eshell popups take half the frame height, otherwise defer to popper--fit-window-height"
@@ -669,6 +669,16 @@
;;;; Emacs Server
(server-start)
;;;; Just
(use-package just-mode
:ensure t)
(use-package justl
:ensure t
:bind (("C-c j" . justl-exec-default-recipe)
("C-c J" . justl)))
;;; Org-mode
(use-package org
:bind (("C-c o ," . my/org-clear-all)
@@ -929,8 +939,41 @@
when (string-match regexp (buffer-name (window-buffer window)))
thereis window))
(defun my/split-largest-eshell-and-focus ()
"Find the largest eshell window in the current frame, split it
along its longest dimension, and create a new eshell in the
split. The new eshell uses the `default-directory` of the
buffer that was current when this command was invoked. Finally,
the new eshell window is selected."
(interactive)
(let* ((starting-dir default-directory)
(largest-eshell-window
(cl-loop with max-area = 0
with largest-win = nil
for win in (window-list)
when (with-current-buffer (window-buffer win)
(eq major-mode 'eshell-mode))
do (let ((area (* (window-total-width win) (window-total-height win))))
(when (> area max-area)
(setq max-area area)
(setq largest-win win)))
finally return largest-win))
(new-window
(with-selected-window largest-eshell-window
(if (> (window-total-width) (* 2 (window-total-height)))
(split-window-right)
(split-window-below)))))
(select-window new-window)
(let ((default-directory starting-dir))
(eshell t))))
; (select-window new-window)))
(use-package eshell
:bind (("M-`" . my/eshell-toggle))
:bind (("M-`" . my/eshell-toggle)
:map eshell-mode-map
("C-S-<return>" . my/split-largest-eshell-and-focus))
:config
(setq eshell-destroy-buffer-when-process-dies t
eshell-scroll-to-bottom-on-input t

View File

@@ -27,6 +27,7 @@
roboto-mono
aider-chat
sops
just
];
imports = [