dev: merging latest changes from pr7002
This commit is contained in:
commit
35e7bd2711
4 changed files with 92 additions and 99 deletions
|
@ -37,47 +37,18 @@ major mode regardless of size.")
|
|||
tab-always-indent (if (modulep! +tng) 'complete tab-always-indent))
|
||||
(add-to-list 'completion-category-overrides `(lsp-capf (styles ,@completion-styles)))
|
||||
|
||||
(map! :map corfu-mode-map
|
||||
:e "C-M-i" #'completion-at-point
|
||||
:i "C-SPC" #'completion-at-point
|
||||
:n "C-SPC" (cmd! (call-interactively #'evil-insert-state)
|
||||
(call-interactively #'completion-at-point))
|
||||
:v "C-SPC" (cmd! (call-interactively #'evil-change)
|
||||
(call-interactively #'completion-at-point)))
|
||||
(map! :unless (modulep! :editor evil)
|
||||
:map corfu-mode-map
|
||||
"C-M-i" #'completion-at-point)
|
||||
|
||||
(add-hook! corfu-mode
|
||||
(defun +corfu-mode-binds ()
|
||||
(defun +corfu-mode-unbinds ()
|
||||
;; In `corfu-mode', unbind C-SPC from `global-map', so Emacs keeps searching.
|
||||
(make-local-variable 'global-map)
|
||||
(unbind-key "C-SPC" 'global-map)))
|
||||
|
||||
(defun +corfu-enable-in-minibuffer ()
|
||||
"Enable Corfu in the minibuffer if `completion-at-point' is bound."
|
||||
(when (where-is-internal #'completion-at-point (list (current-local-map)))
|
||||
(setq-local corfu-echo-delay nil)
|
||||
(corfu-mode +1)))
|
||||
(add-hook 'minibuffer-setup-hook #'+corfu-enable-in-minibuffer)
|
||||
;; If you want to update the visual hints after completing minibuffer commands
|
||||
;; with Corfu and exiting, you have to do it manually.
|
||||
(defadvice! +corfu--insert-before-exit-minibuffer-a ()
|
||||
:before #'exit-minibuffer
|
||||
(when (or (and (frame-live-p corfu--frame)
|
||||
(frame-visible-p corfu--frame))
|
||||
(and (featurep 'corfu-terminal)
|
||||
(popon-live-p corfu-terminal--popon)))
|
||||
(when (member isearch-lazy-highlight-timer timer-idle-list)
|
||||
(apply (timer--function isearch-lazy-highlight-timer)
|
||||
(timer--args isearch-lazy-highlight-timer)))
|
||||
(when (member (bound-and-true-p anzu--update-timer) timer-idle-list)
|
||||
(apply (timer--function anzu--update-timer)
|
||||
(timer--args anzu--update-timer)))
|
||||
(when (member (bound-and-true-p evil--ex-search-update-timer)
|
||||
timer-idle-list)
|
||||
(apply (timer--function evil--ex-search-update-timer)
|
||||
(timer--args evil--ex-search-update-timer)))))
|
||||
(add-hook! 'minibuffer-setup-hook
|
||||
(defun +corfu-enable-in-minibuffer ()
|
||||
"Enable Corfu in the minibuffer if `completion-at-point' is bound."
|
||||
(when (where-is-internal #'completion-at-point (list (current-local-map)))
|
||||
(setq-local corfu-echo-delay nil)
|
||||
(corfu-mode +1))))
|
||||
|
||||
(after! evil
|
||||
(add-hook 'evil-insert-state-exit-hook #'corfu-quit))
|
||||
|
@ -85,32 +56,9 @@ major mode regardless of size.")
|
|||
(when (modulep! +icons)
|
||||
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
|
||||
|
||||
(let ((cmds-del (cmds! (and (modulep! +tng)
|
||||
(> corfu--index -1)
|
||||
(eq corfu-preview-current 'insert))
|
||||
#'corfu-reset)))
|
||||
(map! :map corfu-map
|
||||
[return] #'corfu-insert
|
||||
"RET" #'corfu-insert
|
||||
(:when (modulep! +orderless)
|
||||
"<remap> <completion-at-point>" #'+corfu-smart-sep-toggle-escape)
|
||||
(:when (modulep! +tng)
|
||||
[tab] #'corfu-next
|
||||
[backtab] #'corfu-previous
|
||||
"TAB" #'corfu-next
|
||||
"S-TAB" #'corfu-previous
|
||||
[backspace] cmds-del
|
||||
"DEL" cmds-del)))
|
||||
|
||||
(when (modulep! +orderless)
|
||||
(after! orderless
|
||||
(setq orderless-component-separator #'orderless-escapable-split-on-space)))
|
||||
|
||||
(after! vertico
|
||||
(map! :map corfu-map
|
||||
"M-m" #'+corfu-move-to-minibuffer
|
||||
(:when (modulep! :editor evil)
|
||||
"M-J" #'+corfu-move-to-minibuffer))))
|
||||
(setq orderless-component-separator #'orderless-escapable-split-on-space))))
|
||||
|
||||
(use-package! cape
|
||||
:defer t
|
||||
|
@ -139,17 +87,6 @@ major mode regardless of size.")
|
|||
eshell-mode)
|
||||
(defun +corfu-add-cape-dabbrev-h ()
|
||||
(add-hook 'completion-at-point-functions #'cape-dabbrev 20 t)))))
|
||||
(when (modulep! +line)
|
||||
;; Set up `cape-line' options.
|
||||
(defun +cape-line-buffers ()
|
||||
(cl-loop for buf in (buffer-list)
|
||||
if (or (eq major-mode (buffer-local-value 'major-mode buf))
|
||||
(< (buffer-size buf) +corfu-buffer-scanning-size-limit))
|
||||
collect buf))
|
||||
(setq cape-line-buffer-function #'+cape-line-buffers)
|
||||
(add-hook! (text-mode comint-mode minibuffer-setup)
|
||||
(defun +corfu-add-cape-line-h ()
|
||||
(add-hook 'completion-at-point-functions #'cape-line 20 t))))
|
||||
;; Complete emojis :).
|
||||
(when (and (modulep! +emoji) (> emacs-major-version 28))
|
||||
(add-hook! (prog-mode conf-mode)
|
||||
|
@ -215,16 +152,4 @@ major mode regardless of size.")
|
|||
(use-package! corfu-popupinfo
|
||||
:hook ((corfu-mode . corfu-popupinfo-mode))
|
||||
:config
|
||||
(setq corfu-popupinfo-delay '(0.5 . 1.0))
|
||||
(map! :map corfu-map
|
||||
"C-<up>" #'corfu-popupinfo-scroll-down
|
||||
"C-<down>" #'corfu-popupinfo-scroll-up
|
||||
"C-S-p" #'corfu-popupinfo-scroll-down
|
||||
"C-S-n" #'corfu-popupinfo-scroll-up
|
||||
"C-h" #'corfu-popupinfo-toggle)
|
||||
(map! :when (modulep! :editor evil)
|
||||
:map corfu-popupinfo-map
|
||||
;; Reversed because popupinfo assumes opposite of what feels intuitive
|
||||
;; with evil.
|
||||
"C-S-k" #'corfu-popupinfo-scroll-down
|
||||
"C-S-j" #'corfu-popupinfo-scroll-up))
|
||||
(setq corfu-popupinfo-delay '(0.5 . 1.0)))
|
||||
|
|
|
@ -511,7 +511,7 @@
|
|||
"C-x C-b" #'ibuffer
|
||||
"C-x K" #'doom/kill-this-buffer-in-all-windows
|
||||
|
||||
;;; company-mode
|
||||
;;; completion (in-buffer)
|
||||
(:when (modulep! :completion company)
|
||||
"C-;" #'+company/complete
|
||||
(:after company
|
||||
|
@ -537,6 +537,13 @@
|
|||
"C-p" #'company-search-repeat-backward
|
||||
"C-s" (cmd! (company-search-abort) (company-filter-candidates))))
|
||||
|
||||
(:when (modulep! :completion corfu)
|
||||
:after corfu
|
||||
(:map corfu-mode-map
|
||||
"C-M-i" #'completion-at-point)
|
||||
(:map corfu-popupinfo-map
|
||||
"C-S-h" #'corfu-popupinfo-toggle))
|
||||
|
||||
;;; ein notebooks
|
||||
(:after ein:notebook-multilang
|
||||
:map ein:notebook-multilang-mode-map
|
||||
|
|
|
@ -43,7 +43,10 @@
|
|||
#'yas-expand
|
||||
(and (bound-and-true-p company-mode)
|
||||
(modulep! :completion company +tng))
|
||||
#'company-indent-or-complete-common)
|
||||
#'company-indent-or-complete-common
|
||||
(and (bound-and-true-p corfu-mode)
|
||||
(modulep! :completion corfu +tng))
|
||||
#'completion-at-point)
|
||||
:m [tab] (cmds! (and (modulep! :editor snippets)
|
||||
(evil-visual-state-p)
|
||||
(or (eq evil-visual-selection 'line)
|
||||
|
@ -127,7 +130,7 @@
|
|||
;;
|
||||
;;; Module keybinds
|
||||
|
||||
;;; :completion
|
||||
;;; :completion (in-buffer)
|
||||
(map! (:when (modulep! :completion company)
|
||||
:i "C-@" (cmds! (not (minibufferp)) #'company-complete-common)
|
||||
:i "C-SPC" (cmds! (not (minibufferp)) #'company-complete-common)
|
||||
|
@ -156,7 +159,31 @@
|
|||
"C-s" #'company-filter-candidates
|
||||
[escape] #'company-search-abort)))
|
||||
|
||||
(:when (modulep! :completion ivy)
|
||||
(:when (modulep! :completion corfu)
|
||||
(:after corfu
|
||||
(:map corfu-mode-map
|
||||
:e "C-M-i" #'completion-at-point
|
||||
(:unless (modulep! :completion corfu +tng)
|
||||
:i "C-SPC" #'completion-at-point
|
||||
:n "C-SPC" (cmd! (call-interactively #'evil-insert-state)
|
||||
(call-interactively #'completion-at-point))
|
||||
:v "C-SPC" (cmd! (call-interactively #'evil-change)
|
||||
(call-interactively #'completion-at-point))))
|
||||
(:map corfu-map
|
||||
"C-u" (cmd! (let ((corfu-cycle nil))
|
||||
(funcall-interactively #'corfu-next (- corfu-count))))
|
||||
"C-d" (cmd! (let ((corfu-cycle nil))
|
||||
(funcall-interactively #'corfu-next corfu-count)))))
|
||||
(:after corfu-popupinfo
|
||||
:map corfu-popupinfo-map
|
||||
;; Reversed because popupinfo assumes opposite of what feels intuitive
|
||||
;; with evil.
|
||||
"C-S-k" #'corfu-popupinfo-scroll-down
|
||||
"C-S-j" #'corfu-popupinfo-scroll-up
|
||||
"C-h" #'corfu-popupinfo-toggle)))
|
||||
|
||||
;;; :completion (separate)
|
||||
(map! (:when (modulep! :completion ivy)
|
||||
(:after ivy
|
||||
:map ivy-minibuffer-map
|
||||
"C-SPC" #'ivy-call-and-recenter ; preview file
|
||||
|
@ -169,7 +196,8 @@
|
|||
[C-return] #'+ivy/git-grep-other-window-action))
|
||||
|
||||
(:when (modulep! :completion helm)
|
||||
(:after helm :map helm-map
|
||||
(:after helm
|
||||
:map helm-map
|
||||
[remap next-line] #'helm-next-line
|
||||
[remap previous-line] #'helm-previous-line
|
||||
[left] #'left-char
|
||||
|
@ -371,8 +399,10 @@
|
|||
;;; <leader> c --- code
|
||||
(:prefix-map ("c" . "code")
|
||||
(:when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot)))
|
||||
:desc "LSP Execute code action" "a" #'lsp-execute-code-action
|
||||
:desc "LSP Organize imports" "o" #'lsp-organize-imports
|
||||
:desc "LSP" "l" #'+default/lsp-command-map
|
||||
:desc "LSP Execute code action" "a" #'lsp-execute-code-action
|
||||
:desc "LSP Organize imports" "o" #'lsp-organize-imports
|
||||
:desc "LSP Rename" "r" #'lsp-rename
|
||||
(:when (modulep! :completion ivy)
|
||||
:desc "Jump to symbol in current workspace" "j" #'lsp-ivy-workspace-symbol
|
||||
:desc "Jump to symbol in any workspace" "J" #'lsp-ivy-global-workspace-symbol)
|
||||
|
@ -387,12 +417,10 @@
|
|||
:desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy
|
||||
:desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t)
|
||||
:desc "References tree" "R" (cmd!! #'lsp-treemacs-references t)
|
||||
:desc "Symbols" "S" #'lsp-treemacs-symbols)
|
||||
:desc "LSP" "l" #'+default/lsp-command-map
|
||||
:desc "LSP Rename" "r" #'lsp-rename)
|
||||
:desc "Symbols" "S" #'lsp-treemacs-symbols))
|
||||
(:when (modulep! :tools lsp +eglot)
|
||||
:desc "LSP Execute code action" "a" #'eglot-code-actions
|
||||
:desc "LSP Rename" "r" #'eglot-rename
|
||||
:desc "LSP Execute code action" "a" #'eglot-code-actions
|
||||
:desc "LSP Rename" "r" #'eglot-rename
|
||||
:desc "LSP Find declaration" "j" #'eglot-find-declaration
|
||||
(:when (modulep! :completion vertico)
|
||||
:desc "Jump to symbol in current workspace" "j" #'consult-eglot-symbols))
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
(time-to-seconds))
|
||||
collect (epg-sub-key-fingerprint subkey))))
|
||||
user-mail-address))
|
||||
;; And suppress prompts if epa-file-encrypt-to has a default value (without
|
||||
;; overwriting file-local values).
|
||||
;; And suppress prompts if epa-file-encrypt-to has a default value (without
|
||||
;; overwriting file-local values).
|
||||
(defadvice! +default--dont-prompt-for-keys-a (&rest _)
|
||||
:before #'epa-file-write-region
|
||||
(unless (local-variable-p 'epa-file-encrypt-to)
|
||||
|
@ -165,7 +165,7 @@
|
|||
(and (sp-in-code-p id action context)
|
||||
(save-excursion
|
||||
(goto-char (line-beginning-position))
|
||||
(looking-at-p "[ ]*#include[^<]+"))))
|
||||
(looking-at-p "[ \t]*#include[^<]+"))))
|
||||
|
||||
;; ...and leave it to smartparens
|
||||
(sp-local-pair '(c++-mode objc-mode)
|
||||
|
@ -453,6 +453,39 @@ Continues comments if executed from a commented line. Consults
|
|||
'(evil-ex-completion-map)))
|
||||
"C-s" command))
|
||||
|
||||
(map! :when (modulep! :completion corfu)
|
||||
:after corfu
|
||||
(:map corfu-map
|
||||
[return] #'corfu-insert
|
||||
"RET" #'corfu-insert
|
||||
"C-s" #'+corfu-move-to-minibuffer
|
||||
"C-p" #'corfu-previous
|
||||
"C-n" #'corfu-next
|
||||
(:when (modulep! :completion corfu +orderless)
|
||||
"<remap> <completion-at-point>" #'+corfu-smart-sep-toggle-escape)
|
||||
(:when (modulep! :completion corfu +tng)
|
||||
[tab] #'corfu-next
|
||||
"TAB" #'corfu-next
|
||||
[backtab] #'corfu-previous
|
||||
"S-TAB" #'corfu-previous))
|
||||
(:after corfu-popupinfo
|
||||
:map corfu-popupinfo-map
|
||||
"C-<up>" #'corfu-popupinfo-scroll-down
|
||||
"C-<down>" #'corfu-popupinfo-scroll-up
|
||||
"C-S-p" #'corfu-popupinfo-scroll-down
|
||||
"C-S-n" #'corfu-popupinfo-scroll-up
|
||||
"C-S-u" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-down corfu-popupinfo-min-height))
|
||||
"C-S-d" (cmd! (funcall-interactively #'corfu-popupinfo-scroll-up corfu-popupinfo-min-height))))
|
||||
|
||||
(when-let ((cmds-del (and (modulep! :completion corfu +tng)
|
||||
(cmds! (and (> corfu--index -1)
|
||||
(eq corfu-preview-current 'insert))
|
||||
#'corfu-reset))))
|
||||
(map! :after corfu
|
||||
:map corfu-map
|
||||
[backspace] cmds-del
|
||||
"DEL" cmds-del))
|
||||
|
||||
;; Smarter C-a/C-e for both Emacs and Evil. C-a will jump to indentation.
|
||||
;; Pressing it again will send you to the true bol. Same goes for C-e, except
|
||||
;; it will ignore comments+trailing whitespace before jumping to eol.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue