More use-package
This commit is contained in:
@@ -931,6 +931,13 @@ These are just some general settings that apply everywhere. First, a few package
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
#+begin_src elisp
|
||||
(use-package emacs
|
||||
:bind (:map minibuffer-local-map
|
||||
("M-s" . consult-history)
|
||||
("M-r" . consult-history)))
|
||||
#+end_src
|
||||
|
||||
Turn off some default settings that I don't find useful.
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
@@ -1193,6 +1200,24 @@ Make compilation mode buffers auto-scroll to the first error:
|
||||
(setopt compilation-scroll-output 'first-error)
|
||||
#+END_SRC
|
||||
|
||||
#+begin_src elisp
|
||||
(use-package isearch
|
||||
:bind (: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)))
|
||||
#+end_src
|
||||
|
||||
#+begin_src elisp
|
||||
(use-package register
|
||||
:defer t
|
||||
:custom
|
||||
(register-preview-delay 0.5)
|
||||
:config
|
||||
(advice-add 'register-preview :override #'consult-register-window))
|
||||
#+end_src
|
||||
|
||||
*** Window Placement
|
||||
This section contains rules about where ~display-buffer~ should place windows. I guess I'm currently
|
||||
going for an IDE-style layout, with one main editor window, and auxiliary bottom and right side
|
||||
@@ -1565,10 +1590,8 @@ Some auto-formatting stuff
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(buffer-terminator-mode 1)
|
||||
|
||||
(bind-keys
|
||||
("s-b" . consult-project-buffer))
|
||||
(use-package buffer-terminator
|
||||
:hook after-init)
|
||||
#+END_SRC
|
||||
|
||||
** Language Support
|
||||
@@ -1641,13 +1664,18 @@ Some auto-formatting stuff
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(electric-pair-mode 1)
|
||||
(use-package electric-pair
|
||||
:hook after-init)
|
||||
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq-default tab-width 4)
|
||||
(global-tree-sitter-mode 1)
|
||||
|
||||
(setopt ediff-split-window-function 'split-window-horizontally)
|
||||
(use-package tree-sitter
|
||||
:hook (after-init . global-tree-sitter-mode))
|
||||
|
||||
(use-package ediff-wind
|
||||
:custom
|
||||
(ediff-split-window-function 'split-window-horizontally))
|
||||
|
||||
(defun project-nix-flake ()
|
||||
(interactive)
|
||||
@@ -1661,9 +1689,9 @@ is about the max you can have and still fit two files side-by-side on the screen
|
||||
#+begin_src elisp
|
||||
(setq-default fill-column 120)
|
||||
|
||||
(defun jf-init-fill-column ()
|
||||
(display-fill-column-indicator-mode 1))
|
||||
(add-hook 'prog-mode-hook 'jf-init-fill-column)
|
||||
(use-package display-fill-column-indicator
|
||||
:hook prog-mode)
|
||||
|
||||
#+end_src
|
||||
|
||||
I had some weird problems with jsx code where the default M-q would just do a text fill rather than
|
||||
@@ -1671,7 +1699,12 @@ a re-indent. The solution seems to be to only do the ~syntax-ppss~ stuff if tree
|
||||
available? It seems to work for now anyway...
|
||||
|
||||
#+begin_src elisp
|
||||
(with-eval-after-load 'prog-mode
|
||||
(use-package prog-mode
|
||||
:bind (:map prog-mode-map
|
||||
("C-c D" . flymake-show-project-diagnostics)
|
||||
("M-n" . flymake-goto-next-error)
|
||||
("M-p" . flymake-goto-prev-error))
|
||||
:config
|
||||
(defun my-prog-fill-reindent-defun (&optional argument)
|
||||
"Refill or reindent the paragraph or defun that contains point.
|
||||
|
||||
@@ -1700,24 +1733,23 @@ available? It seems to work for now anyway...
|
||||
#+end_src
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
|
||||
(use-package ansi-color
|
||||
:hook (compilation-filter . ansi-color-compilation-filter))
|
||||
#+END_SRC
|
||||
|
||||
#+begin_src elisp
|
||||
(use-package xref
|
||||
:custom
|
||||
(xref-show-xrefs-function 'consult-xref)
|
||||
(xref-show-definitions-function 'consult-xref))
|
||||
#+end_src
|
||||
|
||||
*** Flymake
|
||||
#+begin_src elisp
|
||||
(autoload 'flymake-show-project-diagnostics "flymake")
|
||||
(autoload 'flymake-goto-next-error "flymake")
|
||||
(autoload 'flymake-goto-prev-error "flymake")
|
||||
|
||||
(with-eval-after-load 'prog-mode
|
||||
(bind-keys :map prog-mode-map
|
||||
("C-c D" . flymake-show-project-diagnostics)
|
||||
("M-n" . flymake-goto-next-error)
|
||||
("M-p" . flymake-goto-prev-error)))
|
||||
|
||||
(with-eval-after-load 'flymake
|
||||
(bind-keys :map flymake-project-diagnostics-mode-map
|
||||
("q" . quit-window)))
|
||||
(use-package flymake
|
||||
:commands (flymake-show-project-diagnostics flymake-goto-next-error flymake-goto-prev-error)
|
||||
:bind (:map flymake-project-diagnostics-mode-map
|
||||
("q" . quit-window)))
|
||||
#+end_src
|
||||
|
||||
*** Eglot
|
||||
@@ -1892,12 +1924,16 @@ for completion. That makes it really annoying to use; don't use yasnippet with e
|
||||
|
||||
*** SQL
|
||||
#+BEGIN_SRC elisp
|
||||
(add-hook 'sql-mode-hook 'sqlind-minor-mode)
|
||||
(use-package sql-indent
|
||||
:hook (sql-mode . sqlind-minor-mode))
|
||||
#+END_SRC
|
||||
|
||||
*** Haskell
|
||||
#+BEGIN_SRC elisp
|
||||
(setopt haskell-ts-use-indent t)
|
||||
(use-package haskell-ts-mode
|
||||
:mode "\\.hs\\'"
|
||||
:custom
|
||||
(haskell-ts-use-indent t))
|
||||
#+END_SRC
|
||||
|
||||
** Envrc
|
||||
@@ -1912,8 +1948,10 @@ for completion. That makes it really annoying to use; don't use yasnippet with e
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(add-hook 'after-init-hook 'envrc-global-mode)
|
||||
(setopt envrc-show-summary-in-minibuffer nil)
|
||||
(use-package envrc
|
||||
:hook (after-init . envrc-global-mode)
|
||||
:custom
|
||||
(envrc-show-summary-in-minibuffer nil))
|
||||
#+END_SRC
|
||||
|
||||
** Magit
|
||||
@@ -1932,26 +1970,30 @@ for completion. That makes it really annoying to use; don't use yasnippet with e
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(setopt magit-define-global-key-bindings 'recommended)
|
||||
(bind-keys ("s-g" . magit))
|
||||
|
||||
(setopt magit-save-repository-buffers 'dontask)
|
||||
(setopt magit-commit-show-diff nil)
|
||||
(with-eval-after-load 'magit
|
||||
(use-package magit
|
||||
:bind (("s-g" . magit-status)
|
||||
("C-x g" . magit-status)
|
||||
("C-c f" . magit-file-dispatch))
|
||||
:custom
|
||||
(magit-save-repository-buffers 'dontask)
|
||||
(magit-commit-show-diff nil)
|
||||
:config
|
||||
(set-face-attribute 'git-commit-summary nil :inherit nil)
|
||||
(defun magit-fetch-all-on-load ()
|
||||
(magit-run-git-async "fetch" "--all"))
|
||||
(add-hook 'magit-status-mode-hook 'magit-fetch-all-on-load)
|
||||
(remove-hook 'magit-status-headers-hook 'magit-insert-tags-header)
|
||||
(require 'forge)
|
||||
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh))
|
||||
(remove-hook 'magit-status-headers-hook 'magit-insert-tags-header))
|
||||
|
||||
(with-eval-after-load 'forge
|
||||
(use-package forge
|
||||
:after magit
|
||||
:config
|
||||
(add-hook 'forge-edit-post-hook 'forge-create-pullreq-insert-single-commit-message)
|
||||
(setopt forge-status-buffer-default-topic-filters
|
||||
(forge--topics-spec :type 'topic :active nil :state 'open :order 'newest)))
|
||||
|
||||
(global-diff-hl-mode)
|
||||
(use-package diff-hl
|
||||
:hook ((after-init . global-diff-hl-mode)
|
||||
(magit-post-refresh . diff-hl-magit-post-refresh)))
|
||||
#+END_SRC
|
||||
|
||||
** Vertico
|
||||
@@ -1972,58 +2014,44 @@ for completion. That makes it really annoying to use; don't use yasnippet with e
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(bind-keys
|
||||
;; ("C-c M-x" . consult-mode-command)
|
||||
("C-c h" . consult-history)
|
||||
;; ("C-c k" . consult-kmacro)
|
||||
;; ("C-c m" . consult-man)
|
||||
;; ([remap Info-search] . consult-info)
|
||||
(use-package consult
|
||||
:bind
|
||||
(;; ("C-c M-x" . consult-mode-command)
|
||||
("s-b" . consult-project-buffer)
|
||||
("C-c h" . consult-history)
|
||||
;; ("C-c k" . consult-kmacro)
|
||||
;; ("C-c m" . consult-man)
|
||||
;; ([remap Info-search] . consult-info)
|
||||
|
||||
;; ("C-x M-:" . consult-complex-command)
|
||||
("C-x b" . consult-buffer)
|
||||
("s-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)
|
||||
;; ("C-x M-:" . consult-complex-command)
|
||||
("C-x b" . consult-buffer)
|
||||
("s-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)
|
||||
|
||||
("M-#" . consult-register-load)
|
||||
("M-'" . consult-register-store)
|
||||
("C-M-#" . consult-register)
|
||||
("M-y" . consult-yank-pop)
|
||||
("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-org-heading)
|
||||
("M-g m" . consult-mark)
|
||||
("M-g k" . consult-global-mark)
|
||||
("M-g i" . consult-imenu)
|
||||
("M-g I" . consult-imenu-multi)
|
||||
("M-s r" . consult-ripgrep)
|
||||
("M-s l" . consult-line)
|
||||
("M-s L" . consult-line-multi)
|
||||
("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)
|
||||
:map minibuffer-local-map
|
||||
("M-s" . consult-history)
|
||||
("M-r" . consult-history))
|
||||
|
||||
(advice-add 'register-preview :override #'consult-register-window)
|
||||
(setopt register-preview-delay 0.5)
|
||||
|
||||
(setopt xref-show-xrefs-function 'consult-xref)
|
||||
(setopt xref-show-definitions-function 'consult-xref)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'consult))
|
||||
|
||||
(with-eval-after-load 'consult
|
||||
("M-#" . consult-register-load)
|
||||
("M-'" . consult-register-store)
|
||||
("C-M-#" . consult-register)
|
||||
("M-y" . consult-yank-pop)
|
||||
("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-org-heading)
|
||||
("M-g m" . consult-mark)
|
||||
("M-g k" . consult-global-mark)
|
||||
("M-g i" . consult-imenu)
|
||||
("M-g I" . consult-imenu-multi)
|
||||
("M-s r" . consult-ripgrep)
|
||||
("M-s l" . consult-line)
|
||||
("M-s L" . consult-line-multi)
|
||||
("M-s e" . consult-isearch-history))
|
||||
:custom
|
||||
(consult-narrow-key "<")
|
||||
:config
|
||||
(consult-customize
|
||||
consult-theme :preview-key '(:debounce 0.2 any)
|
||||
consult-ripgrep consult-git-grep consult-grep consult-man
|
||||
@@ -2035,23 +2063,29 @@ for completion. That makes it really annoying to use; don't use yasnippet with e
|
||||
consult-source-project-recent-file
|
||||
:preview-key '(:debounce 0.4 any)))
|
||||
|
||||
(setopt consult-narrow-key "<") ;; "C-+"
|
||||
|
||||
(setopt vertico-count 25)
|
||||
(vertico-mode)
|
||||
(use-package vertico
|
||||
:hook after-init
|
||||
:custom
|
||||
(vertico-count 25))
|
||||
|
||||
(setopt completion-styles '(orderless basic))
|
||||
|
||||
(marginalia-mode)
|
||||
(use-package marginalia
|
||||
:hook after-init)
|
||||
|
||||
(setopt corfu-cycle t)
|
||||
(setopt corfu-popupinfo-mode nil)
|
||||
(setopt corfu-quit-at-boundary nil)
|
||||
(setopt corfu-on-exact-match 'show)
|
||||
(global-corfu-mode)
|
||||
(use-package corfu
|
||||
:hook (after-init . global-corfu-mode)
|
||||
:custom
|
||||
(corfu-cycle t)
|
||||
(corfu-popupinfo-mode nil)
|
||||
(corfu-quit-at-boundary nil)
|
||||
(corfu-on-exact-match 'show))
|
||||
;; (setq completion-in-region-function #'consult-completion-in-region)
|
||||
|
||||
(add-hook 'completion-at-point-functions 'cape-file)
|
||||
(use-package cape
|
||||
:defer t
|
||||
:init
|
||||
(add-hook 'completion-at-point-functions 'cape-file))
|
||||
#+END_SRC
|
||||
|
||||
** Org
|
||||
@@ -2124,7 +2158,7 @@ for completion. That makes it really annoying to use; don't use yasnippet with e
|
||||
;; (org-roam-db-autosync-mode)
|
||||
|
||||
(use-package org-modern
|
||||
:hook org-mode-hook)
|
||||
:hook org-mode)
|
||||
|
||||
;; (define-key org-mode-map (kbd "C-c C-r") verb-command-map)
|
||||
#+END_SRC
|
||||
@@ -2138,6 +2172,7 @@ text bigger.
|
||||
|
||||
#+begin_src elisp
|
||||
(use-package org-present
|
||||
:commands (org-present)
|
||||
:config
|
||||
(require 'face-remap)
|
||||
(require 'visual-fill-column)
|
||||
@@ -2163,7 +2198,7 @@ factor. We'll use ~face-remap~ for that. When ~face-remap~ changes a face, it re
|
||||
|
||||
When we enter present mode, we'll enlarge the fonts.
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-start
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-start
|
||||
(setq-local my/org-present-face-remapping-cookies nil)
|
||||
(dolist (face '((default :height 2.0)
|
||||
(header-line :height 4.0 :background "#303446")
|
||||
@@ -2185,20 +2220,20 @@ When we enter present mode, we'll enlarge the fonts.
|
||||
|
||||
And when we leave, we'll restore the old faces.
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-end
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-end
|
||||
(dolist (cookie my/org-present-face-remapping-cookies)
|
||||
(face-remap-remove-relative cookie))
|
||||
#+end_src
|
||||
|
||||
Let's add some empty space at the top as a margin. This is kind of a hack, but :shrug:.
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-start
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-start
|
||||
(setq header-line-format " ")
|
||||
#+end_src
|
||||
|
||||
And we'll clean it up when we're done.
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-end
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-end
|
||||
(setq header-line-format nil)
|
||||
#+end_src
|
||||
|
||||
@@ -2210,36 +2245,36 @@ To make this look more like a "real" presentation, we want to center the text in
|
||||
|
||||
Let's set it up when we enter present mode:
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-start
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-start
|
||||
(visual-fill-column-mode 1)
|
||||
(setq visual-fill-column-center-text t)
|
||||
#+end_src
|
||||
|
||||
And tear it down when we're done:
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-end
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-end
|
||||
(visual-fill-column-mode 0)
|
||||
#+end_src
|
||||
|
||||
We want to display inline images, of course.
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-start
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-start
|
||||
(org-display-inline-images)
|
||||
#+end_src
|
||||
|
||||
And stop when we're done.
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-end
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-end
|
||||
(org-remove-inline-images)
|
||||
#+end_src
|
||||
|
||||
And finally, we want to hide the cursor when presenting.
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-start
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-start
|
||||
(org-present-hide-cursor)
|
||||
#+end_src
|
||||
|
||||
#+begin_src elisp :noweb-ref emacs-org-present-end
|
||||
#+begin_src elisp :tangle nil :noweb-ref emacs-org-present-end
|
||||
(org-present-show-cursor)
|
||||
#+end_src
|
||||
|
||||
|
||||
Reference in New Issue
Block a user