diff --git a/custom.el b/custom.el index ce2356a..1e02394 100644 --- a/custom.el +++ b/custom.el @@ -7,11 +7,12 @@ '(apheleia-log-only-errors nil) '(custom-enabled-themes '(deeper-blue)) '(package-selected-packages - '(apheleia cape dart-mode diminish dotenv-mode dumber-jump evil + '(apheleia cape dart-mode diminish dotenv-mode dumber-jump embark evil evil-collection evil-surround exec-path-from-shell - fish-mode ghostel jai-mode magit mise move-text - multiple-cursors org-roam pgmacs terraform-mode - undo-tree yaml-mode yasnippet yasnippet-snippets)) + fish-mode forge ghostel jai-mode magit marginalia mise + move-text multiple-cursors org-roam pgmacs + terraform-mode undo-tree yaml-mode yasnippet + yasnippet-snippets)) '(package-vc-selected-packages '((pgmacs :url "https://github.com/emarsden/pgmacs.git") (jai-mode :url "https://github.com/valignatev/jai-mode.git")))) diff --git a/init.el b/init.el index 7d69256..705734d 100644 --- a/init.el +++ b/init.el @@ -48,14 +48,19 @@ speedbar-window-default-width 25 speedbar-window-max-width 25 duplicate-line-final-position -1 - duplicate-region-final-position -1) + duplicate-region-final-position -1 + competions-detailed t + auth-sources '("~/.authinfo")) +(require 'project) (setq project-switch-commands '((project-find-file "Find file" "f") (project-find-dir "Find dir" "d") (project-dired "Dired" "D") (project-find-regexp "ripgrep" "g") (magit-project-status "Magit" "m"))) +(define-key project-prefix-map "u" #'hgh/update-projects) + (when (file-directory-p (hgh/emacs-directory "work")) (load-file (hgh/emacs-directory "work/work.el")) (add-to-list 'load-path (hgh/emacs-directory "work"))) @@ -186,6 +191,11 @@ (when (require 'evil nil 'noerror) (evil-global-set-key 'normal (kbd "gg") #'magit-status))) +(use-package forge + :ensure t + :after magit + :custom (forge-add-default-bindings nil)) + (use-package multiple-cursors :custom (mc/always-run-for-all t) @@ -204,21 +214,21 @@ :config (push '(:language "jai" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*::" - :tests ("test ::")) + :supports ("ag" "grep" "rg" "git-grep") + :regex "\\bJJJ\\s*::" + :tests ("test ::")) dumber-jump-find-rules) (push '(:language "jai" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*(:|:\\s*=|::)" - :tests ("test: Type" "test : Type = Val" "test :: Val")) + :supports ("ag" "grep" "rg" "git-grep") + :regex "\\bJJJ\\s*(:|:\\s*=|::)" + :tests ("test: Type" "test : Type = Val" "test :: Val")) dumber-jump-find-rules) (push '(:language "jai" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*::" - :tests ("test ::")) + :supports ("ag" "grep" "rg" "git-grep") + :regex "\\bJJJ\\s*::" + :tests ("test ::")) dumber-jump-find-rules)) (use-package eglot @@ -303,7 +313,7 @@ (let ((formatter (symbol-name (car pair)))) (when (string-prefix-p "prettier" formatter) (setf (alist-get (car pair) apheleia-formatters) - '("npx" "prettier" "--stdin-filepath" filepath))))) + '("npx" "prettier" "--stdin-filepath" filepath))))) (apheleia-global-mode 1)) @@ -313,3 +323,50 @@ (global-mise-mode 1)) (use-package dotenv-mode) + +;; Enable rich annotations using the Marginalia package +(use-package marginalia + ;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding + ;; available in the *Completions* buffer, add it to the + ;; `completion-list-mode-map'. + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + + ;; The :init section is always executed. + :init + + ;; Marginalia must be activated in the :init section of use-package such that + ;; the mode gets enabled right away. Note that this forces loading the + ;; package. + (marginalia-mode -1)) + +(use-package embark + :ensure t + + :bind + (("M-'" . embark-act) ;; pick some comfortable binding + ("C-;" . embark-dwim)) ;; good alternative: M-. + + :init + + ;; Optionally replace the key help with a completing-read interface + ;; Show the Embark target at point via Eldoc. You may adjust the + ;; Eldoc strategy, if you want to see the documentation from + ;; multiple providers. Beware that using this can be a little + ;; jarring since the message shown in the minibuffer can be more + ;; than one line, causing the modeline to move up and down: + + ;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target) + ;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly) + + ;; Add Embark to the mouse context menu. Also enable `context-menu-mode'. + ;; (context-menu-mode 1) + ;; (add-hook 'context-menu-functions #'embark-context-menu 100) + + :config + + ;; Hide the mode line of the Embark live/completions buffers + (add-to-list 'display-buffer-alist + '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" + nil + (window-parameters (mode-line-format . none))))) diff --git a/utils.el b/utils.el index b8b0c79..2e315d0 100644 --- a/utils.el +++ b/utils.el @@ -20,7 +20,14 @@ (defun hgh/update-projects () (interactive) - (dolist (path '("/programming/projects/" "/programming/thirdparty/" "/programming/probe/")) + (dolist (path '("/programming/projects/" + "/programming/projects/worktrees" + "/programming/thirdparty/" + "/programming/probe/")) (let ((projects-root (concat (getenv "HOME") path))) + (make-directory projects-root t) (dolist (dir (directory-files projects-root t "^[^.]")) - (project-current t dir))))) + (when (file-directory-p dir) + (let ((pr (project--find-in-directory dir))) + (when pr (project-remember-project pr))))))) + (message "Project list updated."))