diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2022-10-14 19:22:05 -0400 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2022-10-14 19:22:05 -0400 |
commit | 61a267b4d9a3a1474cbdd3f407f60d696784c7b5 (patch) | |
tree | d36d48487c3981597c514d95c90f67f469616e17 /emacs | |
parent | 7088d45f8ee567e7cf2510425b9dbc8f3ef2dfe6 (diff) |
fix completion
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.config/emacs-kj/development.el | 8 | ||||
-rw-r--r-- | emacs/.config/emacs-kj/init.el | 33 |
2 files changed, 26 insertions, 15 deletions
diff --git a/emacs/.config/emacs-kj/development.el b/emacs/.config/emacs-kj/development.el index 5d7ea7c..442a0c4 100644 --- a/emacs/.config/emacs-kj/development.el +++ b/emacs/.config/emacs-kj/development.el @@ -32,3 +32,11 @@ :ensure t :config (editorconfig-mode 1)) + +(use-package tree-sitter + :config + (global-tree-sitter-mode) + (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)) + +(use-package tree-sitter-langs + :after tree-sitter) diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el index 6e67939..d2995be 100644 --- a/emacs/.config/emacs-kj/init.el +++ b/emacs/.config/emacs-kj/init.el @@ -20,7 +20,7 @@ (server-start) (setq custom-file (expand-file-name "emacs-custom.el" user-emacs-directory)) -(load custom-file) +(load custom-file :noerror t) (defalias 'yes-or-no-p 'y-or-n-p) @@ -121,18 +121,13 @@ (global-set-key (kbd "C-c a") #'kj/split-window-right) (global-set-key (kbd "C-c o") #'kj/split-window-below) -(use-package company - :bind (:map company-active-map - ("C-n" . company-select-next) - ("C-p" . company-select-previous)) - :hook (eglot-managed-mode . company-mode) - :config - (setq company-idle-delay nil) - (global-company-mode t)) +(use-package vertico + :init + (vertico-mode)) -(use-package selectrum +(use-package savehist :init - (selectrum-mode +1)) + (savehist-mode)) (define-key key-translation-map "\C-u" "\C-x") (define-key key-translation-map "\C-x" "\C-u") @@ -235,7 +230,7 @@ ;; Enable automatic preview at point in the *Completions* buffer. This is ;; relevant when you use the default completion UI. - :hook (completion-list-mode . consult-preview-at-point-mode) + ;; :hook (completion-list-mode . consult-preview-at-point-mode) ;; The :init configuration is always executed (Not lazy) :init @@ -258,6 +253,9 @@ ;; after lazily loading the package. :config + ;; Use consult for completion. + (setq completion-in-region-function #'consult-completion-in-region) + ;; Optionally configure preview. The default value ;; is 'any, such that any key triggers the preview. (setq consult-preview-key '(:debounce 0.3 any)) @@ -299,8 +297,13 @@ (use-package orderless :ensure t :custom - (completion-styles '(orderless basic)) - (completion-category-overrides '((file (styles basic partial-completion))))) + (completion-styles '(orderless)) + (completion-category-overrides '((file (styles basic partial-completion)))) + + ;; Optional performance optimization + ;; by highlighting only the visible candidates. + (setq orderless-skip-highlighting (lambda () selectrum-is-active)) + (setq selectrum-highlight-candidates-function #'orderless-highlight-matches)) (use-package which-key :init @@ -596,7 +599,7 @@ ("C-c C-r C-a" . eglot-code-actions) ("C-c C-r C-r" . eglot-rename) ("C-c C-i C-c" . insert-char) - ("C-<tab>" . company-mode))) + ("C-<tab>" . completion-at-point))) (let ((google-config-file (expand-file-name "google.el" user-emacs-directory))) |