tweaks to corfu

This commit is contained in:
Chris Cochrun 2023-04-18 09:40:49 -05:00
parent 84a2156ac2
commit 8e4c3972ba
2 changed files with 104 additions and 5 deletions

63
init.el
View file

@ -168,6 +168,33 @@
(setq auto-save-file-name-transforms
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
(let ((alist '((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)")
(?# . "\\(?:#\\(?:###?\\|_(\\|[!#(:=?[_{]\\)\\)")
(?$ . "\\(?:\\$>\\)")
(?& . "\\(?:&&&?\\)")
(?* . "\\(?:\\*\\(?:\\*\\*\\|[/>]\\)\\)")
(?+ . "\\(?:\\+\\(?:\\+\\+\\|[+>]\\)\\)")
(?- . "\\(?:-\\(?:-[>-]\\|<<\\|>>\\|[<>|~-]\\)\\)")
(?. . "\\(?:\\.\\(?:\\.[.<]\\|[.=?-]\\)\\)")
(?/ . "\\(?:/\\(?:\\*\\*\\|//\\|==\\|[*/=>]\\)\\)")
(?: . "\\(?::\\(?:::\\|\\?>\\|[:<-?]\\)\\)")
(?\; . "\\(?:;;\\)")
(?< . "\\(?:<\\(?:!--\\|\\$>\\|\\*>\\|\\+>\\|-[<>|]\\|/>\\|<[<=-]\\|=\\(?:=>\\|[<=>|]\\)\\||\\(?:||::=\\|[>|]\\)\\|~[>~]\\|[$*+/:<=>|~-]\\)\\)")
(?= . "\\(?:=\\(?:!=\\|/=\\|:=\\|=[=>]\\|>>\\|[=>]\\)\\)")
(?> . "\\(?:>\\(?:=>\\|>[=>-]\\|[]:=-]\\)\\)")
(?? . "\\(?:\\?[.:=?]\\)")
(?\[ . "\\(?:\\[\\(?:||]\\|[<|]\\)\\)")
(?\ . "\\(?:\\\\/?\\)")
(?\] . "\\(?:]#\\)")
(?^ . "\\(?:\\^=\\)")
(?_ . "\\(?:_\\(?:|?_\\)\\)")
(?{ . "\\(?:{|\\)")
(?| . "\\(?:|\\(?:->\\|=>\\||\\(?:|>\\|[=>-]\\)\\|[]=>|}-]\\)\\)")
(?~ . "\\(?:~\\(?:~>\\|[=>@~-]\\)\\)"))))
(dolist (char-regexp alist)
(set-char-table-range composition-function-table (car char-regexp)
`([,(cdr char-regexp) 0 font-shape-gstring]))))
(use-package evil
:init
(setq evil-want-integration t
@ -1610,6 +1637,7 @@ targets."
(corfu-scroll-margin 5) ;; Use scroll margin
(corfu-count 15)
(corfu-auto-prefix 2)
(corfu-auto-delay 0.5)
;; You may want to enable Corfu only for certain modes.
;; :hook ((prog-mode . corfu-mode)
@ -1699,10 +1727,20 @@ targets."
;;(add-to-list 'completion-at-point-functions #'cape-line)
:config
(setq cape-dabbrev-min-length 2)
(setq cape-dabbrev-min-length 4)
)
(use-package kind-icon
:ensure t
:after corfu
:custom
(kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(use-package devdocs
:config
(evil-collection-devdocs-setup)
:general
(chris/leader-keys 'normal
"hd" 'devdocs-lookup))
@ -1779,6 +1817,8 @@ targets."
(display-buffer-in-side-window)
(side . bottom)
(window-height . 0.25))
("\\*e?shell-terminal\\*"
(display-buffer-same-window))
("*helpful*"
(display-buffer-in-side-window)
(side . right)
@ -1823,6 +1863,8 @@ targets."
(display-buffer-in-side-window)
(side . bottom)
(window-height . 0.25))
("\\*e?shell-terminal\\*"
(display-buffer-same-window))
("*helpful*"
(display-buffer-in-side-window)
(side . bottom)
@ -2491,7 +2533,7 @@ targets."
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
(use-package eshell
:ensure nil
:ensure t
:config
(require 'em-tramp)
@ -2612,6 +2654,21 @@ targets."
(interactive)
(consult-buffer))
(defun chris/eshell-window ()
"Open a new emacs window with eshell as a sole buffer"
(interactive)
(with-selected-frame (make-frame '((name . "*eshell-terminal*")))
(setq eshell-terminal (eshell 100))
(display-buffer-same-window
(generate-new-buffer-name "*eshell-terminal*") '())
(eshell 100)
(other-window 1)
(switch-to-buffer "*eshell*<100>")
(other-window 1)
(delete-window)))
(add-hook 'eshell-load-hook #'eat-eshell-mode)
:general
(chris/leader-keys
:states 'normal
@ -2621,6 +2678,8 @@ targets."
(general-def '(normal insert) eshell-mode-map
"C-d" 'kill-buffer-and-window))
(add-hook 'eshell-load-hook #'eat-eshell-mode)
(setq vterm-buffer-name-string "vterm %s")
(defun chris/vterm-setup ()
"Setup vterm with my preferred settings"