1
0
Fork 0

emacs: Add yasnippets to rust company completions.

This commit is contained in:
Kevin Baensch 2020-03-27 13:05:57 +01:00
parent 3cd9d1c77b
commit 5242db83e2
Signed by: derped
GPG Key ID: C0F1D326C7626543
3 changed files with 25 additions and 1 deletions

View File

@ -100,7 +100,9 @@ in mkIf (elem "emacs::company" config.machine.pkgs) {
company = { company = {
enable = true; enable = true;
diminish = [ "company-mode" ]; diminish = [ "company-mode" ];
hook = [ "(after-init . global-company-mode)" ]; hook = [ "(after-init . global-company-mode)" ]
++ optional (elem "emacs::rust" config.machine.pkgs)
''(rust-mode . (lambda () (setq company-backends '((company-capf :with company-yasnippet)))))'';
bind = { "\t" = "'company-complete-common"; }; bind = { "\t" = "'company-complete-common"; };
init = ''(require 'ffap)''; init = ''(require 'ffap)'';
config = '' config = ''
@ -119,6 +121,7 @@ in mkIf (elem "emacs::company" config.machine.pkgs) {
([remap complete-symbol] . company-complete-common)) ([remap complete-symbol] . company-complete-common))
''; '';
}; };
company-box = { company-box = {
enable = true; enable = true;
hook = [ "(company-mode . (lambda () (company-box-mode)))" ]; hook = [ "(company-mode . (lambda () (company-box-mode)))" ];

View File

@ -15,6 +15,9 @@ mkIf (elem "emacs::lsp" config.machine.pkgs) {
${optionalString (elem "emacs::rust" config.machine.pkgs) ${optionalString (elem "emacs::rust" config.machine.pkgs)
''(rust-mode . "rust")''} ''(rust-mode . "rust")''}
)) ))
${optionalString (elem "emacs::rust" config.machine.pkgs) ''
(setq lsp-rust-clippy-preference "on")
''}
''; '';
}; };

View File

@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
with lib;
mkIf (elem "emacs::yasnippet" config.machine.pkgs) {
programs.emacs.init.usePackage = {
yasnippet = {
enable = true;
hook = [ "(after-init . yas-global-mode)" ];
# config = ''
# '';
};
yasnippet-snippets = {
enable = true;
};
};
}