Emacs: added clang-format, consult-dir, enlight, and grid packages

This commit is contained in:
Andrew Scott 2024-08-26 16:43:30 -04:00
parent 494df18481
commit 37261c156c
Signed by: a
GPG key ID: 7CD5A5977E4931C1

View file

@ -128,6 +128,9 @@
;; Customize compilation & related buffers ;; Customize compilation & related buffers
(use-feature compile (use-feature compile
:bind
(:map prog-mode-map
("C-c r" . recompile))
:commands (compile recompile) :commands (compile recompile)
:config (setopt compilation-ask-about-save nil :config (setopt compilation-ask-about-save nil
compilation-scroll-output 'first-error)) compilation-scroll-output 'first-error))
@ -288,20 +291,20 @@
:config :config
(setopt recentf-max-menu-items 100 (setopt recentf-max-menu-items 100
recentf-max-saved-items 1000 recentf-max-saved-items 1000
recentf-save-file (concat xdg_cache_home "recentf")) recentf-save-file (expand-file-name "recentf" xdg_cache_home))
(recentf-mode)) (recentf-mode))
;; Customize saving mini-buffer history ;; Customize saving mini-buffer history
(use-feature savehist (use-feature savehist
:config :config
(setopt savehist-autosave-interval 120 (setopt savehist-autosave-interval 120
savehist-file (concat xdg_cache_home "history")) savehist-file (expand-file-name "history" xdg_cache_home))
(savehist-mode)) (savehist-mode))
;; Customize saving place in files ;; Customize saving place in files
(use-feature saveplace (use-feature saveplace
:config :config
(setopt save-place-file (concat xdg_cache_home "places")) (setopt save-place-file (expand-file-name "places" xdg_cache_home))
(save-place-mode)) (save-place-mode))
;; Unload `seq' before `Elpaca' starts building ;; Unload `seq' before `Elpaca' starts building
@ -378,6 +381,13 @@
(catppuccin-reload) (catppuccin-reload)
(load-theme 'catppuccin t)) (load-theme 'catppuccin t))
;; C/C++ formatting
;; Ad hoc format file: clang-format -style=webkit -dump-config > .clang-format
(use-package clang-format
:commands (clang-format clang-format-buffer clang-format-region)
:config (setopt clang-format-fallback-style "webkit"
clang-format-style "file"))
;; Search and navigation ;; Search and navigation
(use-package consult (use-package consult
:bind (;; C-c bindings in `mode-specific-map' :bind (;; C-c bindings in `mode-specific-map'
@ -431,7 +441,12 @@
;; Minibuffer history ;; Minibuffer history
:map minibuffer-local-map :map minibuffer-local-map
("M-s" . consult-history) ; orig. next-matching-history-element ("M-s" . consult-history) ; orig. next-matching-history-element
("M-r" . consult-history)) ; orig. previous-matching-history-element ("M-r" . consult-history)
:map as/org-prefix-map ; orig. previous-matching-history-element
("h" . consult-org-heading)
("a" . consult-org-agenda))
:config
(setopt consult-narrow-key "<")
:init :init
;; Register formatting ;; Register formatting
(setopt register-preview-delay 0.6 (setopt register-preview-delay 0.6
@ -442,6 +457,13 @@
(setopt xref-show-xrefs-function #'consult-xref (setopt xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)) xref-show-definitions-function #'consult-xref))
(use-package consult-dir
:after (consult)
:bind (("C-x C-d" . consult-dir)
:map vertico-map
("C-x C-d" . consult-dir)
("C-x C-j" . consult-dir-jump-file)))
;; UI for the workspace/symbols procedure calls ;; UI for the workspace/symbols procedure calls
(use-package consult-eglot (use-package consult-eglot
:after (eglot) :after (eglot)
@ -502,6 +524,46 @@
(use-package embark-consult (use-package embark-consult
:hook (embark-collect-mode . consult-preview-at-point-mode)) :hook (embark-collect-mode . consult-preview-at-point-mode))
;; Startup screen
(use-package enlight
:after (grid)
:config
(setopt
enlight-content
(grid-get-row
`(,(enlight-menu
'(("Files"
("Find File" find-file "f")
("Recent Files" consult-recent-file "r")
("Projects" project-switch-project "p")
("Open Project Buffer" consult-project-buffer "o"))))
" "
,(enlight-menu
'(("Org"
("Agenda" (org-agenda nil "a") "a")
("Time blocking" org-timeblock "b")
("List all TODOs" (org-agenda nil "t") "t")
("Match Tags" (org-agenda nil "m") "m"))))
" "
,(enlight-menu
`(("Settings"
("Elpaca" elpaca-manager "L")
("Emacs"
(progn
(find-file ,user-init-file))
"I")
("Enlight"
(progn
(find-file ,user-init-file)
(goto-char (point-min))
(search-forward "use-package enlight"))
"E")
("Org"
(progn
(find-file ,(replace-regexp-in-string "init.el" "lisp/init-org.el" user-init-file)))
"O")))))))
(enlight-open))
;; Correction functions for `flyspell' ;; Correction functions for `flyspell'
(use-package flyspell-correct (use-package flyspell-correct
:after (flyspell) :after (flyspell)
@ -509,6 +571,10 @@
(:map flyspell-mode-map (:map flyspell-mode-map
("C-M-." . flyspell-correct-wrapper))) ("C-M-." . flyspell-correct-wrapper)))
;; Grid for `enlight'
(use-package grid
:ensure (:host github :repo "ichernyshovvv/grid.el"))
;; Highlight keywords ;; Highlight keywords
(use-package hl-todo (use-package hl-todo
:bind :bind
@ -544,7 +610,7 @@
:bind ("C-M-;" . magit-status) :bind ("C-M-;" . magit-status)
:config :config
(setopt magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1 (setopt magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1
transient-history-file (concat xdg_cache_home "transient-history"))) transient-history-file (expand-file-name "transient-history" xdg_cache_home)))
(use-package magit-todos (use-package magit-todos
:hook (magit-mode . magit-todos-mode)) :hook (magit-mode . magit-todos-mode))
@ -611,7 +677,7 @@
:disabled :disabled
:bind ("C-c p" . projectile-command-map) :bind ("C-c p" . projectile-command-map)
:config :config
(setopt projectile-known-projects-file (concat xdg_cache_home "projectile-bookmarks") (setopt projectile-known-projects-file (expand-file-name "projectile-bookmarks" xdg_cache_home)
projectile-project-search-path '(("~/Nextcloud/Projects/src/" . 2))) projectile-project-search-path '(("~/Nextcloud/Projects/src/" . 2)))
(push "*node_modules" projectile-globally-ignored-directories) (push "*node_modules" projectile-globally-ignored-directories)
(projectile-mode)) (projectile-mode))