Remove yasnippets.

This commit is contained in:
kj 2022-11-29 03:45:09 -04:00
parent a6848f631f
commit 69c904cffa
2 changed files with 5 additions and 70 deletions

View File

@ -30,10 +30,7 @@
company-dabbrev-ignore-case nil
company-dabbrev-downcase nil ; autocompletado case-sensitive.
company-global-modes '(not erc-mode message-mode help-mode
gud-mode eshell-mode shell-mode)
company-backends '((company-capf :with company-yasnippet)
(company-dabbrev-code company-keywords company-files)
company-dabbrev))
gud-mode eshell-mode shell-mode))
:config
(with-no-warnings
;; Company anywhere
@ -82,49 +79,6 @@
(overlay-put company-preview-overlay 'display after-string)
(overlay-put company-preview-overlay 'after-string nil)))))
(advice-add 'company-preview-show-at-point :after 'company-anywhere-preview-show-at-point)
;; `yasnippet' integration
(with-eval-after-load 'yasnippet
(defun my-company-yasnippet ()
"Hide the current completeions and show snippets."
(interactive)
(company-cancel)
(call-interactively 'company-yasnippet))
(defun company-backend-with-yas (backend)
"Add `yasnippet' to company backend."
(if (and (listp backend) (member 'company-yasnippet backend))
backend
(append (if (consp backend) backend (list backend))
'(:with company-yasnippet))))
(defun my-company-enbale-yas (&rest _)
"Enable `yasnippet' in `company'."
(setq company-backends (mapcar #'company-backend-with-yas company-backends)))
(defun my-lsp-fix-company-capf ()
"Remove redundant `comapny-capf'."
(setq company-backends
(remove 'company-backends (remq 'company-capf company-backends))))
(advice-add #'lsp-completion--enable :after #'my-lsp-fix-company-capf)
(defun my-company-yasnippet-disable-inline (fn cmd &optional arg &rest _ignore)
"Enable yasnippet but disable it inline."
(if (eq cmd 'prefix)
(when-let ((prefix (funcall fn 'prefix)))
(unless (memq (char-before (- (point) (length prefix)))
'(?. ?< ?> ?\( ?\) ?\[ ?{ ?} ?\" ?' ?`))
prefix))
(progn
(when (and (bound-and-true-p lsp-mode)
arg (not (get-text-property 0 'yas-annotation-patch arg)))
(let* ((name (get-text-property 0 'yas-annotation arg))
(snip (format "%s (Snippet)" name))
(len (length arg)))
(put-text-property 0 len 'yas-annotation snip arg)
(put-text-property 0 len 'yas-annotation-patch t arg)))
(funcall fn cmd arg))))
(advice-add #'company-yasnippet :around #'my-company-yasnippet-disable-inline))
))

View File

@ -296,29 +296,10 @@
:straight t
:hook (after-init . winner-mode))
;; Permitir snippets
(use-package yasnippet
:defer t
:straight t
:ensure t
:bind (:map yas-minor-mode-map
("TAB" . nil)
("<tab>" . nil)) ;; unbid tab for yasnippets
:custom
(yas-prompt-functions '(yas-completing-prompt))
:hook
((prog-mode feature-mode) . yas-minor-mode-on)
(html-mode . yas-minor-mode))
;; Coleción de snippets
(use-package yasnippet-snippets
:ensure t
:defer t
:straight t)
(use-package esup
:ensure t
:straight t)
;; Emacs Start Up Profiler
;; (use-package esup
;; :ensure t
;; :straight t)
(provide 'init-packages)
;;; init-packages.el ends here