Skip to content

Commit

Permalink
[Completion] Use vertico instead of ivy
Browse files Browse the repository at this point in the history
1. Replaces all ivy features/packages with vertico.

Vertico is more lightweight than ivy and require less configuration, also it is
modern completion program.
  • Loading branch information
luiznux committed Mar 4, 2024
1 parent 2c47ec9 commit c44794e
Show file tree
Hide file tree
Showing 15 changed files with 334 additions and 654 deletions.
2 changes: 1 addition & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
(require 'init-interface)
(require 'init-edit)
(require 'init-evil)
(require 'init-ivy)
(require 'init-completion)
(require 'init-company)
(require 'init-corfu)

Expand Down
6 changes: 0 additions & 6 deletions lisp/code/init-elisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@ Lisp function does not specify a special indentation."
:hook (helpful-mode . cursor-sensor-mode) ; for remove-advice button
:init
(with-no-warnings
(with-eval-after-load 'counsel
(setq counsel-describe-function-function #'helpful-callable
counsel-describe-variable-function #'helpful-variable
counsel-describe-symbol-function #'helpful-symbol
counsel-descbinds-function #'helpful-callable))

(with-eval-after-load 'apropos
;; patch apropos buttons to call helpful instead of help
(dolist (fun-bt '(apropos-function apropos-macro apropos-command))
Expand Down
54 changes: 0 additions & 54 deletions lisp/code/init-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -298,60 +298,6 @@
;; `C-g'to close doc
(advice-add #'keyboard-quit :before #'lsp-ui-doc-hide))


(use-package lsp-ivy
:after lsp-mode
:bind (:map lsp-mode-map
([remap xref-find-apropos] . lsp-ivy-workspace-symbol)
("C-s-." . lsp-ivy-global-workspace-symbol))
:config
(with-no-warnings
(when (icons-displayable-p)
(defconst lsp-ivy-symbol-kind-icons
`(,(nerd-icons-codicon "nf-cod-symbol_namespace") ; Unknown - 0
,(nerd-icons-codicon "nf-cod-symbol_file") ; File - 1
,(nerd-icons-codicon "nf-cod-symbol_namespace" :face 'nerd-icons-lblue) ; Module - 2
,(nerd-icons-codicon "nf-cod-symbol_namespace" :face 'nerd-icons-lblue) ; Namespace - 3
,(nerd-icons-codicon "nf-cod-package") ; Package - 4
,(nerd-icons-codicon "nf-cod-symbol_class" :face 'nerd-icons-orange) ; Class - 5
,(nerd-icons-codicon "nf-cod-symbol_method" :face 'nerd-icons-purple) ; Method - 6
,(nerd-icons-codicon "nf-cod-symbol_property") ; Property - 7
,(nerd-icons-codicon "nf-cod-symbol_field" :face 'nerd-icons-lblue) ; Field - 8
,(nerd-icons-codicon "nf-cod-symbol_method" :face 'nerd-icons-lpurple) ; Constructor - 9
,(nerd-icons-codicon "nf-cod-symbol_enum" :face 'nerd-icons-orange) ; Enum - 10
,(nerd-icons-codicon "nf-cod-symbol_interface" :face 'nerd-icons-lblue) ; Interface - 11
,(nerd-icons-codicon "nf-cod-symbol_method" :face 'nerd-icons-purple) ; Function - 12
,(nerd-icons-codicon "nf-cod-symbol_variable" :face 'nerd-icons-lblue) ; Variable - 13
,(nerd-icons-codicon "nf-cod-symbol_constant") ; Constant - 14
,(nerd-icons-codicon "nf-cod-symbol_string") ; String - 15
,(nerd-icons-codicon "nf-cod-symbol_numeric") ; Number - 16
,(nerd-icons-codicon "nf-cod-symbol_boolean" :face 'nerd-icons-lblue) ; Boolean - 17
,(nerd-icons-codicon "nf-cod-symbol_array") ; Array - 18
,(nerd-icons-codicon "nf-cod-symbol_class" :face 'nerd-icons-blue) ; Object - 19
,(nerd-icons-codicon "nf-cod-symbol_key") ; Key - 20
,(nerd-icons-codicon "nf-cod-symbol_numeric" :face 'nerd-icons-dsilver) ; Null - 21
,(nerd-icons-codicon "nf-cod-symbol_enum_member" :face 'nerd-icons-lblue) ; EnumMember - 22
,(nerd-icons-codicon "nf-cod-symbol_structure" :face 'nerd-icons-orange) ; Struct - 23
,(nerd-icons-codicon "nf-cod-symbol_event" :face 'nerd-icons-orange) ; Event - 24
,(nerd-icons-codicon "nf-cod-symbol_operator") ; Operator - 25
,(nerd-icons-codicon "nf-cod-symbol_class") ; TypeParameter - 26
))

(lsp-defun my-lsp-ivy--format-symbol-match
((sym &as &SymbolInformation :kind :location (&Location :uri))
project-root)
"Convert the match returned by `lsp-mode` into a candidate string."
(let* ((sanitized-kind (if (length> lsp-ivy-symbol-kind-icons kind) kind 0))
(type (elt lsp-ivy-symbol-kind-icons sanitized-kind))
(typestr (if lsp-ivy-show-symbol-kind (format "%s " type) ""))
(pathstr (if lsp-ivy-show-symbol-filename
(propertize (format " · %s" (file-relative-name (lsp--uri-to-path uri) project-root))
'face font-lock-comment-face)
"")))
(concat typestr (lsp-render-symbol-information sym ".") pathstr)))
(advice-add #'lsp-ivy--format-symbol-match :override #'my-lsp-ivy--format-symbol-match))))


;; Debug
(use-package dap-mode
:defines dap-python-executable
Expand Down
11 changes: 3 additions & 8 deletions lisp/code/init-prog.el
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,7 @@
(t 'grep)))
;; Select from xref candidates in minibuffer
(setq xref-show-definitions-function #'xref-show-definitions-completing-read
xref-show-xrefs-function #'xref-show-definitions-completing-read)
;; Select from xref candidates with Ivy
(use-package ivy-xref
:after ivy
:init
(setq xref-show-xrefs-function #'ivy-xref-show-xrefs))))
xref-show-xrefs-function #'xref-show-definitions-completing-read)))

;; Jump to definition
(use-package dumb-jump
Expand All @@ -100,8 +95,8 @@
("b" dumb-jump-back "Back"))))
:bind ("C-M-j" . dumb-jump-hydra/body)
:init
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate) ; use M-. to go to definition
(setq dumb-jump-selector 'ivy))
;; use M-. to go to definition
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate))

;; Code styles
(use-package editorconfig
Expand Down
1 change: 0 additions & 1 deletion lisp/code/init-vcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
(use-package magit-todos
:defines magit-todos-nice
:commands magit-todos-mode magit-todos--scan-with-git-grep
:bind ("C-c C-t" . ivy-magit-todos)
:init
(setq magit-todos-nice (if (executable-find "nice") t nil))
(setq magit-todos-scanner #'magit-todos--scan-with-git-grep)
Expand Down
10 changes: 1 addition & 9 deletions lisp/code/init-web.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,7 @@
("v" xwwp-follow-link "follow link" :exit t)
("w" xwidget-webkit-current-url-message-kill "copy url" :exit t)
("?" describe-mode "help" :exit t)
("Q" quit-window "quit" :exit t))))
:init
;; Link navigation
(use-package xwwp-follow-link-ivy
:after ivy
:bind (("C-c C-z x" . xwwp)
:map xwidget-webkit-mode-map
("v" . xwwp-follow-link))
:init (setq xwwp-follow-link-completion-system 'ivy)))
("Q" quit-window "quit" :exit t)))))

;; CSS
(use-package css-mode
Expand Down
6 changes: 2 additions & 4 deletions lisp/init-functions.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
(declare-function nerd-icons-install-fonts "ext:nerd-icons")
(declare-function xwidget-webkit-current-session "xwidget")
(declare-function xwidget-buffer "xwidget")
(declare-function ivy-read "ivy")


;; UI
Expand Down Expand Up @@ -416,9 +415,8 @@ Save to option `custom-file' if NO-SAVE is nil."
(interactive
(list
(intern
(ivy-read "Select package archives: "
(mapcar #'car luiznux-package-archives-alist)
:preselect (symbol-name luiznux-package-archives)))))
(completing-read "Select package archives: "
(mapcar #'car luiznux-package-archives-alist)))))
;; Set option
(custom-set-variable 'luiznux-package-archives archives no-save)

Expand Down
1 change: 0 additions & 1 deletion lisp/interface/init-centaur-tabs.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
("C-<next>" . centaur-tabs-forward)
("C-S-<prior>" . centaur-tabs-move-current-tab-to-left)
("C-S-<next>" . centaur-tabs-move-current-tab-to-right)
("C-c t t" . centaur-tabs-counsel-switch-group)
(:map evil-normal-state-map
("g t" . centaur-tabs-forward)
("g T" . centaur-tabs-backward)))
Expand Down
Loading

0 comments on commit c44794e

Please sign in to comment.