Browse Source

emacs: add javascript support

master
Kevin Baensch 3 months ago
parent
commit
fe0fe21a12
Signed by: derped GPG Key ID: C0F1D326C7626543
  1. 6
      pkgsets/emacs/company.nix
  2. 1
      pkgsets/emacs/nix-mode.nix
  3. 62
      pkgsets/emacs/web-mode.nix

6
pkgsets/emacs/company.nix

@ -99,10 +99,14 @@ in mkIf (elem "emacs::company" config.machine.pkgs) {
programs.emacs.init.usePackage = {
company = {
enable = true;
package = epkgs: [ epkgs.company epkgs.company-web ];
diminish = [ "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)))))'';
''(rust-mode . (lambda () (setq company-backends '((company-capf :with company-yasnippet)))))''
++ optional (elem "emacs::web-mode" config.machine.pkgs)
''(web-mode . (lambda () (set (make-local-variable 'company-backends) '(company-web-html company-css))
(company-mode t)))'';
bind = { "\t" = "'company-complete-common"; };
init = ''(require 'ffap)'';
config = ''

1
pkgsets/emacs/nix-mode.nix

@ -6,5 +6,6 @@ mkIf (elem "emacs::nix-mode" config.machine.pkgs) {
programs.emacs.init.usePackage.nix-mode = {
enable = true;
mode = [ ''"\\.nix\\'"'' ];
config = ''(setq nix-nixfmt-bin "nixfmt -w 150")'';
};
}

62
pkgsets/emacs/web-mode.nix

@ -3,23 +3,49 @@
with lib;
mkIf (elem "emacs::web-mode" config.machine.pkgs) {
programs.emacs.init.usePackage.web-mode = {
enable = true;
mode = [
''("\\.html?\\'" . web-mode)''
''("\\.phtml\\'" . web-mode)''
''("\\.tpl\\.php\\'" . web-mode)''
''("\\.[agj]sp\\'" . web-mode)''
''("\\.as[cp]x\\'" . web-mode)''
''("\\.erb\\'" . web-mode)''
''("\\.mustache\\'" . web-mode)''
''("\\.djhtml\\'" . web-mode)''
];
config = ''
(setq web-mode-engines-alist
'(("php" . "\\.phtml\\'")
("blade" . "\\.blade\\."))
)
'';
programs.emacs.init.usePackage = {
web-mode = {
enable = true;
# bind = {};
mode = [
''("\\.html\\'" . web-mode)''
''("\\.css\\'" . web-mode)''
''("\\.html?\\'" . web-mode)''
''("\\.phtml\\'" . web-mode)''
''("\\.tpl\\.php\\'" . web-mode)''
''("\\.[agj]sp\\'" . web-mode)''
''("\\.as[cp]x\\'" . web-mode)''
''("\\.erb\\'" . web-mode)''
''("\\.mustache\\'" . web-mode)''
''("\\.djhtml\\'" . web-mode)''
];
config = ''
(setq web-mode-engines-alist
'(("php" . "\\.phtml\\'")
("blade" . "\\.blade\\."))
)
'';
};
js2-mode = {
enable = true;
};
tide = {
enable = true;
after = [ "typescript-mode" "company" "flycheck" ];
hook = [
"(typescript-mode . tide-setup)"
"(typescript-mode . tide-hl-identifier-mode)"
"(before-save . tide-format-before-save)"
];
config = ''
(setq company-tooltip-align-annotations t)
'';
};
impatient-mode = {
enable = true;
};
simple-httpd = {
enable = true;
};
};
}
Loading…
Cancel
Save