feat: Various completion additions
- Add `vertico-mode` keybindings. - Unmap `C-k` in insert state.
This commit is contained in:
35
lib/syd-search.el
Normal file
35
lib/syd-search.el
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
;;; syd-search.el --- Description -*- lexical-binding: t; -*-
|
||||||
|
;;
|
||||||
|
;; Copyright (C) 2025 Madeleine Sydney
|
||||||
|
;;
|
||||||
|
;; Author: Madeleine Sydney <lomiskiam@gmail.com>
|
||||||
|
;; Maintainer: Madeleine Sydney <lomiskiam@gmail.com>
|
||||||
|
;; Created: January 12, 2025
|
||||||
|
;; Modified: January 12, 2025
|
||||||
|
;; Version: 0.0.1
|
||||||
|
;; Keywords: abbrev bib c calendar comm convenience data docs emulations extensions faces files frames games hardware help hypermedia i18n internal languages lisp local maint mail matching mouse multimedia news outlines processes terminals tex text tools unix vc
|
||||||
|
;; Homepage: https://github.com/crumb/syd-search
|
||||||
|
;; Package-Requires: ((emacs "24.3"))
|
||||||
|
;;
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
;;
|
||||||
|
;;; Commentary:
|
||||||
|
;;
|
||||||
|
;; Description
|
||||||
|
;;
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(syd-define-stub
|
||||||
|
syd/search-buffer
|
||||||
|
"Conduct a text search on the current buffer.
|
||||||
|
|
||||||
|
If a selection is active and multi-line, perform a search restricted to that
|
||||||
|
region.
|
||||||
|
|
||||||
|
If a selection is active and not multi-line, use the selection as the initial
|
||||||
|
input and search the whole buffer for it.
|
||||||
|
|
||||||
|
See `+default/search-buffer'.")
|
||||||
|
|
||||||
|
(provide 'syd-search)
|
||||||
|
;;; syd-search.el ends here
|
||||||
@@ -37,6 +37,10 @@
|
|||||||
;; cursor. Quick fix! }:P
|
;; cursor. Quick fix! }:P
|
||||||
(add-hook 'minibuffer-setup-hook
|
(add-hook 'minibuffer-setup-hook
|
||||||
#'evil-refresh-cursor)
|
#'evil-refresh-cursor)
|
||||||
|
;; Unbind 'C-k'. Normally, it inserts digraphs; I have a compose key. It
|
||||||
|
;; often gets in the way of buffers with navigation, e.g. scrolling through
|
||||||
|
;; shell/REPL history, navigating Vertico completions, etc.
|
||||||
|
(keymap-set evil-insert-state-map "C-k" nil)
|
||||||
(evil-mode 1))
|
(evil-mode 1))
|
||||||
|
|
||||||
;; A large, community-sourced collection of preconfigured Evil-mode
|
;; A large, community-sourced collection of preconfigured Evil-mode
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ are active.")
|
|||||||
"u" `("Save buffer as root" . ,#'syd/save-buffer-as-root)
|
"u" `("Save buffer as root" . ,#'syd/save-buffer-as-root)
|
||||||
"r" `("Revert buffer" . ,#'revert-buffer))
|
"r" `("Revert buffer" . ,#'revert-buffer))
|
||||||
|
|
||||||
|
;;; Search
|
||||||
|
(general-def
|
||||||
|
:prefix-map 'syd-leader-search-map
|
||||||
|
"i" `("IMenu" . ,#'consult-imenu)
|
||||||
|
"b" `("Search buffer" . ,#'syd/search-buffer))
|
||||||
|
|
||||||
;;; File
|
;;; File
|
||||||
(require 'syd-file)
|
(require 'syd-file)
|
||||||
(general-def
|
(general-def
|
||||||
@@ -113,6 +119,7 @@ are active.")
|
|||||||
"b" `("Buffer" . ,syd-leader-buffer-map)
|
"b" `("Buffer" . ,syd-leader-buffer-map)
|
||||||
"w" `("Window" . ,syd-leader-window-map)
|
"w" `("Window" . ,syd-leader-window-map)
|
||||||
"f" `("File" . ,syd-leader-file-map)
|
"f" `("File" . ,syd-leader-file-map)
|
||||||
|
"s" `("Search" . ,syd-leader-search-map)
|
||||||
"h" `("Help" . ,help-map)))
|
"h" `("Help" . ,help-map)))
|
||||||
|
|
||||||
(syd-keybinds-initialise)
|
(syd-keybinds-initialise)
|
||||||
|
|||||||
@@ -16,12 +16,29 @@
|
|||||||
;; technically, it doesn't play well with `evil-terminal-cursor-changer'.
|
;; technically, it doesn't play well with `evil-terminal-cursor-changer'.
|
||||||
(blink-cursor-mode -1))
|
(blink-cursor-mode -1))
|
||||||
|
|
||||||
|
;; Consult adds various search and navigation tools using Emacs' completing-read
|
||||||
|
;; function; i.e., in our case, Vertico.
|
||||||
|
(use-package consult
|
||||||
|
:defer t)
|
||||||
|
|
||||||
;; Vertico is a simple completion engine that replaces Emacs' built-in
|
;; Vertico is a simple completion engine that replaces Emacs' built-in
|
||||||
;; completion engine, achieving Just Works™ compatibility. This is in contrast
|
;; completion engine, achieving Just Works™ compatibility. This is in contrast
|
||||||
;; to e.g. Helm and Ivy, which spawn ecosystems orthogonal to Emacs, and
|
;; to e.g. Helm and Ivy, which spawn ecosystems orthogonal to Emacs, and
|
||||||
;; diametrically-opposed to each other.
|
;; diametrically-opposed to each other.
|
||||||
(use-package vertico
|
(use-package vertico
|
||||||
:hook (on-first-input . vertico-mode))
|
:hook (on-first-input . vertico-mode)
|
||||||
|
:general (:keymaps 'vertico-map
|
||||||
|
"DEL" #'vertico-directory-delete-char
|
||||||
|
"C-SPC" #'+vertico/embark-preview
|
||||||
|
"C-j" #'vertico-next
|
||||||
|
"C-k" #'vertico-previous
|
||||||
|
"C-M-j" #'vertico-next-group
|
||||||
|
"C-M-k" #'vertico-previous-group)
|
||||||
|
:config
|
||||||
|
(setq-default completion-in-region-function #'consult-completion-in-region)
|
||||||
|
;; Cleans up path when moving directories with shadowed paths syntax, e.g.
|
||||||
|
;; cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/.
|
||||||
|
(add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
|
||||||
|
|
||||||
;; Orderless provides a completion style that divides the pattern into
|
;; Orderless provides a completion style that divides the pattern into
|
||||||
;; space-separated components, and matches candidates that match all of the
|
;; space-separated components, and matches candidates that match all of the
|
||||||
|
|||||||
Reference in New Issue
Block a user