Changeset d881dae in dotfiles


Ignore:
Timestamp:
Feb 13, 2023, 1:13:57 PM (2 years ago)
Author:
w96k <w96k@…>
Branches:
master
Children:
56a7a86
Parents:
3600aa2
Message:

Add corfu documentation mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emacs/.emacs.d/.emacs-config.org

    r3600aa2 rd881dae  
    904904По большей части я использую дефолтный Completion Buffer и Corfu
    905905#+begin_src elisp :tangle init.el
    906   (when (package-loaded? "corfu")
    907     (progn
    908       (setq corfu-preview-current 'nil)
    909       (corfu-mode 1)
    910       (defun show-default-completion-buffer ()
    911         (interactive)
    912         (corfu-quit)
     906    (when (package-loaded? "corfu")
     907      (progn
     908        (setq corfu-preview-current 'nil
     909              corfu-popupinfo-delay t)
     910        (corfu-mode 1)
     911        (defun show-default-completion-buffer ()
     912          (interactive)
     913          (corfu-quit)
     914          (corfu-mode -1)
     915          (completion-at-point)
     916          (corfu-mode 1)
     917          (corfu-popupinfo-mode 1))
     918        (define-key corfu-map (kbd "M-TAB") 'show-default-completion-buffer)
     919        (define-key corfu-map (kbd "TAB") 'show-default-completion-buffer)
     920        (define-key corfu-map (kbd "C-M-i") 'show-default-completion-buffer)     
    913921        (corfu-mode -1)
    914         (completion-at-point)
    915         (corfu-mode 1))
    916       (define-key corfu-map (kbd "M-TAB") 'show-default-completion-buffer)
    917       (define-key corfu-map (kbd "TAB") 'show-default-completion-buffer)
    918       (define-key corfu-map (kbd "C-M-i") 'show-default-completion-buffer)     
    919       (corfu-mode -1)
    920       (add-hook 'prog-mode-hook 'corfu-mode)
    921 
    922       (defun corfu-send-shell (&rest _)
    923         "Send completion candidate when inside comint/eshell."
    924         (cond
    925          ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
    926           (eshell-send-input))
    927          ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
    928           (comint-send-input))))
    929 
    930       (advice-add #'corfu-insert :after #'corfu-send-shell)
    931      
    932       (add-hook 'eshell-mode-hook 'corfu-mode)))
     922        (add-hook 'prog-mode-hook 'corfu-mode)
     923
     924        (defun corfu-send-shell (&rest _)
     925          "Send completion candidate when inside comint/eshell."
     926          (cond
     927           ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
     928            (eshell-send-input))
     929           ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
     930            (comint-send-input))))
     931
     932        (advice-add #'corfu-insert :after #'corfu-send-shell)
     933
     934        (add-hook 'eshell-mode-hook 'corfu-mode)))
    933935#+end_src
    934936*** Модификация дефолта
Note: See TracChangeset for help on using the changeset viewer.