Some work on vterm stuff
This commit is contained in:
parent
0e3491c9a8
commit
8f354329dd
20
init.el
20
init.el
@ -457,16 +457,17 @@ visual states."
|
|||||||
|
|
||||||
;; project.el
|
;; project.el
|
||||||
(use-package project
|
(use-package project
|
||||||
:bind (:map project-prefix-map
|
:bind (("C-x C-a" . my/project-vterm-or-default)
|
||||||
|
:map project-prefix-map
|
||||||
("s" . my/project-vterm)
|
("s" . my/project-vterm)
|
||||||
("u" . my/project-run))
|
("u" . my/project-run))
|
||||||
:init
|
:init
|
||||||
(defvar my/project-vterm-hash-table (make-hash-table :test 'equal)
|
(defvar my/project-vterm-hash-table (make-hash-table :test 'equal)
|
||||||
"Hash table that maps project root dirs to vterm buffers.")
|
"Hash table that maps project root dirs to vterm buffers.")
|
||||||
(defun my/project-vterm ()
|
(defun my/project-vterm (prompt)
|
||||||
"Switch to or create a vterm buffer in the current projects root."
|
"Switch to or create a vterm buffer in the current projects root."
|
||||||
(interactive)
|
(interactive (list t))
|
||||||
(if-let ((proj (project-current t))
|
(if-let ((proj (project-current prompt))
|
||||||
(default-directory (project-root proj)))
|
(default-directory (project-root proj)))
|
||||||
(if-let ((vterm-buff (gethash default-directory
|
(if-let ((vterm-buff (gethash default-directory
|
||||||
my/project-vterm-hash-table))
|
my/project-vterm-hash-table))
|
||||||
@ -475,6 +476,14 @@ visual states."
|
|||||||
(puthash default-directory
|
(puthash default-directory
|
||||||
(vterm (concat "*vterm for project " default-directory "*"))
|
(vterm (concat "*vterm for project " default-directory "*"))
|
||||||
my/project-vterm-hash-table))))
|
my/project-vterm-hash-table))))
|
||||||
|
(defun my/project-vterm-or-default ()
|
||||||
|
"Open a vterm for the current project, otherwise, open a normal vterm."
|
||||||
|
(interactive)
|
||||||
|
(unless (my/project-vterm nil)
|
||||||
|
(if-let ((vterm-buff (gethash nil my/project-vterm-hash-table))
|
||||||
|
((buffer-live-p vterm-buff)))
|
||||||
|
(switch-to-buffer vterm-buff)
|
||||||
|
(puthash nil (vterm vterm-buffer-name) my/project-vterm-hash-table))))
|
||||||
(defvar my/project-run-command nil
|
(defvar my/project-run-command nil
|
||||||
"Command to run with `my/project-run'.")
|
"Command to run with `my/project-run'.")
|
||||||
(put 'my/project-run-command 'safe-local-variable (lambda (val)
|
(put 'my/project-run-command 'safe-local-variable (lambda (val)
|
||||||
@ -551,8 +560,7 @@ COMMAND and COMINT are like `compile'."
|
|||||||
|
|
||||||
;; vterm
|
;; vterm
|
||||||
(use-package vterm
|
(use-package vterm
|
||||||
:hook (vterm-mode . with-editor-export-editor)
|
:hook (vterm-mode . with-editor-export-editor))
|
||||||
:bind ("C-x C-a" . vterm))
|
|
||||||
|
|
||||||
;; proced
|
;; proced
|
||||||
(use-package proced
|
(use-package proced
|
||||||
|
Loading…
Reference in New Issue
Block a user