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

View file

@ -389,7 +389,7 @@ Let's use =no-littering= in order to stop emacs from filling all our folders wit
** Ligatures ** Ligatures
Here let's try to add ligatures to our font system since the VictorMono Nerd Font supports all ligatures being a "Nerd Font". Here let's try to add ligatures to our font system since the VictorMono Nerd Font supports all ligatures being a "Nerd Font".
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(let ((alist '((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") (let ((alist '((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)")
(?# . "\\(?:#\\(?:###?\\|_(\\|[!#(:=?[_{]\\)\\)") (?# . "\\(?:#\\(?:###?\\|_(\\|[!#(:=?[_{]\\)\\)")
(?$ . "\\(?:\\$>\\)") (?$ . "\\(?:\\$>\\)")
@ -2207,6 +2207,7 @@ Trying out corfu instead of company
(corfu-scroll-margin 5) ;; Use scroll margin (corfu-scroll-margin 5) ;; Use scroll margin
(corfu-count 15) (corfu-count 15)
(corfu-auto-prefix 2) (corfu-auto-prefix 2)
(corfu-auto-delay 0.5)
;; You may want to enable Corfu only for certain modes. ;; You may want to enable Corfu only for certain modes.
;; :hook ((prog-mode . corfu-mode) ;; :hook ((prog-mode . corfu-mode)
@ -2296,14 +2297,27 @@ Trying out corfu instead of company
;;(add-to-list 'completion-at-point-functions #'cape-line) ;;(add-to-list 'completion-at-point-functions #'cape-line)
:config :config
(setq cape-dabbrev-min-length 2) (setq cape-dabbrev-min-length 4)
) )
#+END_SRC #+END_SRC
*** kind-icon
Kind icon adds icons to corfu
#+begin_src emacs-lisp
(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))
#+end_src
*** Devdocs *** Devdocs
Devdocs.io is a pretty great place to see documentation on nearly any developer technology. Devdocs.el will bring all that documentation right inside Emacs. Devdocs.io is a pretty great place to see documentation on nearly any developer technology. Devdocs.el will bring all that documentation right inside Emacs.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package devdocs (use-package devdocs
:config
(evil-collection-devdocs-setup)
:general :general
(chris/leader-keys 'normal (chris/leader-keys 'normal
"hd" 'devdocs-lookup)) "hd" 'devdocs-lookup))
@ -2416,6 +2430,8 @@ Ace link provides an avy like search for links. Upon using the keybindings prese
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . bottom) (side . bottom)
(window-height . 0.25)) (window-height . 0.25))
("\\*e?shell-terminal\\*"
(display-buffer-same-window))
("*helpful*" ("*helpful*"
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . right) (side . right)
@ -2460,6 +2476,8 @@ Ace link provides an avy like search for links. Upon using the keybindings prese
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . bottom) (side . bottom)
(window-height . 0.25)) (window-height . 0.25))
("\\*e?shell-terminal\\*"
(display-buffer-same-window))
("*helpful*" ("*helpful*"
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . bottom) (side . bottom)
@ -3416,7 +3434,7 @@ Use magit, because why wouldn't you? duh!
Let's add our own eshell prompt. and set the password cache to a significantly higher time in order to not need to constantly reuse my password. Let's add our own eshell prompt. and set the password cache to a significantly higher time in order to not need to constantly reuse my password.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eshell (use-package eshell
:ensure nil :ensure t
:config :config
(require 'em-tramp) (require 'em-tramp)
@ -3537,6 +3555,21 @@ Let's add our own eshell prompt. and set the password cache to a significantly h
(interactive) (interactive)
(consult-buffer)) (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 :general
(chris/leader-keys (chris/leader-keys
:states 'normal :states 'normal
@ -3546,6 +3579,13 @@ Let's add our own eshell prompt. and set the password cache to a significantly h
(general-def '(normal insert) eshell-mode-map (general-def '(normal insert) eshell-mode-map
"C-d" 'kill-buffer-and-window)) "C-d" 'kill-buffer-and-window))
#+end_src #+end_src
*** EAT
Emulate a terminal
#+begin_src emacs-lisp
(add-hook 'eshell-load-hook #'eat-eshell-mode)
#+end_src
*** Esh-autosuggest *** Esh-autosuggest
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(use-package esh-autosuggest (use-package esh-autosuggest

63
init.el
View file

@ -168,6 +168,33 @@
(setq auto-save-file-name-transforms (setq auto-save-file-name-transforms
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t))) `((".*" ,(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 (use-package evil
:init :init
(setq evil-want-integration t (setq evil-want-integration t
@ -1610,6 +1637,7 @@ targets."
(corfu-scroll-margin 5) ;; Use scroll margin (corfu-scroll-margin 5) ;; Use scroll margin
(corfu-count 15) (corfu-count 15)
(corfu-auto-prefix 2) (corfu-auto-prefix 2)
(corfu-auto-delay 0.5)
;; You may want to enable Corfu only for certain modes. ;; You may want to enable Corfu only for certain modes.
;; :hook ((prog-mode . corfu-mode) ;; :hook ((prog-mode . corfu-mode)
@ -1699,10 +1727,20 @@ targets."
;;(add-to-list 'completion-at-point-functions #'cape-line) ;;(add-to-list 'completion-at-point-functions #'cape-line)
:config :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 (use-package devdocs
:config
(evil-collection-devdocs-setup)
:general :general
(chris/leader-keys 'normal (chris/leader-keys 'normal
"hd" 'devdocs-lookup)) "hd" 'devdocs-lookup))
@ -1779,6 +1817,8 @@ targets."
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . bottom) (side . bottom)
(window-height . 0.25)) (window-height . 0.25))
("\\*e?shell-terminal\\*"
(display-buffer-same-window))
("*helpful*" ("*helpful*"
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . right) (side . right)
@ -1823,6 +1863,8 @@ targets."
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . bottom) (side . bottom)
(window-height . 0.25)) (window-height . 0.25))
("\\*e?shell-terminal\\*"
(display-buffer-same-window))
("*helpful*" ("*helpful*"
(display-buffer-in-side-window) (display-buffer-in-side-window)
(side . bottom) (side . bottom)
@ -2491,7 +2533,7 @@ targets."
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
(use-package eshell (use-package eshell
:ensure nil :ensure t
:config :config
(require 'em-tramp) (require 'em-tramp)
@ -2612,6 +2654,21 @@ targets."
(interactive) (interactive)
(consult-buffer)) (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 :general
(chris/leader-keys (chris/leader-keys
:states 'normal :states 'normal
@ -2621,6 +2678,8 @@ targets."
(general-def '(normal insert) eshell-mode-map (general-def '(normal insert) eshell-mode-map
"C-d" 'kill-buffer-and-window)) "C-d" 'kill-buffer-and-window))
(add-hook 'eshell-load-hook #'eat-eshell-mode)
(setq vterm-buffer-name-string "vterm %s") (setq vterm-buffer-name-string "vterm %s")
(defun chris/vterm-setup () (defun chris/vterm-setup ()
"Setup vterm with my preferred settings" "Setup vterm with my preferred settings"