;;When installing a package used in the init file itself, ;;e.g. a package which adds a use-package key word, ;;use the :wait recipe keyword to block until that package is installed/configured. ;;For example: ;;(use-package general :ensure (:wait t) :demand t) ;; Expands to: (elpaca evil (use-package evil :demand t)) (use-package evil :ensure t :init (setq evil-want-integration t) (setq evil-want-keybinding nil) (setq evil-want-C-u-scroll t) :config (evil-mode)) (use-package evil-collection :ensure t :after evil :custom (evil-collection-outline-bind-tab-p t) (evil-collection-setup-minibuffer t) :init (evil-collection-init)) (use-package evil-goggles :ensure t :config (evil-goggles-mode)) (use-package evil-surround :ensure t :config (global-evil-surround-mode)) (use-package evil-commentary :ensure t :config (evil-commentary-mode) ;; optionally use diff-mode's faces; as a result, deleted text ;; will be highlighed with `diff-removed` face which is typically ;; some red color (as defined by the color theme) ;; other faces such as `diff-added` will be used for other actions (evil-goggles-use-diff-faces)) (use-package evil-org :ensure t :after org :hook (org-mode . (lambda () evil-org-mode)) :config (require 'evil-org-agenda) (evil-org-agenda-set-keys)) (use-package general :ensure t :config ;; Create a leader-key definer (SPC in normal/visual, M-SPC elsewhere) (general-create-definer leader! :keymaps '(normal insert visual emacs) :prefix "SPC" :global-prefix "M-SPC") (general-define-key "C-s" #'write-file) (general-define-key :states 'normal :keymaps 'lsp-mode-map "K" #'lsp-ui-doc-glance) ;; Named prefix groups (leader! "SPC" '(project-find-file :which-key "find project files") "f" '(:ignore t :which-key "files") "ff" '(find-file :which-key "find file") "fs" '(save-buffer :which-key "save") "fr" '(recentf-open :which-key "recent files") "e" '(dired-jump :which-key "dired") "b" '(:ignore t :which-key "buffers") "bb" '(switch-to-buffer :which-key "switch buffer") "bd" '(evil-delete-buffer :which-key "delete buffer") "c" '(:ignore t :which-key "code") "ca" '(lsp-execute-code-action :which-key "code action") "cd" '(lsp-find-definition :which-key "definition") "cr" '(lsp-rename :which-key "rename") "cf" '(apheleia-format-buffer :which-key "format") ;; useful extras while you're at it "p" '(:ignore t :which-key "project") "pp" '(project-switch-project :which-key "switch project") "pb" '(project-switch-to-buffer :which-key "project buffers") "pk" '(project-kill-buffers :which-key "kill project buffers"))) ;; Theming (use-package catppuccin-theme :ensure t :config (load-theme 'catppuccin :no-confirm)) (set-frame-font "JetBrainsMono NFM 16" nil t) ;; Minibuffer (use-package vertico :custom (vertico-scroll-margin 0) ;; Different scroll margin (vertico-count 20) ;; Show more candidates (vertico-resize t) ;; Grow and shrink the Vertico minibuffer (vertico-cycle t) ;; Enable cycling for `vertico-next/previous' :init (vertico-mode)) ;; Persist history over Emacs restarts. Vertico sorts by history position. (use-package savehist :ensure nil :init (savehist-mode)) ;; Emacs minibuffer configurations. (use-package emacs :ensure nil :custom ;; Enable context menu. `vertico-multiform-mode' adds a menu in the minibuffer ;; to switch display modes. (context-menu-mode t) ;; Support opening new minibuffers from inside existing minibuffers. (enable-recursive-minibuffers t) ;; Hide commands in M-x which do not work in the current mode. Vertico ;; commands are hidden in normal buffers. This setting is useful beyond ;; Vertico. (read-extended-command-predicate #'command-completion-default-include-p) ;; Do not allow the cursor in the minibuffer prompt (minibuffer-prompt-properties '(read-only t cursor-intangible t face minibuffer-prompt))) ;; `orderless' completion style. (use-package orderless :custom ;; Configure a custom style dispatcher (see the Consult wiki) ;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)) ;; (orderless-component-separator #'orderless-escapable-split-on-space) (completion-styles '(orderless basic)) (completion-category-overrides '((file (styles partial-completion)))) (completion-category-defaults nil) ;; Disable defaults, use our settings (completion-pcm-leading-wildcard t)) ;; Emacs 31: partial-completion behaves like substring;; LSP & Treesitter ;; ######### ;; LSP Stuff ;; ######### (use-package treesit-auto :ensure t :custom (treesit-auto-install 'prompt) :config (global-treesit-auto-mode)) (use-package lsp-mode :ensure t :init (setq lsp-keymap-prefix "C-c l") :hook ((c-mode . lsp-deferred ) (lsp-mode . lsp-enable-which-key-integration)) :commands (lsp lsp-deferred)) (use-package lsp-ui :ensure t :custom (lsp-ui-doc-enable t) (lsp-ui-doc-position 'at-point) (lsp-ui-sideline-show-diagnostics t) :hook (lsp-mode . lsp-ui-mode)) ;; Completion via corfu (modern, lighter than company) (use-package corfu :ensure t :custom (corfu-auto t) (corfu-auto-delay 0.1) :init (global-corfu-mode)) ;; Diagnostics via flymake (built-in) or flycheck (use-package flycheck :ensure t :hook (lsp-mode . flycheck-mode)) (use-package apheleia :ensure t :config (apheleia-global-mode)) ;; ######### ;; Which-Key ;; ######### (use-package which-key :ensure t :config (which-key-mode)) (use-package smartparens :ensure t :hook (prog-mode . smartparens-mode) :config (require 'smartparens-config)) ; loads language-specific rules (use-package rainbow-delimiters :ensure t :hook (prog-mode . rainbow-delimiters-mode)) (use-package dashboard :ensure t :config (setq dashboard-items '((recents . 5) (bookmarks . 5) (projects . 5) (agenda . 5) (registers . 5))) (add-hook 'elpaca-after-init-hook #'dashboard-insert-startupify-lists) (add-hook 'elpaca-after-init-hook #'dashboard-initialize) (dashboard-setup-startup-hook))