Add a bunch of project management stuff
This commit is contained in:
parent
31589bab6e
commit
ef970dc06e
55
init.el
55
init.el
@ -111,15 +111,25 @@
|
|||||||
'((c-mode . c-ts-mode)
|
'((c-mode . c-ts-mode)
|
||||||
(c++-mode . c++-ts-mode)
|
(c++-mode . c++-ts-mode)
|
||||||
(c-or-c++-mode . c-or-c++-ts-mode)
|
(c-or-c++-mode . c-or-c++-ts-mode)
|
||||||
(objc-mode . objc-ts-mode)
|
|
||||||
(java-mode . java-ts-mode)
|
(java-mode . java-ts-mode)
|
||||||
(rust-mode . rust-ts-mode)
|
(rust-mode . rust-ts-mode)
|
||||||
(json-mode . json-ts-mode))))
|
(json-mode . json-ts-mode))))
|
||||||
|
|
||||||
;; c-ts-mode
|
;; c-ts-mode
|
||||||
(use-package c-ts-mode
|
(use-package c-ts-mode
|
||||||
|
:after evil
|
||||||
:init
|
:init
|
||||||
(setq-default c-ts-mode-indent-offset 4))
|
(setq-default c-ts-mode-indent-offset 4)
|
||||||
|
:config
|
||||||
|
(evil-define-key 'normal 'c-ts-mode-map
|
||||||
|
"go" #'ff-find-other-file
|
||||||
|
"gO" #'ff-find-other-file-other-window)
|
||||||
|
(evil-define-key 'normal 'c++-ts-mode-map
|
||||||
|
"go" #'ff-find-other-file
|
||||||
|
"gO" #'ff-find-other-file-other-window)
|
||||||
|
(evil-define-key 'normal 'objc-mode-map
|
||||||
|
"go" #'ff-find-other-file
|
||||||
|
"gO" #'ff-find-other-file-other-window))
|
||||||
|
|
||||||
;; recentf
|
;; recentf
|
||||||
(use-package recentf
|
(use-package recentf
|
||||||
@ -383,6 +393,45 @@ visual states."
|
|||||||
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
|
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
|
||||||
(setq eglot-autoshutdown t))
|
(setq eglot-autoshutdown t))
|
||||||
|
|
||||||
|
;; project.el
|
||||||
|
(use-package project
|
||||||
|
:bind (:map project-prefix-map
|
||||||
|
("s" . my/project-vterm))
|
||||||
|
:init
|
||||||
|
(defvar my/project-vterm-hash-table (make-hash-table :test 'equal)
|
||||||
|
"Hash table that maps project root dirs to vterm buffers.")
|
||||||
|
(defun my/project-vterm ()
|
||||||
|
"Switch to or create a vterm buffer in the current projects root."
|
||||||
|
(interactive)
|
||||||
|
(if-let ((proj (project-current t))
|
||||||
|
(default-directory (project-root proj)))
|
||||||
|
(if-let ((vterm-buff (gethash default-directory
|
||||||
|
my/project-vterm-hash-table))
|
||||||
|
((buffer-live-p vterm-buff)))
|
||||||
|
(switch-to-buffer vterm-buff)
|
||||||
|
(puthash default-directory
|
||||||
|
(vterm (concat "*vterm for project " default-directory "*"))
|
||||||
|
my/project-vterm-hash-table))))
|
||||||
|
(defvar my/project-run-command nil
|
||||||
|
"Command to run with `my/project-run'.")
|
||||||
|
(defvar my/-project-run-history '()
|
||||||
|
"Commands previously run with `my/project-run'")
|
||||||
|
(defun my/project-run (command comint)
|
||||||
|
"Like `project-compile', but for running a project.
|
||||||
|
COMMAND and COMINT are like `compile'."
|
||||||
|
(interactive (list (or my/project-run-command
|
||||||
|
(read-shell-command "Run Command: "
|
||||||
|
(car my/-project-run-history)
|
||||||
|
'(my/-project-run-history . 1)))
|
||||||
|
(consp current-prefix-arg)))
|
||||||
|
(let* ((proj (project-current nil))
|
||||||
|
(default-directory (if proj (project-root proj) default-directory))
|
||||||
|
(compilation-buffer-name-function (lambda (_)
|
||||||
|
(progn "*run project*")))
|
||||||
|
(compilation-directory default-directory)
|
||||||
|
(compile-history nil))
|
||||||
|
(compile command comint))))
|
||||||
|
|
||||||
;; rust
|
;; rust
|
||||||
(use-package rust-mode)
|
(use-package rust-mode)
|
||||||
|
|
||||||
@ -567,7 +616,9 @@ visual states."
|
|||||||
dashboard-display-icons-p t
|
dashboard-display-icons-p t
|
||||||
dashboard-icon-type 'nerd-icons
|
dashboard-icon-type 'nerd-icons
|
||||||
dashboard-set-file-icons t
|
dashboard-set-file-icons t
|
||||||
|
dashboard-projects-backend 'project-el
|
||||||
dashboard-items '((recents . 5)
|
dashboard-items '((recents . 5)
|
||||||
|
(projects . 5)
|
||||||
(bookmarks . 5))))
|
(bookmarks . 5))))
|
||||||
|
|
||||||
;;; init.el ends here
|
;;; init.el ends here
|
||||||
|
Loading…
Reference in New Issue
Block a user