emacs: add javascript support
This commit is contained in:
parent
f7a10421a5
commit
fe0fe21a12
3 changed files with 50 additions and 19 deletions
|
@ -99,10 +99,14 @@ in mkIf (elem "emacs::company" config.machine.pkgs) {
|
||||||
programs.emacs.init.usePackage = {
|
programs.emacs.init.usePackage = {
|
||||||
company = {
|
company = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = epkgs: [ epkgs.company epkgs.company-web ];
|
||||||
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)
|
++ 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"; };
|
bind = { "\t" = "'company-complete-common"; };
|
||||||
init = ''(require 'ffap)'';
|
init = ''(require 'ffap)'';
|
||||||
config = ''
|
config = ''
|
||||||
|
|
|
@ -6,5 +6,6 @@ mkIf (elem "emacs::nix-mode" config.machine.pkgs) {
|
||||||
programs.emacs.init.usePackage.nix-mode = {
|
programs.emacs.init.usePackage.nix-mode = {
|
||||||
enable = true;
|
enable = true;
|
||||||
mode = [ ''"\\.nix\\'"'' ];
|
mode = [ ''"\\.nix\\'"'' ];
|
||||||
|
config = ''(setq nix-nixfmt-bin "nixfmt -w 150")'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,13 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
mkIf (elem "emacs::web-mode" config.machine.pkgs) {
|
mkIf (elem "emacs::web-mode" config.machine.pkgs) {
|
||||||
programs.emacs.init.usePackage.web-mode = {
|
programs.emacs.init.usePackage = {
|
||||||
|
web-mode = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# bind = {};
|
||||||
mode = [
|
mode = [
|
||||||
|
''("\\.html\\'" . web-mode)''
|
||||||
|
''("\\.css\\'" . web-mode)''
|
||||||
''("\\.html?\\'" . web-mode)''
|
''("\\.html?\\'" . web-mode)''
|
||||||
''("\\.phtml\\'" . web-mode)''
|
''("\\.phtml\\'" . web-mode)''
|
||||||
''("\\.tpl\\.php\\'" . web-mode)''
|
''("\\.tpl\\.php\\'" . web-mode)''
|
||||||
|
@ -22,4 +26,26 @@ mkIf (elem "emacs::web-mode" config.machine.pkgs) {
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
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…
Reference in a new issue