feat: add dashboard and enhance completion
- Add startup dashboard with recent files and bookmarks - Enhance corfu with icons and minibuffer transfer - Add avy-zap, markdown-mode, consult-dir - Optimize GC settings and editor config
This commit is contained in:
@@ -13,23 +13,49 @@
|
||||
|
||||
;; corfu
|
||||
(use-package corfu
|
||||
:init
|
||||
(global-corfu-mode)
|
||||
(corfu-history-mode)
|
||||
(corfu-popupinfo-mode)
|
||||
(corfu-echo-mode)
|
||||
|
||||
:autoload (corfu-quit consult-completion-in-region)
|
||||
:functions (persistent-scratch-save corfu-move-to-minibuffer)
|
||||
:custom
|
||||
(corfu-auto t)
|
||||
(corfu-cycle t)
|
||||
(corfu-auto-delay 0.1)
|
||||
(corfu-popupinfo-delay 0.2)
|
||||
(corfu-preview-current nil)
|
||||
(corfu-auto-prefix 2)
|
||||
(corfu-count 12)
|
||||
(corfu-preview-current nil)
|
||||
(corfu-on-exact-match nil)
|
||||
(corfu-auto-delay 0.2)
|
||||
(corfu-popupinfo-delay '(0.4 . 0.2))
|
||||
(global-corfu-modes '((not erc-mode
|
||||
circe-mode
|
||||
help-mode
|
||||
gud-mode
|
||||
vterm-mode)
|
||||
t))
|
||||
:hook ((after-init . global-corfu-mode)
|
||||
(global-corfu-mode . corfu-popupinfo-mode)
|
||||
(global-corfu-mode . corfu-history-mode))
|
||||
|
||||
:bind
|
||||
(:map corfu-map
|
||||
("RET" . nil)))
|
||||
:config
|
||||
;;Quit completion before saving
|
||||
(add-hook 'before-save-hook #'corfu-quit)
|
||||
(advice-add #'persistent-scratch-save :before #'corfu-quit)
|
||||
|
||||
;; Move completions to minibuffer
|
||||
(defun corfu-move-to-minibuffer ()
|
||||
(interactive)
|
||||
(pcase completion-in-region--data
|
||||
(`(,beg ,end ,table ,pred ,extras)
|
||||
(let ((completion-extra-properties extras)
|
||||
completion-cycle-threshold completion-cycling)
|
||||
(consult-completion-in-region beg end table pred)))))
|
||||
(keymap-set corfu-map "M-m" #'corfu-move-to-minibuffer)
|
||||
(add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer)
|
||||
|
||||
:bind (:map corfu-map
|
||||
("RET" . nil)))
|
||||
|
||||
(unless (or (display-graphic-p)
|
||||
(featurep 'tty-child-frames))
|
||||
(use-package corfu-terminal
|
||||
:hook (global-corfu-mode . corfu-terminal-mode)))
|
||||
|
||||
;; 在eshell中使用tab打开补全
|
||||
(add-hook 'eshell-mode-hook
|
||||
@@ -37,6 +63,9 @@
|
||||
(setq-local corfu-auto nil)
|
||||
(local-set-key (kbd "TAB") 'completion-at-point)))
|
||||
|
||||
(use-package nerd-icons-completion
|
||||
:hook (marginalia-mode . nerd-icons-completion-marginalia-setup))
|
||||
|
||||
(use-package emacs
|
||||
:custom
|
||||
(tab-always-indent 'complete)
|
||||
@@ -52,10 +81,23 @@
|
||||
|
||||
;; cape
|
||||
(use-package cape
|
||||
:commands (cape-file cape-elisp-block cape-keyword)
|
||||
:autoload (cape-wrap-noninterruptible cape-wrap-nonexclusive cape-wrap-buster)
|
||||
:autoload (cape-wrap-silent)
|
||||
:init
|
||||
(add-to-list 'completion-at-point-functions #'cape-file) ;; 文件补全
|
||||
(setq-local completion-at-point-functions
|
||||
(list (cape-capf-super #'cape-dabbrev)))) ;; 启用dabbrev
|
||||
;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
(add-to-list 'completion-at-point-functions #'cape-elisp-block)
|
||||
(add-to-list 'completion-at-point-functions #'cape-keyword)
|
||||
;; (add-to-list 'completion-at-point-functions #'cape-abbrev)
|
||||
|
||||
;; Make these capfs composable.
|
||||
(advice-add 'lsp-completion-at-point :around #'cape-wrap-noninterruptible)
|
||||
(advice-add 'lsp-completion-at-point :around #'cape-wrap-nonexclusive)
|
||||
(advice-add 'comint-completion-at-point :around #'cape-wrap-nonexclusive)
|
||||
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
|
||||
(advice-add 'eglot-completion-at-point :around #'cape-wrap-nonexclusive)
|
||||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-nonexclusive))
|
||||
|
||||
;; lua
|
||||
(use-package lua-ts-mode
|
||||
|
||||
Reference in New Issue
Block a user