summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2025-11-08 17:09:47 -0500
committerJack Jamison <jackqjamison@gmail.com>2025-11-08 17:09:47 -0500
commit53b5c6f41f9139c67eb347b5f7b9c35477ab6650 (patch)
treea995f1bc06ca57fe113b8dcd71b6fdae4b7aa1a9
parenta1995974779801c8743076479b04d6f11a94e836 (diff)
emacs scripts and vterm improvements
-rw-r--r--.config/emacs/TODO.org24
-rw-r--r--.config/emacs/init.el51
-rw-r--r--.config/hypr/binds.conf4
-rwxr-xr-xscripts/getprojects6
-rwxr-xr-xscripts/killemacs5
-rwxr-xr-xscripts/launchemacs5
-rwxr-xr-xscripts/newemacs14
-rwxr-xr-xscripts/restartemacs2
-rwxr-xr-xscripts/startup2
9 files changed, 87 insertions, 26 deletions
diff --git a/.config/emacs/TODO.org b/.config/emacs/TODO.org
index 7f6f53c..7d629ed 100644
--- a/.config/emacs/TODO.org
+++ b/.config/emacs/TODO.org
@@ -5,22 +5,18 @@
- [x] C-g dwim for minibuffer
- [x] vterm and command to open terms
- [x] spacious padding
-- [ ] easier keybind for close frame and kill frame
-- [ ] session management with perspective.el
-- [ ] connect xdg open to current session
+- [ ] session management
- [ ] vterm fix resizing + %
- [ ] switch to eglot
- [ ] agent shell
-- [ ] compile command cacheing and always running under dape
+- [ ] always running under dape
-- [ ] theme resetter
-
-Perspective System
-- Set up binds for perspective
-- Initialize misc perspective
-- Command to open this perspective's vterm. Also to open a second vterm for this perspective
-- open to re-open a vterm buffer (to reset its directory)
-- System wide keybind to open misc perspective or terminal
-- System wide keybind to open an emacs client with a perspective (or yank the view to a current one)
-- XDG open client which asks which perspective
+Session Management System
+- [x] Session creator tool (creates emacs daemon with name and directory, and open client)
+- [x] Session opener tool (opens frame from an existing session)
+- [x] Misc terminal keybind
+- [x] Command to open this perspective's main vterm (in the current projectile directory). Also command to push a new term
+- [ ] easy session switcher (yank or replace or something), maybe save frame or placement from last session's frame
+- [ ] session name displayed in modeline
+- [ ] XDG open client which asks which session
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index 0c61ea7..3bbd6cd 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -448,8 +448,43 @@
'((c++ "libtree-sitter-cpp")))
;; == development environment
+(defun my/replace-master-vterm ()
+ (interactive)
+ (let* ((master-name "Master Terminal")
+ (banished-base "Banished Terminal ")
+ (master-buf (get-buffer master-name))
+ (visible-win (and master-buf (get-buffer-window master-buf t))))
+ (when master-buf
+ (with-current-buffer master-buf
+ (let ((n 1)
+ new-name)
+ (while (get-buffer (setq new-name (format "%s%d" banished-base n)))
+ (setq n (1+ n)))
+ (rename-buffer new-name))))
+ (let ((buf (if visible-win
+ (with-selected-window visible-win
+ (vterm))
+ (vterm-other-window))))
+ (with-current-buffer buf
+ (rename-buffer master-name t)))))
+(defun my/switch-to-master-vterm ()
+ (interactive)
+ (let* ((master-name "Master Terminal")
+ (master-buf (get-buffer master-name))
+ (visible-win (and master-buf (get-buffer-window master-buf t))))
+ (cond
+ (visible-win
+ (select-window visible-win))
+ (master-buf
+ (switch-to-buffer-other-window master-buf))
+ (t
+ (let ((buf (vterm-other-window)))
+ (with-current-buffer buf
+ (rename-buffer master-name t)))))))
+
(use-package vterm
- :bind ( ("C-c a" . vterm-other-window)
+ :bind ( ("C-c a" . my/switch-to-master-vterm)
+ ("C-c C-a" . my/replace-master-vterm)
:map vterm-mode-map
("C-c c" . vterm-copy-mode)
("C-l" . my-vterm-clear)
@@ -472,7 +507,6 @@
(defun my-vterm-setup ()
(when (bound-and-true-p evil-local-mode)
(evil-local-mode -1))
- (text-scale-set 1)
(setq-local truncate-lines nil))
;; disable evil
(with-eval-after-load 'evil
@@ -480,12 +514,13 @@
(add-hook 'vterm-mode-hook #'my-vterm-setup)
(add-hook 'vterm-copy-mode-hook #'my-vterm-copy-mode-evil-setup))
-(use-package perspective
- :bind (("C-x k" . persp-kill-buffer*))
- :custom
- (persp-mode-prefix-key (kbd "C-c M-p"))
- :init
- (persp-mode))
+;; (use-package persp-mode
+;; :bind (("C-x k" . persp-kill-buffer*)
+;; ("C-x C-p" . persp-switch))
+;; :custom
+;; (persp-mode-prefix-key (kbd "C-c M-p"))
+;; :init
+;; (persp-mode))
;; == languages
diff --git a/.config/hypr/binds.conf b/.config/hypr/binds.conf
index b54e546..388b2a6 100644
--- a/.config/hypr/binds.conf
+++ b/.config/hypr/binds.conf
@@ -2,7 +2,7 @@
$mainMod = SUPER
# used programs
-$terminal = emacsclient -c --eval "(vterm)"
+$terminal = emacsclient -c -s main --eval "(my/switch-to-master-vterm)"
$browser = firefox
$menu = swenu-run -oi
$appMenu = swenu-run -coil 10
@@ -22,7 +22,7 @@ bind = $mainMod SHIFT, Q, exit,
bind = $mainMod CONTROLALT SHIFT, L, exec, xdg-open https://linkedin.com
bind = $mainMod, A, exec, $terminal
bind = $mainMod, W, exec, $browser
-bind = $mainMod, E, exec, emacsclient -c
+bind = $mainMod, E, exec, launchemacs
bind = $mainMod CTRL, P, exec, hyprpicker -a
bind = $mainMod, L, exec, simlock
bind = $mainMod, K, exec, $terminal -e htop
diff --git a/scripts/getprojects b/scripts/getprojects
new file mode 100755
index 0000000..c10f507
--- /dev/null
+++ b/scripts/getprojects
@@ -0,0 +1,6 @@
+#!/bin/sh
+{
+ find "$HOME/homework/" -mindepth 2 -maxdepth 2 -type d
+ find "$HOME/development/" -mindepth 1 -maxdepth 1 -type d
+ find "$HOME/opt/" -mindepth 1 -maxdepth 1 -type d
+}
diff --git a/scripts/killemacs b/scripts/killemacs
new file mode 100755
index 0000000..1228018
--- /dev/null
+++ b/scripts/killemacs
@@ -0,0 +1,5 @@
+#!/bin/sh
+name=$(ls -1 $XDG_RUNTIME_DIR/emacs/ | swenu -ceoil 10 -p "Kill:")
+if [ $? -eq 0 ]; then
+ emacsclient -c -s "$name" -e '(kill-emacs)'
+fi
diff --git a/scripts/launchemacs b/scripts/launchemacs
new file mode 100755
index 0000000..8b95242
--- /dev/null
+++ b/scripts/launchemacs
@@ -0,0 +1,5 @@
+#!/bin/sh
+name=$(ls -1 $XDG_RUNTIME_DIR/emacs/ | swenu -ceoil 10 -p "Workspace:")
+if [ $? -eq 0 ]; then
+ emacsclient -c -s "$name"
+fi
diff --git a/scripts/newemacs b/scripts/newemacs
new file mode 100755
index 0000000..6b7052c
--- /dev/null
+++ b/scripts/newemacs
@@ -0,0 +1,14 @@
+#!/bin/sh
+project_name=$(swenu -coil 10 -p "New Workspace:")
+if [ $? -ne 0 ]; then
+ exit 1
+fi
+
+project_path=$(getprojects | swenu -coil 10 -p "Directory:" -s "$project_name")
+
+emacs --daemon="$project_name"
+if [ -z "$project_path" ]; then
+ emacsclient -c -s "$project_name"
+else
+ emacsclient -c -s "$project_name" -e "(dired \"$project_path\")"
+fi
diff --git a/scripts/restartemacs b/scripts/restartemacs
index 7f2cee4..5e55c81 100755
--- a/scripts/restartemacs
+++ b/scripts/restartemacs
@@ -1,3 +1,3 @@
#!/bin/sh
pkill -x emacs
-emacs --daemon
+emacs --daemon=main
diff --git a/scripts/startup b/scripts/startup
index 31643a5..a3291e4 100755
--- a/scripts/startup
+++ b/scripts/startup
@@ -4,4 +4,4 @@ hypridle &
waybar &
pipewire &
restartemacs >/dev/null &
-emacs --daemon
+dunst