Fix setting completion-at-point-functions
Set certain theme elements (e.g. base16 theme and nerd-icons) to only configure if running in GUI mode Fix enabling corfu mode
This commit is contained in:
parent
27dfa1d6a4
commit
70fb8b0e5e
93
init.el
93
init.el
|
@ -233,6 +233,7 @@
|
||||||
(advice-add command :after #'pulse-line))
|
(advice-add command :after #'pulse-line))
|
||||||
|
|
||||||
(use-package base16-theme
|
(use-package base16-theme
|
||||||
|
:if (display-graphic-p)
|
||||||
:custom
|
:custom
|
||||||
(base16-theme-distinct-fringe-background nil)
|
(base16-theme-distinct-fringe-background nil)
|
||||||
(base16-theme-highlight-mode-line 'contrast)
|
(base16-theme-highlight-mode-line 'contrast)
|
||||||
|
@ -242,24 +243,25 @@
|
||||||
(use-package nerd-icons
|
(use-package nerd-icons
|
||||||
:functions (nerd-icons-set-font
|
:functions (nerd-icons-set-font
|
||||||
nerd-icons-octicon)
|
nerd-icons-octicon)
|
||||||
|
:if (display-graphic-p)
|
||||||
:config
|
:config
|
||||||
(nerd-icons-set-font "Symbols Nerd Font Mono-12"))
|
(nerd-icons-set-font "Symbols Nerd Font Mono-12"))
|
||||||
|
|
||||||
(use-package nerd-icons-dired
|
(use-package nerd-icons-dired
|
||||||
:diminish
|
:diminish
|
||||||
:after nerd-icons
|
:requires nerd-icons
|
||||||
:hook (dired-mode))
|
:hook (dired-mode))
|
||||||
|
|
||||||
(use-package nerd-icons-ibuffer
|
(use-package nerd-icons-ibuffer
|
||||||
:diminish
|
:diminish
|
||||||
:after nerd-icons
|
:requires nerd-icons
|
||||||
:hook (ibuffer-mode))
|
:hook (ibuffer-mode))
|
||||||
|
|
||||||
(use-package nerd-icons-completion
|
(use-package nerd-icons-completion
|
||||||
:diminish
|
:diminish
|
||||||
:functions nerd-icons-completion-mode
|
:functions nerd-icons-completion-mode
|
||||||
:after nerd-icons
|
:requires nerd-icons
|
||||||
:config (nerd-icons-completion-mode +1))
|
:hook (after-init . (lambda () (nerd-icons-completion-mode +1))))
|
||||||
|
|
||||||
(use-package nerd-icons-corfu
|
(use-package nerd-icons-corfu
|
||||||
:diminish
|
:diminish
|
||||||
|
@ -671,11 +673,12 @@
|
||||||
|
|
||||||
(use-package vertico
|
(use-package vertico
|
||||||
:functions vertico-mode
|
:functions vertico-mode
|
||||||
|
:hook (after-init . (lambda () (vertico-mode +1)))
|
||||||
:custom
|
:custom
|
||||||
(vertico-cycle t)
|
(vertico-cycle t)
|
||||||
:config
|
(require 'vertico-directory)
|
||||||
(vertico-mode +1)
|
(require 'marginalia)
|
||||||
(require 'vertico-directory))
|
(require 'orderless))
|
||||||
|
|
||||||
(use-package marginalia
|
(use-package marginalia
|
||||||
:functions marginalia-mode
|
:functions marginalia-mode
|
||||||
|
@ -696,36 +699,37 @@
|
||||||
(use-package corfu
|
(use-package corfu
|
||||||
:defines (corfu-map
|
:defines (corfu-map
|
||||||
corfu-mode-map)
|
corfu-mode-map)
|
||||||
:functions (global-corfu-mode
|
:functions (corfu-mode
|
||||||
|
global-corfu-mode
|
||||||
corfu-history-mode)
|
corfu-history-mode)
|
||||||
|
:hook (minibuffer-setup . (lambda ()
|
||||||
|
"Enable `corfu-mode' for `M-:' and `M-!'."
|
||||||
|
(when (local-variable-p 'completion-at-point-functions)
|
||||||
|
(corfu-mode +1))))
|
||||||
:bind ( :map corfu-map
|
:bind ( :map corfu-map
|
||||||
("M-SPC" . corfu-insert-separator)
|
("M-SPC" . corfu-insert-separator)
|
||||||
("RET" . nil)
|
("RET" . nil)
|
||||||
("TAB" . corfu-insert)
|
("TAB" . corfu-insert)
|
||||||
([tab] . corfu-insert))
|
([tab] . corfu-insert))
|
||||||
|
:init
|
||||||
|
(global-corfu-mode +1)
|
||||||
:custom
|
:custom
|
||||||
(corfu-cycle t)
|
(corfu-cycle t)
|
||||||
(corfu-auto nil)
|
(corfu-auto nil)
|
||||||
(corfu-quit-no-match 'separator)
|
|
||||||
(corfu-quit-at-boundary 'separator)
|
|
||||||
(corfu-preview-current 'insert)
|
|
||||||
(corfu-preselect 'directory)
|
|
||||||
:config
|
:config
|
||||||
(require 'corfu-popupinfo)
|
(require 'corfu-popupinfo)
|
||||||
(require 'corfu-terminal)
|
(require 'corfu-terminal))
|
||||||
(defun my/local-corfu-no-auto () (setq-local corfu-auto nil))
|
|
||||||
(with-eval-after-load 'eshell (add-hook 'eshell-mode-hook 'my/local-corfu-no-auto))
|
|
||||||
(with-eval-after-load 'shell (add-hook 'shell-mode-hook 'my/local-corfu-no-auto))
|
|
||||||
(with-eval-after-load 'gud (add-hook 'gud-mode-hook 'my/local-corfu-no-auto))
|
|
||||||
(global-corfu-mode +1))
|
|
||||||
|
|
||||||
(use-package corfu-popupinfo
|
(use-package corfu-popupinfo
|
||||||
:requires corfu
|
:requires corfu
|
||||||
|
:defines corfu-popupinfo-map
|
||||||
:functions corfu-popupinfo-mode
|
:functions corfu-popupinfo-mode
|
||||||
:bind ( :map corfu-mode-map
|
:hook (corfu-mode . (lambda () (corfu-popupinfo-mode +1)))
|
||||||
("M-d" . corfu-popupinfo-toggle)
|
;; :bind ( :map corfu-mode-map
|
||||||
("M-n" . corfu-popupinfo-scroll-up)
|
;; ("M-d" . corfu-popupinfo-toggle)
|
||||||
("M-p" . corfu-popupinfo-scroll-down))
|
;; :map corfu-popupinfo-map
|
||||||
|
;; ("M-n" . corfu-popupinfo-scroll-up)
|
||||||
|
;; ("M-p" . corfu-popupinfo-scroll-down))
|
||||||
:custom
|
:custom
|
||||||
(corfu-popupinfo-delay 0.3)
|
(corfu-popupinfo-delay 0.3)
|
||||||
:config
|
:config
|
||||||
|
@ -734,15 +738,21 @@
|
||||||
(use-package corfu-terminal
|
(use-package corfu-terminal
|
||||||
:requires corfu
|
:requires corfu
|
||||||
:functions corfu-terminal-mode
|
:functions corfu-terminal-mode
|
||||||
:config
|
:if (not (display-graphic-p))
|
||||||
(corfu-terminal-mode +1))
|
:custom
|
||||||
|
(corfu-terminal-mode t))
|
||||||
|
|
||||||
(use-package cape
|
(use-package cape
|
||||||
:after corfu
|
:after corfu
|
||||||
|
:functions (cape-emoji
|
||||||
|
cape-file
|
||||||
|
cape-dabbrev)
|
||||||
|
:hook ((conf-mode prog-mode text-mode) . (lambda ()
|
||||||
|
(dolist (cape-fn '(cape-dabbrev
|
||||||
|
cape-file
|
||||||
|
cape-emoji))
|
||||||
|
(add-hook 'completion-at-point-functions cape-fn nil t))))
|
||||||
:custom
|
:custom
|
||||||
(add-to-list 'completion-at-point-functions #'cape-emoji)
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
|
||||||
(cape-dabbrev-min-length (+ corfu-auto-prefix 1)))
|
(cape-dabbrev-min-length (+ corfu-auto-prefix 1)))
|
||||||
|
|
||||||
(use-package consult
|
(use-package consult
|
||||||
|
@ -781,34 +791,13 @@
|
||||||
(use-package tempel
|
(use-package tempel
|
||||||
:defines tempel-path
|
:defines tempel-path
|
||||||
:functions (tempel-expand
|
:functions (tempel-expand
|
||||||
tempel-abbrev-mode
|
tempel-abbrev-mode)
|
||||||
global-tempel-abbrev-mode)
|
|
||||||
:bind (("M-+" . tempel-complete)
|
:bind (("M-+" . tempel-complete)
|
||||||
("M-*" . tempel-insert))
|
("M-*" . tempel-insert))
|
||||||
|
:hook ((conf-mode prog-mode text-mode) . (lambda ()
|
||||||
|
(add-hook 'completion-at-point-functions 'tempel-complete nil t)))
|
||||||
:custom
|
:custom
|
||||||
(tempel-trigger-prefix "<")
|
(tempel-trigger-prefix "<"))
|
||||||
:init
|
|
||||||
(defun tempel-setup-capf ()
|
|
||||||
"Add the Tempel Capf to `completion-at-point-functions'.
|
|
||||||
|
|
||||||
`tempel-expand' only triggers on exact matches. Alternatively use
|
|
||||||
`tempel-complete' if you want to see all matches, but then you
|
|
||||||
should also configure `tempel-trigger-prefix', such that Tempel
|
|
||||||
does not trigger too often when you don't expect it. NOTE: We add
|
|
||||||
`tempel-expand' *before* the main programming mode Capf,such that
|
|
||||||
it will be tried first."
|
|
||||||
(setq-local completion-at-point-functions
|
|
||||||
(cons #'tempel-expand
|
|
||||||
completion-at-point-functions)))
|
|
||||||
|
|
||||||
(add-hook 'conf-mode-hook 'tempel-setup-capf)
|
|
||||||
(add-hook 'prog-mode-hook 'tempel-setup-capf)
|
|
||||||
(add-hook 'text-mode-hook 'tempel-setup-capf)
|
|
||||||
|
|
||||||
;; Optionally make the Tempel templates available to Abbrev,
|
|
||||||
;; either locally or globally. `expand-abbrev' is bound to C-x '.
|
|
||||||
(add-hook 'prog-mode-hook #'tempel-abbrev-mode)
|
|
||||||
(global-tempel-abbrev-mode))
|
|
||||||
|
|
||||||
(require 'tramp)
|
(require 'tramp)
|
||||||
(setq org-publish-project-alist
|
(setq org-publish-project-alist
|
||||||
|
|
Loading…
Reference in a new issue