Add consult support to v4
This commit is contained in:
parent
37956c6b8b
commit
b871fabd14
|
@ -85,9 +85,7 @@
|
||||||
expand-region
|
expand-region
|
||||||
eros
|
eros
|
||||||
org
|
org
|
||||||
org-journal
|
|
||||||
org-modern
|
org-modern
|
||||||
org-sidebar
|
|
||||||
org-super-agenda
|
org-super-agenda
|
||||||
org-ql
|
org-ql
|
||||||
ctrlf
|
ctrlf
|
||||||
|
@ -122,7 +120,7 @@
|
||||||
marginalia
|
marginalia
|
||||||
nerd-icons
|
nerd-icons
|
||||||
forge
|
forge
|
||||||
)
|
consult)
|
||||||
|
|
||||||
(provide 'fg42/deps)
|
(provide 'fg42/deps)
|
||||||
;;; deps.el ends here
|
;;; deps.el ends here
|
||||||
|
|
|
@ -34,11 +34,13 @@
|
||||||
|
|
||||||
(require 'fg42/git)
|
(require 'fg42/git)
|
||||||
(require 'fg42/wm)
|
(require 'fg42/wm)
|
||||||
(require 'fg42/org))
|
(require 'fg42/org)
|
||||||
|
(require 'fg42/minibuffer))
|
||||||
|
|
||||||
(require 'server)
|
(require 'server)
|
||||||
(require 'fg42/modeline)
|
(require 'fg42/modeline)
|
||||||
|
|
||||||
|
|
||||||
(defvar fg42/font '("Fira Mono" 12)
|
(defvar fg42/font '("Fira Mono" 12)
|
||||||
"Font name and size to be used with FG42. (Default (\"Fira Mono\" 12).")
|
"Font name and size to be used with FG42. (Default (\"Fira Mono\" 12).")
|
||||||
|
|
||||||
|
@ -128,9 +130,9 @@ contextual information."
|
||||||
:init
|
:init
|
||||||
(setq epa-pinentry-mode 'loopback))
|
(setq epa-pinentry-mode 'loopback))
|
||||||
|
|
||||||
(use! imenu
|
;; (use! imenu
|
||||||
"The Imenu facility offers a way to find the major definitions in a file by name."
|
;; "The Imenu facility offers a way to find the major definitions in a file by name."
|
||||||
:bind (("M-i" . imenu)))
|
;; :bind (("M-i" . imenu)))
|
||||||
|
|
||||||
(use! imenu-list
|
(use! imenu-list
|
||||||
"his Emacs minor-mode creates an automatically updated buffer
|
"his Emacs minor-mode creates an automatically updated buffer
|
||||||
|
@ -163,56 +165,6 @@ contextual information."
|
||||||
"This cube controls the different aspect of buffer navigation"
|
"This cube controls the different aspect of buffer navigation"
|
||||||
:bind ("C-<tab>" . ace-window))
|
:bind ("C-<tab>" . ace-window))
|
||||||
|
|
||||||
|
|
||||||
(use! vertico
|
|
||||||
"Vertico provides a performant and minimalistic vertical completion UI
|
|
||||||
based on the default completion system. The focus of Vertico is to provide
|
|
||||||
a UI which behaves correctly under all circumstances."
|
|
||||||
:config
|
|
||||||
(require 'vertico-multiform)
|
|
||||||
(require 'vertico-flat)
|
|
||||||
(require 'vertico-grid)
|
|
||||||
(require 'vertico-buffer)
|
|
||||||
(require 'vertico-indexed)
|
|
||||||
(require 'vertico-quick)
|
|
||||||
(require 'vertico-repeat)
|
|
||||||
(vertico-mode)
|
|
||||||
(vertico-multiform-mode)
|
|
||||||
;; Configure the display per command.
|
|
||||||
;; Use a buffer with indices for imenu
|
|
||||||
(setq vertico-multiform-commands
|
|
||||||
'((imenu buffer indexed)))
|
|
||||||
|
|
||||||
;; Configure the display per completion category.
|
|
||||||
;; Use the grid display for files and a buffer
|
|
||||||
;; for the consult-grep commands.
|
|
||||||
(setq vertico-multiform-categories
|
|
||||||
'((file grid)))
|
|
||||||
|
|
||||||
(setq vertico-count 10)
|
|
||||||
(setq vertico-cycle t)
|
|
||||||
|
|
||||||
(when-wm
|
|
||||||
(setq vertico-multiform-commands
|
|
||||||
'((t flat)))
|
|
||||||
(setq vertico-multiform-categories
|
|
||||||
'((file flat)))))
|
|
||||||
|
|
||||||
|
|
||||||
(use! orderless
|
|
||||||
"This package provides an orderless completion style that divides the
|
|
||||||
pattern into space-separated components, and matches candidates that
|
|
||||||
match all of the components in any order."
|
|
||||||
:init
|
|
||||||
(setq completion-styles '(orderless basic)
|
|
||||||
completion-category-defaults nil
|
|
||||||
completion-category-overrides '((file (styles partial-completion)))))
|
|
||||||
|
|
||||||
(use! marginalia
|
|
||||||
"Adds useful info to minibuffers completions."
|
|
||||||
:commands marginalia-mode
|
|
||||||
:hook (emacs-startup . marginalia-mode))
|
|
||||||
|
|
||||||
(when-not-wm
|
(when-not-wm
|
||||||
|
|
||||||
(use! flyspell
|
(use! flyspell
|
||||||
|
@ -229,12 +181,6 @@ match all of the components in any order."
|
||||||
:init
|
:init
|
||||||
(savehist-mode))
|
(savehist-mode))
|
||||||
|
|
||||||
;; Minibuffer related stuff
|
|
||||||
(use! ctrlf
|
|
||||||
"Single buffer text search."
|
|
||||||
:config
|
|
||||||
(ctrlf-mode +1))
|
|
||||||
|
|
||||||
(use! display-line-numbers
|
(use! display-line-numbers
|
||||||
"The builtin replacement of linum. It's is pretty fast."
|
"The builtin replacement of linum. It's is pretty fast."
|
||||||
:config
|
:config
|
||||||
|
|
|
@ -0,0 +1,200 @@
|
||||||
|
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;;
|
||||||
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;; URL: https://devheroes.codes/FG42/FG42
|
||||||
|
;; Version: 4.0.0
|
||||||
|
;;
|
||||||
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
;;
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
(eval-when-compile
|
||||||
|
(require 'fpkg))
|
||||||
|
|
||||||
|
(use! vertico
|
||||||
|
"Vertico provides a performant and minimalistic vertical completion UI
|
||||||
|
based on the default completion system. The focus of Vertico is to provide
|
||||||
|
a UI which behaves correctly under all circumstances."
|
||||||
|
:config
|
||||||
|
(require 'vertico-multiform)
|
||||||
|
(require 'vertico-flat)
|
||||||
|
(require 'vertico-grid)
|
||||||
|
(require 'vertico-buffer)
|
||||||
|
(require 'vertico-indexed)
|
||||||
|
(require 'vertico-quick)
|
||||||
|
(require 'vertico-repeat)
|
||||||
|
(vertico-mode)
|
||||||
|
(vertico-multiform-mode)
|
||||||
|
;; Configure the display per command.
|
||||||
|
;; Use a buffer with indices for imenu
|
||||||
|
(setq vertico-multiform-commands
|
||||||
|
'((imenu buffer indexed)))
|
||||||
|
|
||||||
|
;; Configure the display per completion category.
|
||||||
|
;; Use the grid display for files and a buffer
|
||||||
|
;; for the consult-grep commands.
|
||||||
|
(setq vertico-multiform-categories
|
||||||
|
'((file grid)))
|
||||||
|
|
||||||
|
(setq vertico-count 10)
|
||||||
|
(setq vertico-cycle t)
|
||||||
|
|
||||||
|
(when-wm
|
||||||
|
(setq vertico-multiform-commands
|
||||||
|
'((t flat)))
|
||||||
|
(setq vertico-multiform-categories
|
||||||
|
'((file flat)))))
|
||||||
|
|
||||||
|
|
||||||
|
(use! orderless
|
||||||
|
"This package provides an orderless completion style that divides the
|
||||||
|
pattern into space-separated components, and matches candidates that
|
||||||
|
match all of the components in any order."
|
||||||
|
:init
|
||||||
|
(setq completion-styles '(orderless basic)
|
||||||
|
completion-category-defaults nil
|
||||||
|
completion-category-overrides '((file (styles partial-completion)))))
|
||||||
|
|
||||||
|
(use! marginalia
|
||||||
|
"Adds useful info to minibuffers completions."
|
||||||
|
:commands marginalia-mode
|
||||||
|
:hook (emacs-startup . marginalia-mode))
|
||||||
|
|
||||||
|
|
||||||
|
(when-not-wm
|
||||||
|
(use! ctrlf
|
||||||
|
"Single buffer text search."
|
||||||
|
:config
|
||||||
|
(ctrlf-mode +1)))
|
||||||
|
|
||||||
|
|
||||||
|
(use! consult
|
||||||
|
"Consult provides search and navigation commands based on the Emacs completion
|
||||||
|
function completing-read. "
|
||||||
|
;; C-c bindings in `mode-specific-map'
|
||||||
|
:bind (("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) ;; orig. repeat-complex-command
|
||||||
|
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
|
||||||
|
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
|
||||||
|
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
|
||||||
|
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
|
||||||
|
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
|
||||||
|
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
|
||||||
|
;; Custom M-# bindings for fast register access
|
||||||
|
("M-#" . consult-register-load)
|
||||||
|
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
|
||||||
|
("C-M-#" . consult-register)
|
||||||
|
;; Other custom bindings
|
||||||
|
("M-y" . consult-yank-pop) ;; orig. yank-pop
|
||||||
|
;; M-g bindings in `goto-map'
|
||||||
|
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
|
||||||
|
("M-g g" . consult-goto-line)
|
||||||
|
("M-g M-g" . consult-goto-line)
|
||||||
|
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
|
||||||
|
("M-g m" . consult-mark)
|
||||||
|
("M-g k" . consult-global-mark)
|
||||||
|
;; M-s bindings in `search-map'
|
||||||
|
("M-s d" . consult-fd)
|
||||||
|
("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) ;; orig. isearch-edit-string
|
||||||
|
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
|
||||||
|
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
|
||||||
|
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
|
||||||
|
;; Minibuffer history
|
||||||
|
:map minibuffer-local-map
|
||||||
|
("M-s" . consult-history) ;; orig. next-matching-history-element
|
||||||
|
("M-r" . consult-history)) ;; orig. previous-matching-history-element
|
||||||
|
|
||||||
|
;; Enable automatic preview at point in the *Completions* buffer. This is
|
||||||
|
;; relevant when you use the default completion UI.
|
||||||
|
:hook (completion-list-mode . consult-preview-at-point-mode)
|
||||||
|
|
||||||
|
:init
|
||||||
|
;; Configure the register formatting. This improves the register
|
||||||
|
;; preview for `consult-register', `consult-register-load',
|
||||||
|
;; `consult-register-store' and the Emacs built-ins.
|
||||||
|
(setq register-preview-delay 0.5
|
||||||
|
register-preview-function #'consult-register-format)
|
||||||
|
|
||||||
|
;; Tweak the register preview window.
|
||||||
|
;; This adds thin lines, sorting and hides the mode line of the window.
|
||||||
|
(advice-add #'register-preview :override #'consult-register-window)
|
||||||
|
|
||||||
|
:config
|
||||||
|
;; For some reason `consult's autoloads do not work
|
||||||
|
(require 'consult-xref)
|
||||||
|
;; Use Consult to select xref locations with preview
|
||||||
|
(setq xref-show-xrefs-function #'consult-xref
|
||||||
|
xref-show-definitions-function #'consult-xref)
|
||||||
|
;; Configure preview. The default value
|
||||||
|
;; is 'any, such that any key triggers the preview.
|
||||||
|
;; (setq consult-preview-key 'any)
|
||||||
|
;; (setq consult-preview-key "M-.")
|
||||||
|
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
|
||||||
|
;; For some commands and buffer sources it is useful to configure the
|
||||||
|
;; :preview-key on a per-command basis using the `consult-customize' macro.
|
||||||
|
(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))
|
||||||
|
|
||||||
|
;; Configure the narrowing key.
|
||||||
|
;; Both < and C-+ work reasonably well.
|
||||||
|
(setq consult-narrow-key "<") ;; "C-+"
|
||||||
|
(autoload 'projectile-project-root "projectile")
|
||||||
|
(setq consult-project-function (lambda (_) (projectile-project-root)))
|
||||||
|
|
||||||
|
;; Optionally make narrowing help available in the minibuffer.
|
||||||
|
;; You may want to use `embark-prefix-help-command' or which-key instead.
|
||||||
|
;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
|
||||||
|
)
|
||||||
|
|
||||||
|
;; For some reason `consult's autoloads do not work
|
||||||
|
(use! consult-imenu
|
||||||
|
"Setup the `consult-imenu' stuff."
|
||||||
|
:after consult
|
||||||
|
:bind (("M-i" . consult-imenu)
|
||||||
|
("M-I" . consult-imenu-multi)))
|
||||||
|
|
||||||
|
|
||||||
|
(use! consult-compile
|
||||||
|
"Setup the `consult-compile' stuff."
|
||||||
|
:after consult
|
||||||
|
:bind (("M-g e" . consult-compile-error)))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'fg42/minibuffer)
|
||||||
|
;;; minibuffer.el ends here
|
|
@ -28,8 +28,6 @@
|
||||||
(defvar fg42/modeline-views nil
|
(defvar fg42/modeline-views nil
|
||||||
"A list of Noether views to use for modeline.")
|
"A list of Noether views to use for modeline.")
|
||||||
|
|
||||||
(defvar fg42/additional-views nil
|
|
||||||
"A list of Noether views to be added to the default views.")
|
|
||||||
|
|
||||||
(defface fg42/-disabled-modeline-active-border
|
(defface fg42/-disabled-modeline-active-border
|
||||||
'((t
|
'((t
|
||||||
|
@ -50,9 +48,9 @@
|
||||||
to Emacs modeline."
|
to Emacs modeline."
|
||||||
:if (display-graphic-p)
|
:if (display-graphic-p)
|
||||||
:after projectile
|
:after projectile
|
||||||
|
:commands noether-global-mode
|
||||||
|
|
||||||
:config
|
:config
|
||||||
;;(require 'noether)
|
|
||||||
(require 'noether-views)
|
(require 'noether-views)
|
||||||
|
|
||||||
;; Disable the default modeline
|
;; Disable the default modeline
|
||||||
|
|
|
@ -105,7 +105,7 @@ For more information checkout `https://github.com/alphapapa/org-super-agenda'"
|
||||||
|
|
||||||
(use! org-capture
|
(use! org-capture
|
||||||
"Quickly capture what is in your head."
|
"Quickly capture what is in your head."
|
||||||
:bind ("<f6>" . org-capture)
|
:bind (("<f6>" . org-capture))
|
||||||
|
|
||||||
:init
|
:init
|
||||||
(setq-default
|
(setq-default
|
||||||
|
|
|
@ -23,7 +23,7 @@ python311, python3Packages,
|
||||||
# This is a set of system tools required for FG42
|
# This is a set of system tools required for FG42
|
||||||
# to work.
|
# to work.
|
||||||
pyright, emacs, ripgrep, git, texinfo, vazir-fonts, fira-code, nerdfonts
|
pyright, emacs, ripgrep, git, texinfo, vazir-fonts, fira-code, nerdfonts
|
||||||
, fira-mono, noto-fonts, gcc, ltex-ls, bash, tree-sitter
|
, fira-mono, noto-fonts, gcc, ltex-ls, bash, tree-sitter, fd
|
||||||
, aspellWithDicts,
|
, aspellWithDicts,
|
||||||
|
|
||||||
supportWM ? true, xorg, slock,
|
supportWM ? true, xorg, slock,
|
||||||
|
@ -43,7 +43,7 @@ let
|
||||||
|
|
||||||
dicts = aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
|
dicts = aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
|
||||||
|
|
||||||
runtimeBins = [ ripgrep git ltex-ls tree-sitter direnv nix nil dicts ]
|
runtimeBins = [ ripgrep git ltex-ls tree-sitter direnv nix nil dicts fd ]
|
||||||
++ (lib.optional supportPython [
|
++ (lib.optional supportPython [
|
||||||
python311
|
python311
|
||||||
# Python deps
|
# Python deps
|
||||||
|
|
Loading…
Reference in New Issue