From c14578a6d2720fc7f8eae10d91e1a881bf2fd471 Mon Sep 17 00:00:00 2001 From: James Dixon Date: Thu, 20 Mar 2025 10:24:06 -0400 Subject: [PATCH] More helpful packages (and vterm) --- .gitignore | 4 +- config/emacs/.config/emacs/init.el | 118 +++++++++++++++++++++++++++-- 2 files changed, 113 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index c117777..9559b41 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ config/helix/.config/helix/runtime history places recentf -tree-sitter \ No newline at end of file +tree-sitter +projects +tramp \ No newline at end of file diff --git a/config/emacs/.config/emacs/init.el b/config/emacs/.config/emacs/init.el index fad0dfa..c2b197c 100644 --- a/config/emacs/.config/emacs/init.el +++ b/config/emacs/.config/emacs/init.el @@ -143,7 +143,6 @@ (define-key global-map (kbd "M-p") 'previous-multiframe-window) (define-key global-map (kbd "M-n") 'other-window) - ;; Package Manager ;; bootstrap straight.el package manager (defvar bootstrap-version) @@ -162,6 +161,13 @@ (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) +;; add paths from shell by default +(unless (package-installed-p 'exec-path-from-shell) + (package-install 'exec-path-from-shell)) + +(when (memq window-system '(mac ns x)) + (exec-path-from-shell-initialize)) + ;; start evil (unless (package-installed-p 'evil) (package-install 'evil)) @@ -195,6 +201,12 @@ :init (setq markdown-command "multimarkdown") :bind (:map markdown-mode-map ("C-c C-e" . markdown-do))) + +;; emmet - html abberviations +(use-package emmet-mode + :straight t + :init) + ;; end writing (use-package dired @@ -211,15 +223,18 @@ (vertico-mode)) (use-package orderless - ;; Vertico leverages Orderless' flexible matching capabilities, allowing users - ;; to input multiple patterns separated by spaces, which Orderless then - ;; matches in any order against the candidates. :straight t :custom (completion-styles '(orderless basic)) (completion-category-defaults nil) (completion-category-overrides '((file (styles partial-completion))))) +(use-package marginalia + :straight t + :defer t + :commands (marginalia-mode marginalia-cycle) + :hook (after-init . marginalia-mode)) + (use-package embark :straight t :defer t @@ -244,9 +259,91 @@ nil (window-parameters (mode-line-format . none))))) -(use-package emmet-mode - :straight t - :init) +(use-package embark-consult + :ensure t + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + +(use-package consult + :ensure t + :bind (;; C-c bindings in `mode-specific-map' + ("C-c M-x" . consult-mode-command) + ("C-c h" . consult-history) + ("C-c k" . consult-kmacro) + ("C-c m" . consult-man) + ("C-c i" . consult-info) + ([remap Info-search] . consult-info) + ;; C-x bindings in `ctl-x-map' + ("C-x M-:" . consult-complex-command) + ("C-x b" . consult-buffer) + ("C-x 4 b" . consult-buffer-other-window) + ("C-x 5 b" . consult-buffer-other-frame) + ("C-x t b" . consult-buffer-other-tab) + ("C-x r b" . consult-bookmark) + ("C-x p b" . consult-project-buffer) + ;; Custom M-# bindings for fast register access + ("M-#" . consult-register-load) + ("M-'" . consult-register-store) + ("C-M-#" . consult-register) + ;; Other custom bindings + ("M-y" . consult-yank-pop) + ;; M-g bindings in `goto-map' + ("M-g e" . consult-compile-error) + ("M-g f" . consult-flymake) + ("M-g g" . consult-goto-line) + ("M-g M-g" . consult-goto-line) + ("M-g o" . consult-outline) + ("M-g m" . consult-mark) + ("M-g k" . consult-global-mark) + ("M-g i" . consult-imenu) + ("M-g I" . consult-imenu-multi) + ;; M-s bindings in `search-map' + ("M-s d" . consult-find) + ("M-s c" . consult-locate) + ("M-s g" . consult-grep) + ("M-s G" . consult-git-grep) + ("M-s r" . consult-ripgrep) + ("M-s l" . consult-line) + ("M-s L" . consult-line-multi) + ("M-s k" . consult-keep-lines) + ("M-s u" . consult-focus-lines) + ;; Isearch integration + ("M-s e" . consult-isearch-history) + :map isearch-mode-map + ("M-e" . consult-isearch-history) + ("M-s e" . consult-isearch-history) + ("M-s l" . consult-line) + ("M-s L" . consult-line-multi) + ;; Minibuffer history + :map minibuffer-local-map + ("M-s" . consult-history) + ("M-r" . consult-history)) + + ;; Enable automatic preview at point in the *Completions* buffer. + :hook (completion-list-mode . consult-preview-at-point-mode) + + :init + ;; Optionally configure the register formatting. This improves the register + (setq register-preview-delay 0.5 + register-preview-function #'consult-register-format) + + ;; Optionally tweak the register preview window. + (advice-add #'register-preview :override #'consult-register-window) + + ;; Use Consult to select xref locations with preview + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) + + :config + (consult-customize + consult-theme :preview-key '(:debounce 0.2 any) + consult-ripgrep consult-git-grep consult-grep + consult-bookmark consult-recent-file consult-xref + consult--source-bookmark consult--source-file-register + consult--source-recent-file consult--source-project-recent-file + ;; :preview-key "M-." + :preview-key '(:debounce 0.4 any)) + (setq consult-narrow-key "<")) (use-package multiple-cursors :straight t) @@ -303,6 +400,11 @@ (setq treesit-auto-install 'prompt) (setq treesit-auto-langs '(python rust go)) +;; vterm terminal emulator +(use-package vterm + :commands vterm + :straight t) + ;;; Go Support (unless (package-installed-p 'go-mode) (package-install 'go-mode)) @@ -327,13 +429,13 @@ (unless (package-installed-p 'json-mode) (package-install 'json-mode)) - (setq-default major-mode (lambda () ; guess major mode from file name (unless buffer-file-name (let ((buffer-file-name (buffer-name))) (set-auto-mode))))) + (setq confirm-kill-emacs #'yes-or-no-p) (defalias 'yes-or-no #'y-or-n-p)