diff --git a/lisp/fg42/deps.el b/lisp/fg42/deps.el index ed0b84d..87101ad 100644 --- a/lisp/fg42/deps.el +++ b/lisp/fg42/deps.el @@ -85,9 +85,7 @@ expand-region eros org - org-journal org-modern - org-sidebar org-super-agenda org-ql ctrlf @@ -122,7 +120,7 @@ marginalia nerd-icons forge -) + consult) (provide 'fg42/deps) ;;; deps.el ends here diff --git a/lisp/fg42/editor.el b/lisp/fg42/editor.el index 97ab1e9..2e22db7 100644 --- a/lisp/fg42/editor.el +++ b/lisp/fg42/editor.el @@ -34,11 +34,13 @@ (require 'fg42/git) (require 'fg42/wm) - (require 'fg42/org)) + (require 'fg42/org) + (require 'fg42/minibuffer)) (require 'server) (require 'fg42/modeline) + (defvar fg42/font '("Fira Mono" 12) "Font name and size to be used with FG42. (Default (\"Fira Mono\" 12).") @@ -128,9 +130,9 @@ contextual information." :init (setq epa-pinentry-mode 'loopback)) - (use! imenu - "The Imenu facility offers a way to find the major definitions in a file by name." - :bind (("M-i" . imenu))) + ;; (use! imenu + ;; "The Imenu facility offers a way to find the major definitions in a file by name." + ;; :bind (("M-i" . imenu))) (use! imenu-list "his Emacs minor-mode creates an automatically updated buffer @@ -163,56 +165,6 @@ contextual information." "This cube controls the different aspect of buffer navigation" :bind ("C-" . 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 (use! flyspell @@ -229,12 +181,6 @@ match all of the components in any order." :init (savehist-mode)) - ;; Minibuffer related stuff - (use! ctrlf - "Single buffer text search." - :config - (ctrlf-mode +1)) - (use! display-line-numbers "The builtin replacement of linum. It's is pretty fast." :config diff --git a/lisp/fg42/minibuffer.el b/lisp/fg42/minibuffer.el new file mode 100644 index 0000000..2374bfd --- /dev/null +++ b/lisp/fg42/minibuffer.el @@ -0,0 +1,200 @@ +;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2024 Sameer Rahmani +;; +;; Author: Sameer Rahmani +;; 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 . +;; +;;; 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-" "S-")) + ;; 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 diff --git a/lisp/fg42/modeline.el b/lisp/fg42/modeline.el index eebcc48..529aceb 100644 --- a/lisp/fg42/modeline.el +++ b/lisp/fg42/modeline.el @@ -28,8 +28,6 @@ (defvar fg42/modeline-views nil "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 '((t @@ -50,9 +48,9 @@ to Emacs modeline." :if (display-graphic-p) :after projectile + :commands noether-global-mode :config - ;;(require 'noether) (require 'noether-views) ;; Disable the default modeline diff --git a/lisp/fg42/org.el b/lisp/fg42/org.el index d948958..45a7559 100644 --- a/lisp/fg42/org.el +++ b/lisp/fg42/org.el @@ -105,7 +105,7 @@ For more information checkout `https://github.com/alphapapa/org-super-agenda'" (use! org-capture "Quickly capture what is in your head." - :bind ("" . org-capture) + :bind (("" . org-capture)) :init (setq-default diff --git a/nix/fg42.nix b/nix/fg42.nix index f41585d..7b28dd9 100644 --- a/nix/fg42.nix +++ b/nix/fg42.nix @@ -23,7 +23,7 @@ python311, python3Packages, # This is a set of system tools required for FG42 # to work. 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, supportWM ? true, xorg, slock, @@ -43,7 +43,7 @@ let 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 [ python311 # Python deps