Break up the vertico setup into minibuffer-vertico setup
This commit is contained in:
parent
71dbe6ef93
commit
f0ffe856da
|
@ -25,6 +25,7 @@ let
|
||||||
./editor
|
./editor
|
||||||
./elisp
|
./elisp
|
||||||
./git
|
./git
|
||||||
|
./minibuffer-vertico
|
||||||
];
|
];
|
||||||
|
|
||||||
pkgsModule = { config, ... }: {
|
pkgsModule = { config, ... }: {
|
||||||
|
|
|
@ -41,11 +41,6 @@ let
|
||||||
yasnippet
|
yasnippet
|
||||||
yasnippet-snippets
|
yasnippet-snippets
|
||||||
flycheck
|
flycheck
|
||||||
vertico
|
|
||||||
orderless
|
|
||||||
ctrlf
|
|
||||||
consult
|
|
||||||
marginalia
|
|
||||||
svg-tag-mode
|
svg-tag-mode
|
||||||
all-the-icons
|
all-the-icons
|
||||||
org
|
org
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
{ lib, config, pkgs, makeFG42Drv, ... }:
|
{ lib, config, pkgs, makeFG42Drv, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.fg42.features.git;
|
cfg = config.fg42.git;
|
||||||
|
|
||||||
deps =
|
deps =
|
||||||
(with pkgs.emacsPackages; [
|
(with pkgs.emacsPackages; [
|
||||||
|
@ -39,7 +39,7 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.fg42.features.git.enable = mkAndEnableOption "git";
|
options.fg42.git.enable = mkAndEnableOption "git";
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
fg42.elispPackages = [ drv ] ++ deps;
|
fg42.elispPackages = [ drv ] ++ deps;
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
# Fg42 - Emacs Editor for advance users
|
||||||
|
#
|
||||||
|
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
#
|
||||||
|
# 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, version 2.
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
# This is the home manager module that exposes FG42. It differs
|
||||||
|
# from FG42 modules that are structurally the same but used in
|
||||||
|
# different context
|
||||||
|
|
||||||
|
# A list of default FG42 modules to build FG42 with.
|
||||||
|
{ lib, config, pkgs, makeFG42Drv, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.fg42.minibuffer.vertico;
|
||||||
|
|
||||||
|
deps =
|
||||||
|
(with pkgs.emacsPackages; [
|
||||||
|
vertico
|
||||||
|
orderless
|
||||||
|
ctrlf
|
||||||
|
consult
|
||||||
|
marginalia
|
||||||
|
]);
|
||||||
|
|
||||||
|
drv = makeFG42Drv {
|
||||||
|
pname = "minibuffer-vertico";
|
||||||
|
version = config.fg42.version;
|
||||||
|
buildInputs = deps;
|
||||||
|
src = ./.;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.fg42.minibuffer.vertico.enable = mkAndEnableOption "vertico";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
fg42.elispPackages = [ drv ] ++ deps;
|
||||||
|
|
||||||
|
fg42.requires = [ drv.pname ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,216 @@
|
||||||
|
;;; 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)
|
||||||
|
(require 'fg42/config))
|
||||||
|
|
||||||
|
|
||||||
|
(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 (("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) ;; 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
|
||||||
|
(when-wm
|
||||||
|
(consult-customize
|
||||||
|
;; Set preview for `consult-buffer' to key `M-.'
|
||||||
|
consult-buffer :preview-key nil))
|
||||||
|
|
||||||
|
;; 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)))
|
||||||
|
|
||||||
|
|
||||||
|
;; (use! nerd-icons-completion
|
||||||
|
;; "Nerd icons in marginalia"
|
||||||
|
;; :after marginalia
|
||||||
|
;; :config
|
||||||
|
;; (nerd-icons-completion-mode)
|
||||||
|
;; (add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'fg42/minibuffer-vertico)
|
||||||
|
;;; minibuffer-vertico.el ends here
|
Loading…
Reference in New Issue