1
0
Fork 0

fix(emacs): add keybind for finding terminals

This commit is contained in:
Lucas Sta Maria 2025-02-08 19:28:07 -05:00
parent 2d1e04a4df
commit 2bb192de80
No known key found for this signature in database
GPG key ID: F07FB16A826E3B47
2 changed files with 22 additions and 1 deletions

View file

@ -4,6 +4,9 @@
;; development experience and productivity.
;;; Code:
(require 'dash)
(require 'priime-utils)
(defun pdf-download-and-view (&optional url filename)
"Download and view the PDF given by its URL as FILENAME."
(interactive)
@ -44,6 +47,15 @@
(priime-terminal)
(balance-windows))
(defun priime-find-terminal ()
"Search for an open terminal and move to it."
(interactive)
(let* ((term-buffers (-filter #'buffer-vterm-p (buffer-list)))
(term-buf-names (-map #'buffer-name term-buffers))
(selected-term-buffer
(completing-read "terminal buffer: " term-buf-names nil t nil)))
(switch-to-buffer selected-term-buffer)))
(use-package projectile :straight t
:custom
(projectile-completion-system 'auto)
@ -64,7 +76,8 @@
(use-package vterm :straight t
:custom (vterm-shell (or (executable-find "fish") shell-file-name))
:bind (("C-c v" . priime-terminal)
("<f8>" . priime-split-terminal)))
("<f8>" . priime-split-terminal)
("C-<f8>" . priime-find-terminal)))
(use-package rg :straight t)
(use-package anzu :straight t
:bind ("C-c r a" . anzu-query-replace-regexp)

View file

@ -25,6 +25,14 @@
(filepath (or filepath (read-file-name "filename: "))))
(url-copy-file url filepath 1)))
(defun buffer-major-mode (buffer-name)
"Get the major mode of the buffer with the given name."
(buffer-local-value 'major-mode (get-buffer buffer-name)))
(defun buffer-vterm-p (buffer-name)
"Is the buffer with the given name a vterm buffer?"
(eq 'vterm-mode (buffer-major-mode buffer-name)))
(provide 'priime-utils)
;;; priime-utils.el ends here