Makes company speaks yasnippet

This commit is contained in:
2023-09-30 13:15:35 +02:00
parent fa9286e318
commit 7cf57b9ab8

27
.emacs
View File

@@ -10,11 +10,6 @@
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(c-basic-offset 4) '(c-basic-offset 4)
'(c-default-style
'((c++-mode . "tuleu-c++")
(java-mode . "java")
(awk-mode . "awk")
(other . "gnu")))
'(company-idle-delay 20.0) '(company-idle-delay 20.0)
'(compilation-scroll-output 'first-error) '(compilation-scroll-output 'first-error)
'(custom-safe-themes '(custom-safe-themes
@@ -230,7 +225,20 @@
:delight :delight
:bind ( ("M-TAB" . company-complete) ) :bind ( ("M-TAB" . company-complete) )
:config :config
(global-company-mode t) (defun atu/company-prog-mode ()
"Starts yas company and set up backends accordingly"
(yas-minor-mode)
(company-mode)
(setq-local company-backends
'(
(company-yasnippet company-capf)
company-files
company-keywords
)
)
)
:hook
(prog-mode . atu/company-prog-mode)
) )
(use-package cmake-mode (use-package cmake-mode
@@ -281,15 +289,14 @@
(use-package yasnippet (use-package yasnippet
:delight yas-minor-mode :delight yas-minor-mode
:config :config
(yas-global-mode)
:after (company)
:bind ( :map yas-minor-mode-map :bind ( :map yas-minor-mode-map
("TAB" . nil) ("TAB" . nil)
) )
) )
(use-package yasnippet-snippets (use-package yasnippet-snippets
:after (yasnippet) :after yasnippet
) )
(use-package projectile (use-package projectile
@@ -348,7 +355,6 @@
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
:bind-keymap ("C-c l" . lsp-command-map) :bind-keymap ("C-c l" . lsp-command-map)
:config :config
(yas-minor-mode)
(if (display-graphic-p) (if (display-graphic-p)
(setq lsp-ui-doc-use-webkit t) (setq lsp-ui-doc-use-webkit t)
) )
@@ -360,6 +366,7 @@
) )
) )
) )
(setq lsp-completion-provider :none)
:bind ( :bind (
("C-c C-d" . lsp-ui-doc-toggle) ("C-c C-d" . lsp-ui-doc-toggle)
) )