Reorganize modules
This commit is contained in:
parent
50ea98319f
commit
f453b3cee1
55 changed files with 0 additions and 1535 deletions
10
modules/lang/asm/config.el
Normal file
10
modules/lang/asm/config.el
Normal file
|
@ -0,0 +1,10 @@
|
|||
;;; module-asm.el
|
||||
|
||||
(use-package mips-mode :mode "\\.mips$")
|
||||
|
||||
(use-package haxor-mode :mode "\\.hax$")
|
||||
|
||||
(use-package nasm-mode :defer t)
|
||||
|
||||
(provide 'module-asm)
|
||||
;;; module-asm.el ends here
|
91
modules/lang/cc/config.el
Normal file
91
modules/lang/cc/config.el
Normal file
|
@ -0,0 +1,91 @@
|
|||
;;; module-cc.el --- C, C++, and Objective-C
|
||||
|
||||
(use-package cc-mode
|
||||
:commands (c-mode c++-mode objc-mode java-mode)
|
||||
:mode ("\\.mm" . objc-mode)
|
||||
:init
|
||||
(add-hook! (c-mode c++-mode) 'doom|extra-fontify-c/c++)
|
||||
(add-hook 'c-mode-hook 'highlight-numbers-mode)
|
||||
(add-hook 'c++-mode-hook 'doom|extra-fontify-c++)
|
||||
(add-hook 'c-initialization-hook 'doom|init-c/c++-settings)
|
||||
|
||||
;; C++ header files
|
||||
(push (cons (lambda () (and (f-ext? buffer-file-name "h")
|
||||
(or (f-exists? (f-swap-ext buffer-file-name "cpp"))
|
||||
(awhen (car-safe (projectile-get-other-files (buffer-file-name) (projectile-current-project-files)))
|
||||
(f-ext? it "cpp")))))
|
||||
'c++-mode)
|
||||
magic-mode-alist)
|
||||
|
||||
;; Obj-C
|
||||
(push (cons (lambda () (and (f-ext? buffer-file-name "h")
|
||||
(re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))
|
||||
'objc-mode)
|
||||
magic-mode-alist)
|
||||
|
||||
:config
|
||||
(def-electric! (c-mode c++-mode objc-mode) :chars (?\n ?\}))
|
||||
(def-company-backend! (c-mode c++-mode objc-mode) (irony-c-headers irony))
|
||||
|
||||
(setq c-tab-always-indent nil
|
||||
c-electric-flag nil)
|
||||
|
||||
(map! :map c-mode-base-map (:localleader :nv ";" 'doom/append-semicolon))
|
||||
|
||||
(sp-with-modes '(c-mode c++-mode objc-mode java-mode)
|
||||
(sp-local-pair "<" ">" :when '(doom/sp-point-is-template-p doom/sp-point-after-include-p))
|
||||
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
;; Doxygen blocks
|
||||
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
|
||||
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
|
||||
|
||||
;; Improve indentation of inline lambdas in C++11
|
||||
(advice-add 'c-lineup-arglist :around 'doom/c-lineup-arglist))
|
||||
|
||||
(use-package modern-cpp-font-lock
|
||||
:commands modern-c++-font-lock-mode
|
||||
:init (add-hook 'c++-mode-hook 'modern-c++-font-lock-mode))
|
||||
|
||||
(use-package irony
|
||||
:after cc-mode
|
||||
:config
|
||||
(setq irony-server-install-prefix (concat doom-ext-dir "/irony-mode/server/build/irony/"))
|
||||
(add-hook! c++-mode
|
||||
(make-local-variable 'irony-additional-clang-options)
|
||||
(push "-std=c++11" irony-additional-clang-options))
|
||||
|
||||
(require 'irony-eldoc)
|
||||
(require 'company-irony)
|
||||
(require 'company-irony-c-headers)
|
||||
(require 'flycheck-irony)
|
||||
(flycheck-irony-setup)
|
||||
|
||||
;; some c-mode dervied modes wrongfully trigger these hooks (like php-mode)
|
||||
(add-hook! (c-mode c++-mode objc-mode)
|
||||
(when (memq major-mode '(c-mode c++-mode objc-mode))
|
||||
(flycheck-mode +1)
|
||||
(irony-mode +1)
|
||||
(eldoc-mode +1)
|
||||
(irony-eldoc +1))))
|
||||
|
||||
(use-package disaster :commands (disaster))
|
||||
|
||||
;;
|
||||
(use-package cmake-mode
|
||||
:mode "CMakeLists\\.txt$"
|
||||
:config (def-company-backend! cmake-mode (cmake yasnippet)))
|
||||
|
||||
(use-package company-cmake :after cmake-mode)
|
||||
|
||||
(use-package glsl-mode :mode ("\\.glsl\\'" "\\.vert\\'" "\\.frag\\'" "\\.geom\\'"))
|
||||
|
||||
(use-package cuda-mode :mode "\\.cuh?$")
|
||||
|
||||
(use-package opencl-mode :mode "\\.cl$")
|
||||
|
||||
(use-package demangle-mode
|
||||
:commands demangle-mode
|
||||
:init (add-hook 'llvm-mode-hook 'demangle-mode))
|
||||
|
||||
(provide 'module-cc)
|
||||
;;; module-cc.el ends here
|
16
modules/lang/crystal/config.el
Normal file
16
modules/lang/crystal/config.el
Normal file
|
@ -0,0 +1,16 @@
|
|||
;;; module-crystal.el
|
||||
|
||||
(use-package crystal-mode
|
||||
:mode "\\.cr$"
|
||||
:interpreter "crystal"
|
||||
:config
|
||||
(def-docset! crystal-mode "crystal")
|
||||
(after! quickrun
|
||||
(quickrun-add-command
|
||||
"crystal" '((:command . "crystal")
|
||||
(:exec . "%c %s")
|
||||
(:description . "Run Crystal script"))
|
||||
:mode 'crystal-mode)))
|
||||
|
||||
(provide 'module-crystal)
|
||||
;;; module-crystal.el ends here
|
49
modules/lang/csharp/config.el
Normal file
49
modules/lang/csharp/config.el
Normal file
|
@ -0,0 +1,49 @@
|
|||
;;; module-csharp.el --- -*- no-byte-compile: t; -*-
|
||||
|
||||
(use-package csharp-mode
|
||||
:mode "\\.cs$"
|
||||
:init (add-hook 'csharp-mode-hook 'flycheck-mode))
|
||||
|
||||
(use-package shader-mode :mode "\\.shader$") ; unity shaders
|
||||
|
||||
(use-package omnisharp
|
||||
:commands (omnisharp-mode)
|
||||
:preface
|
||||
(setq omnisharp-auto-complete-want-documentation nil
|
||||
omnisharp-server-executable-path (concat doom-ext-dir "/OmniSharp.exe"))
|
||||
:when (file-exists-p omnisharp-server-executable-path)
|
||||
:init (add-hook! csharp-mode '(eldoc-mode omnisharp-mode))
|
||||
:config
|
||||
(def-company-backend! csharp-mode (omnisharp))
|
||||
(map! :map omnisharp-mode-map
|
||||
"gd" 'omnisharp-go-to-definition
|
||||
(:localleader
|
||||
"tr" (λ! (omnisharp-unit-test "fixture"))
|
||||
"ts" (λ! (omnisharp-unit-test "single"))
|
||||
"ta" (λ! (omnisharp-unit-test "all"))))
|
||||
|
||||
;; Map all refactor commands (see emr)
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
(title (cadr x)))
|
||||
(emr-declare-command
|
||||
(intern (format "omnisharp-%s" (symbol-name command-name)))
|
||||
:title title :modes 'omnisharp-mode)))
|
||||
'((find-usages "find usages")
|
||||
(find-implementations "find implementations")
|
||||
(fix-code-issue-at-point "fix code issue at point")
|
||||
(fix-usings "fix usings")
|
||||
(rename "rename")
|
||||
(current-type-information "current type information")
|
||||
(current-type-documentation "current type documentation")
|
||||
(navigate-to-current-file-member "navigate to current file member")
|
||||
(navigate-to-solution-member "navigate to solution member")
|
||||
(navigate-to-solution-file-then-file-member "navigate to solution file then member")
|
||||
(navigate-to-solution-file "navigate to solution file")
|
||||
(navigate-to-region "navigate to region")
|
||||
(show-last-auto-complete-result "last auto complete result")
|
||||
(show-overloads-at-point "show overloads at point")
|
||||
(recompile "recompile"))))
|
||||
|
||||
(provide 'module-csharp)
|
||||
;;; module-csharp.el ends here
|
52
modules/lang/css/config.el
Normal file
52
modules/lang/css/config.el
Normal file
|
@ -0,0 +1,52 @@
|
|||
;;; module-css.el
|
||||
|
||||
(after! emr
|
||||
(emr-declare-command 'doom/css-toggle-inline-or-block
|
||||
:title "toggle inline/block"
|
||||
:modes '(css-mode less-css-mode scss-mode)
|
||||
:predicate (lambda () (not (use-region-p)))))
|
||||
|
||||
(sp-with-modes '(css-mode scss-mode less-css-mode stylus-mode)
|
||||
(sp-local-pair "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC"))))
|
||||
|
||||
(map! (:map* (css-mode-map scss-mode-map less-css-mode-map)
|
||||
:n "M-R" 'doom/web-refresh-browser)
|
||||
(:map* (css-mode-map scss-mode-map less-css-mode-map)
|
||||
:localleader :nv ";" 'doom/append-semicolon))
|
||||
|
||||
;; css & scss
|
||||
(use-package css-mode
|
||||
:mode (("\\.css$" . css-mode)
|
||||
("\\.scss$" . scss-mode))
|
||||
:init
|
||||
(add-hook! css-mode
|
||||
'(yas-minor-mode-on flycheck-mode rainbow-mode highlight-numbers-mode
|
||||
doom|counsel-css-imenu-setup))
|
||||
:config
|
||||
(def-company-backend! css-mode (css yasnippet))
|
||||
(push '("css" "scss" "sass" "less" "styl") projectile-other-file-alist)
|
||||
|
||||
(def-builder! scss-mode doom/scss-build)
|
||||
(def-company-backend! scss-mode (css yasnippet))
|
||||
(def-docset! scss-mode "sass,bourbon,compass,neat,css")
|
||||
(push '("scss" "css") projectile-other-file-alist))
|
||||
|
||||
(use-package sass-mode
|
||||
:mode "\\.sass$"
|
||||
:config
|
||||
(setq sass-command-options '("--style compressed"))
|
||||
(def-builder! sass-mode doom/sass-build)
|
||||
(def-company-backend! sass-mode (css yasnippet))
|
||||
(push '("sass" "css") projectile-other-file-alist))
|
||||
|
||||
(use-package less-css-mode
|
||||
:mode "\\.less$"
|
||||
:config (push '("less" "css") projectile-other-file-alist))
|
||||
|
||||
(use-package stylus-mode
|
||||
:mode "\\.styl$"
|
||||
:init (add-hook! stylus-mode '(yas-minor-mode-on flycheck-mode))
|
||||
:config (push '("styl" "css") projectile-other-file-alist))
|
||||
|
||||
(provide 'module-css)
|
||||
;;; module-css.el ends here
|
40
modules/lang/data/config.el
Normal file
40
modules/lang/data/config.el
Normal file
|
@ -0,0 +1,40 @@
|
|||
;;; module-data.el
|
||||
|
||||
(associate! conf-mode :match "/sxhkdrc$")
|
||||
|
||||
(associate! nxml-mode :match "\\.plist$")
|
||||
(after! nxml-mode
|
||||
(def-company-backend! nxml-mode (nxml yasnippet)))
|
||||
|
||||
(use-package toml-mode :mode "\\.toml$")
|
||||
|
||||
(use-package yaml-mode :mode "\\.ya?ml$"
|
||||
:config (def-electric! yaml-mode :chars (?\n ?\: ?\-)))
|
||||
|
||||
(use-package json-mode :mode "\\.js\\(on\\|[hl]int\\(rc\\)?\\)$"
|
||||
:config (def-electric! json-mode :chars (?\n ?: ?{ ?})))
|
||||
|
||||
(use-package vimrc-mode
|
||||
:mode ("/\\.?g?vimrc$" "\\.vim$" "/\\.vim/rc/.+$" "/\\.?vimperatorrc$" "\\.vimp$"))
|
||||
|
||||
(use-package dockerfile-mode :mode "/Dockerfile$"
|
||||
:config
|
||||
(def-docset! dockerfile-mode "docker")
|
||||
(def-builder! dockerfile-mode dockerfile-build-buffer "Dockerfile"))
|
||||
|
||||
;; For ROM hacking or debugging
|
||||
(use-package hexl-mode
|
||||
:mode ("\\.hex$" "\\.nes$"))
|
||||
|
||||
;;
|
||||
(def-project-type! ansible-mode "ans"
|
||||
:modes (yaml-mode)
|
||||
:files ("roles/")
|
||||
(def-company-backend! ansible-mode (ansible)))
|
||||
(use-package company-ansible :commands (company-ansible))
|
||||
|
||||
(def-project-type! vagrant "vagrant"
|
||||
:files ("Vagrantfile"))
|
||||
|
||||
(provide 'module-data)
|
||||
;;; module-data.el ends here
|
120
modules/lang/emacs-lisp/config.el
Normal file
120
modules/lang/emacs-lisp/config.el
Normal file
|
@ -0,0 +1,120 @@
|
|||
;;; module-elisp --- all things lisp
|
||||
|
||||
(associate! emacs-lisp-mode :match "\\(/Cask\\|\\.\\(el\\|gz\\)\\)$")
|
||||
(add-hook! emacs-lisp-mode '(eldoc-mode highlight-numbers-mode))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook 'doom/elisp-init)
|
||||
(defun doom/elisp-init ()
|
||||
(def-company-backend! emacs-lisp-mode (elisp yasnippet))
|
||||
(def-repl! emacs-lisp-mode doom/elisp-inf-ielm)
|
||||
(def-rotate! emacs-lisp-mode
|
||||
:symbols (("t" "nil")
|
||||
("let" "let*")
|
||||
("when" "unless")
|
||||
("append" "prepend")
|
||||
("advice-add" "advice-remove")
|
||||
("add-hook" "add-hook!" "remove-hook")))
|
||||
|
||||
(def-popup! "*ert*" :align below :size 20 :noselect t)
|
||||
|
||||
;; Don't affect lisp indentation (only `tab-width')
|
||||
(setq editorconfig-indentation-alist
|
||||
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
|
||||
editorconfig-indentation-alist))
|
||||
|
||||
;; Real go-to-definition for elisp
|
||||
(map! :map emacs-lisp-mode-map :m "gd" 'doom/elisp-find-function-at-pt)
|
||||
|
||||
(remove-hook 'emacs-lisp-mode-hook 'doom/elisp-init))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook 'doom/elisp-hook)
|
||||
(defun doom/elisp-hook ()
|
||||
(setq mode-name "Elisp") ; [pedantry intensifies]
|
||||
|
||||
(font-lock-add-keywords
|
||||
nil `(("(\\(lambda\\)" (1 (doom/show-as ?λ)))
|
||||
("(\\(\\(doom\\)\\([-:/|][^) ]*\\)?\\)[) \n]" (1 font-lock-builtin-face))
|
||||
;; Highlight doom macros (macros are fontified in emacs 25+)
|
||||
(,(concat
|
||||
"(\\(def-"
|
||||
(regexp-opt '("electric" "project-type" "company-backend"
|
||||
"builder" "repl" "text-obj" "tmp-excmd" "rotate"
|
||||
"repeat" "yas-mode" "version-cmd" "docset" "popup"
|
||||
"open-with"))
|
||||
"!\\)")
|
||||
(1 font-lock-keyword-face append))
|
||||
(,(concat
|
||||
"(\\("
|
||||
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
|
||||
"associate" "define-org-link" "ex" "ex-local"
|
||||
"define-org-section" "set" "noop"))
|
||||
"!\\)")
|
||||
(1 font-lock-keyword-face append))
|
||||
;; Ert
|
||||
(,(concat
|
||||
"("
|
||||
(regexp-opt '("ert-deftest") t)
|
||||
" \\([^ ]+\\)")
|
||||
(1 font-lock-keyword-face)
|
||||
(2 font-lock-function-name-face))))
|
||||
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
|
||||
|
||||
(dolist (i '(("Evil Command" "\\(^\\s-*(evil-define-command +\\)\\(\\_<.+\\_>\\)" 2)
|
||||
("Evil Operator" "\\(^\\s-*(evil-define-operator +\\)\\(\\_<.+\\_>\\)" 2)
|
||||
("Package" "\\(^\\s-*(use-package +\\)\\(\\_<[^ \n]+\\_>\\)" 2)
|
||||
("Spaceline Segment" "\\(^\\s-*(spaceline-define-segment +\\)\\(\\_<.+\\_>\\)" 2)))
|
||||
(push i imenu-generic-expression)))
|
||||
|
||||
;; Add new colors to helm-imenu
|
||||
(after! helm-imenu
|
||||
(defun helm-imenu-transformer (candidates)
|
||||
(cl-loop for (k . v) in candidates
|
||||
for types = (or (helm-imenu--get-prop k)
|
||||
(list "Function" k))
|
||||
for bufname = (buffer-name (marker-buffer v))
|
||||
for disp1 = (mapconcat
|
||||
(lambda (x)
|
||||
(propertize
|
||||
x 'face (cond ((string= x "Variables")
|
||||
'font-lock-variable-name-face)
|
||||
((or (string= x "Function")
|
||||
(string-prefix-p "Evil " x t))
|
||||
'font-lock-function-name-face)
|
||||
((string= x "Types")
|
||||
'font-lock-type-face)
|
||||
((string= x "Package")
|
||||
'font-lock-negation-char-face)
|
||||
((string= x "Spaceline Segment")
|
||||
'font-lock-string-face))))
|
||||
types helm-imenu-delimiter)
|
||||
for disp = (propertize disp1 'help-echo bufname)
|
||||
collect
|
||||
(cons disp (cons k v)))))
|
||||
|
||||
|
||||
;;
|
||||
(use-package highlight-quoted
|
||||
:commands (highlight-quoted-mode)
|
||||
:init (add-hook 'emacs-lisp-mode-hook 'highlight-quoted-mode))
|
||||
|
||||
(use-package slime :defer t
|
||||
:config (setq inferior-lisp-program "clisp"))
|
||||
|
||||
(use-package auto-compile
|
||||
:commands auto-compile-on-save-mode
|
||||
:init (add-hook 'emacs-lisp-mode-hook 'auto-compile-on-save-mode)
|
||||
:config (setq auto-compile-display-buffer nil))
|
||||
|
||||
;;
|
||||
(def-project-type! emacs-ert "ert"
|
||||
:modes (emacs-lisp-mode)
|
||||
:match "/test/.+-test\\.el$"
|
||||
:bind (:localleader
|
||||
:n "tr" 'doom/ert-rerun-test
|
||||
:n "ta" 'doom/ert-run-all-tests
|
||||
:n "ts" 'doom/ert-run-test)
|
||||
(add-hook 'ert-results-mode-hook 'doom-hide-mode-line-mode))
|
||||
|
||||
(provide 'module-elisp)
|
||||
;;; module-elisp.el ends here
|
43
modules/lang/go/config.el
Normal file
43
modules/lang/go/config.el
Normal file
|
@ -0,0 +1,43 @@
|
|||
;;; module-go.el
|
||||
|
||||
(use-package go-mode
|
||||
:mode "\\.go$"
|
||||
:interpreter "go"
|
||||
:init
|
||||
(add-hook 'go-mode-hook 'flycheck-mode)
|
||||
(add-hook! go-mode (add-hook 'before-save-hook 'gofmt-before-save))
|
||||
:config
|
||||
(def-builder! go-mode "go build")
|
||||
(def-company-backend! go-mode (go yasnippet))
|
||||
(def-repl! go-mode gorepl-run)
|
||||
(map! :map go-mode-map
|
||||
:n "gd" 'godef-jump
|
||||
(:leader :n "h" 'godef-describe)
|
||||
(:localleader
|
||||
:n "tr" 'doom:go-test-run-all
|
||||
:n "ta" 'doom:go-test-run-all
|
||||
:n "ts" 'doom:go-test-run-package))
|
||||
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
(title (cadr x))
|
||||
(region-p (caddr x))
|
||||
predicate)
|
||||
(setq predicate (cond ((eq region-p 'both) nil)
|
||||
(t (if region-p
|
||||
(lambda () (use-region-p))
|
||||
(lambda () (not (use-region-p)))))))
|
||||
(emr-declare-command (intern (symbol-name command-name))
|
||||
:title title :modes 'go-mode :predicate predicate)))
|
||||
'((go-remove-unused-imports "Remove unused imports" nil)
|
||||
(gofmt "Format code" nil))))
|
||||
|
||||
(use-package go-eldoc :after go-mode
|
||||
:init (add-hook 'go-mode-hook 'go-eldoc-setup))
|
||||
|
||||
(use-package company-go :after go-mode)
|
||||
|
||||
(use-package gorepl-mode :commands (gorepl-run gorepl-run-load-current-file))
|
||||
|
||||
(provide 'module-go)
|
||||
;;; module-go.el ends here
|
20
modules/lang/haskell/config.el
Normal file
20
modules/lang/haskell/config.el
Normal file
|
@ -0,0 +1,20 @@
|
|||
;;; module-haskell.el
|
||||
|
||||
(use-package haskell
|
||||
:mode (("\\.hs$" . haskell-mode)
|
||||
("\\.ghci$" . ghci-script-mode)
|
||||
("\\.cabal$" . haskell-cabal-mode))
|
||||
:interpreter (("runghc" . haskell-mode)
|
||||
("runhaskell" . haskell-mode))
|
||||
:init (add-hook! haskell-mode '(interactive-haskell-mode flycheck-mode))
|
||||
:config
|
||||
(def-popup! "*debug:haskell*" :size 20)
|
||||
(def-repl! haskell-mode switch-to-haskell)
|
||||
(push ".hi" completion-ignored-extensions))
|
||||
|
||||
(use-package inf-haskell
|
||||
:commands (inferior-haskell-mode inf-haskell-mode switch-to-haskell)
|
||||
:config (map! :map inf-haskell-mode-map "ESC ESC" 'doom/popup-close))
|
||||
|
||||
(provide 'module-haskell)
|
||||
;;; module-haskell.el ends here
|
37
modules/lang/java/config.el
Normal file
37
modules/lang/java/config.el
Normal file
|
@ -0,0 +1,37 @@
|
|||
;;; module-java.el
|
||||
|
||||
(use-package meghanada
|
||||
:commands meghanada-mode
|
||||
:init
|
||||
(add-hook! java-mode '(meghanada-mode flycheck-mode))
|
||||
:config
|
||||
(def-docset! java-mode "java,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc")
|
||||
(def-builder! java-mode meghanada-compile-project)
|
||||
|
||||
(setq meghanada-server-install-dir (f-expand "meghanada-server" doom-ext-dir)
|
||||
meghanada-use-company t
|
||||
meghanada-use-flycheck t
|
||||
meghanada-use-auto-start t)
|
||||
|
||||
(unless (f-exists? (meghanada--locate-server-jar))
|
||||
(meghanada-install-server))
|
||||
|
||||
(map! :map meghanada-mode-map :m "gd" 'meghanada-jump-declaration))
|
||||
|
||||
(use-package android-mode
|
||||
:commands android-mode
|
||||
:init
|
||||
(add-hook! (java-mode groovy-mode nxml-mode) 'doom|android-mode-enable-maybe)
|
||||
:config
|
||||
(def-yas-mode! android-mode)
|
||||
(after! company-dict
|
||||
(push 'android-mode company-dict-minor-mode-list)))
|
||||
|
||||
(use-package groovy-mode
|
||||
:mode "\\.g\\(radle\\|vy\\|roovy\\)$"
|
||||
:config
|
||||
(after! quickrun
|
||||
(push '("\\.gvy$" . "groovy") quickrun-file-alist)))
|
||||
|
||||
(provide 'module-java)
|
||||
;;; module-java.el ends here
|
178
modules/lang/javascript/+screeps.el
Normal file
178
modules/lang/javascript/+screeps.el
Normal file
|
@ -0,0 +1,178 @@
|
|||
;;; custom-screeps.el
|
||||
|
||||
(defconst screeps-objects
|
||||
'("ConstructionSite" "Creep" "Flag" "Game" "Memory" "Mineral" "Nuke"
|
||||
"OwnedStructure" "PathFinder" "RawMemory" "Resource" "Room"
|
||||
"RoomObject" "RoomPosition" "Source"
|
||||
|
||||
"Structure" "StructureController" "StructureExtension"
|
||||
"StructureExtractor" "StructureKeeperLair" "StructureLab"
|
||||
"StructureLink" "StructureNuker" "StructureObserver"
|
||||
"StructurePortal" "StructurePowerBank" "StructurePowerSpawn"
|
||||
"StructureRampart" "StructureRoad" "StructureSpawn"
|
||||
"StructureStorage" "StructureTerminal" "StructureTower"
|
||||
"StructureWall"))
|
||||
|
||||
(defconst screeps-constants
|
||||
'("OK" "ERR_NOT_OWNER" "ERR_NO_PATH" "ERR_NAME_EXISTS" "ERR_BUSY"
|
||||
"ERR_NOT_FOUND" "ERR_NOT_ENOUGH_ENERGY" "ERR_NOT_ENOUGH_RESOURCES"
|
||||
"ERR_INVALID_TARGET" "ERR_FULL" "ERR_NOT_IN_RANGE"
|
||||
"ERR_INVALID_ARGS" "ERR_TIRED" "ERR_NO_BODYPART"
|
||||
"ERR_NOT_ENOUGH_EXTENSIONS" "ERR_RCL_NOT_ENOUGH"
|
||||
"ERR_GCL_NOT_ENOUGH"
|
||||
|
||||
"FIND_EXIT_TOP" "FIND_EXIT_RIGHT" "FIND_EXIT_BOTTOM"
|
||||
"FIND_EXIT_LEFT" "FIND_EXIT" "FIND_CREEPS" "FIND_MY_CREEPS"
|
||||
"FIND_HOSTILE_CREEPS" "FIND_SOURCES_ACTIVE" "FIND_SOURCES"
|
||||
"FIND_DROPPED_ENERGY" "FIND_DROPPED_RESOURCES" "FIND_STRUCTURES"
|
||||
"FIND_MY_STRUCTURES" "FIND_HOSTILE_STRUCTURES" "FIND_FLAGS"
|
||||
"FIND_CONSTRUCTION_SITES" "FIND_MY_SPAWNS" "FIND_HOSTILE_SPAWNS"
|
||||
"FIND_MY_CONSTRUCTION_SITES" "FIND_HOSTILE_CONSTRUCTION_SITES"
|
||||
"FIND_MINERALS" "FIND_NUKES"
|
||||
|
||||
"TOP" "TOP_RIGHT" "RIGHT" "BOTTOM_RIGHT" "BOTTOM" "BOTTOM_LEFT"
|
||||
"LEFT" "TOP_LEFT"
|
||||
|
||||
"COLOR_RED" "COLOR_PURPLE" "COLOR_BLUE" "COLOR_CYAN" "COLOR_GREEN"
|
||||
"COLOR_YELLOW" "COLOR_ORANGE" "COLOR_BROWN" "COLOR_GREY"
|
||||
"COLOR_WHITE"
|
||||
|
||||
"LOOK_CREEPS" "LOOK_ENERGY" "LOOK_RESOURCES" "LOOK_SOURCES"
|
||||
"LOOK_MINERALS" "LOOK_STRUCTURES" "LOOK_FLAGS"
|
||||
"LOOK_CONSTRUCTION_SITES" "LOOK_NUKES" "LOOK_TERRAIN"
|
||||
|
||||
"OBSTACLE_OBJECT_TYPES"
|
||||
|
||||
"MOVE" "WORK" "CARRY" "ATTACK" "RANGED_ATTACK" "TOUGH" "HEAL"
|
||||
"CLAIM"
|
||||
|
||||
"BODYPART_COST"
|
||||
|
||||
"CREEP_LIFE_TIME" "CREEP_CLAIM_LIFE_TIME" "CREEP_CORPSE_RATE"
|
||||
|
||||
"CARRY_CAPACITY" "HARVEST_POWER" "HARVEST_MINERAL_POWER"
|
||||
"REPAIR_POWER" "DISMANTLE_POWER" "BUILD_POWER" "ATTACK_POWER"
|
||||
"UPGRADE_CONTROLLER_POWER" "RANGED_ATTACK_POWER" "HEAL_POWER"
|
||||
"RANGED_HEAL_POWER" "REPAIR_COST" "DISMANTLE_COST"
|
||||
|
||||
"RAMPART_DECAY_AMOUNT" "RAMPART_DECAY_TIME" "RAMPART_HITS"
|
||||
"RAMPART_HITS_MAX"
|
||||
|
||||
"ENERGY_REGEN_TIME" "ENERGY_DECAY"
|
||||
|
||||
"SPAWN_HITS" "SPAWN_ENERGY_START" "SPAWN_ENERGY_CAPACITY"
|
||||
"CREEP_SPAWN_TIME"
|
||||
|
||||
"SOURCE_ENERGY_CAPACITY" "SOURCE_ENERGY_NEUTRAL_CAPACITY"
|
||||
"SOURCE_ENERGY_KEEPER_CAPACITY"
|
||||
|
||||
"WALL_HITS" "WALL_HITS_MAX"
|
||||
|
||||
"EXTENSION_HITS" "EXTENSION_ENERGY_CAPACITY"
|
||||
|
||||
"ROAD_HITS" "ROAD_WEAROUT" "ROAD_DECAY_AMOUNT" "ROAD_DECAY_TIME"
|
||||
|
||||
"LINK_HITS" "LINK_HITS_MAX" "LINK_CAPACITY" "LINK_COOLDOWN"
|
||||
"LINK_LOSS_RATIO"
|
||||
|
||||
"STORAGE_CAPACITY" "STORAGE_HITS"
|
||||
|
||||
"STRUCTURE_SPAWN" "STRUCTURE_EXTENSION" "STRUCTURE_ROAD"
|
||||
"STRUCTURE_WALL" "STRUCTURE_RAMPART" "STRUCTURE_KEEPER_LAIR"
|
||||
"STRUCTURE_PORTAL" "STRUCTURE_CONTROLLER" "STRUCTURE_LINK"
|
||||
"STRUCTURE_STORAGE" "STRUCTURE_TOWER" "STRUCTURE_OBSERVER"
|
||||
"STRUCTURE_POWER_BANK" "STRUCTURE_POWER_SPAWN" "STRUCTURE_EXTRACTOR"
|
||||
"STRUCTURE_LAB" "STRUCTURE_TERMINAL" "STRUCTURE_CONTAINER"
|
||||
"STRUCTURE_NUKER"
|
||||
|
||||
"CONSTRUCTION_COST"
|
||||
"CONSTRUCTION_COST_ROAD_SWAMP_RATIO"
|
||||
|
||||
"CONTROLLER_LEVELS" "CONTROLLER_STRUCTURES" "CONTROLLER_DOWNGRADE"
|
||||
"CONTROLLER_CLAIM_DOWNGRADE" "CONTROLLER_RESERVE"
|
||||
"CONTROLLER_RESERVE_MAX" "CONTROLLER_MAX_UPGRADE_PER_TICK"
|
||||
"CONTROLLER_ATTACK_BLOCKED_UPGRADE"
|
||||
|
||||
"TOWER_HITS" "TOWER_CAPACITY" "TOWER_ENERGY_COST"
|
||||
"TOWER_POWER_ATTACK" "TOWER_POWER_HEAL" "TOWER_POWER_REPAIR"
|
||||
"TOWER_OPTIMAL_RANGE" "TOWER_FALLOFF_RANGE" "TOWER_FALLOFF"
|
||||
|
||||
"OBSERVER_HITS" "OBSERVER_RANGE"
|
||||
|
||||
"POWER_BANK_HITS" "POWER_BANK_CAPACITY_MAX"
|
||||
"POWER_BANK_CAPACITY_MIN" "POWER_BANK_CAPACITY_CRIT"
|
||||
"POWER_BANK_DECAY" "POWER_BANK_HIT_BACK"
|
||||
|
||||
"POWER_SPAWN_HITS" "POWER_SPAWN_ENERGY_CAPACITY"
|
||||
"POWER_SPAWN_POWER_CAPACITY" "POWER_SPAWN_ENERGY_RATIO"
|
||||
|
||||
"EXTRACTOR_HITS"
|
||||
|
||||
"LAB_HITS" "LAB_MINERAL_CAPACITY"
|
||||
"LAB_ENERGY_CAPACITY" "LAB_BOOST_ENERGY" "LAB_BOOST_MINERAL"
|
||||
"LAB_COOLDOWN"
|
||||
|
||||
"GCL_POW" "GCL_MULTIPLY" "GCL_NOVICE"
|
||||
|
||||
"MODE_SIMULATION" "MODE_SURVIVAL" "MODE_WORLD" "MODE_ARENA"
|
||||
|
||||
"TERRAIN_MASK_WALL" "TERRAIN_MASK_SWAMP" "TERRAIN_MASK_LAVA"
|
||||
|
||||
"MAX_CONSTRUCTION_SITES" "MAX_CREEP_SIZE"
|
||||
|
||||
"MINERAL_REGEN_TIME" "MINERAL_MIN_AMOUNT" "MINERAL_RANDOM_FACTOR"
|
||||
|
||||
"TERMINAL_CAPACITY" "TERMINAL_HITS" "TERMINAL_SEND_COST"
|
||||
"TERMINAL_MIN_SEND"
|
||||
|
||||
"CONTAINER_HITS" "CONTAINER_CAPACITY" "CONTAINER_DECAY"
|
||||
"CONTAINER_DECAY_TIME" "CONTAINER_DECAY_TIME_OWNED"
|
||||
|
||||
"NUKER_HITS" "NUKER_COOLDOWN" "NUKER_ENERGY_CAPACITY"
|
||||
"NUKER_GHODIUM_CAPACITY" "NUKE_LAND_TIME" "NUKE_RANGE" "NUKE_DAMAGE"
|
||||
|
||||
"RESOURCE_ENERGY" "RESOURCE_POWER"
|
||||
|
||||
"RESOURCE_HYDROGEN" "RESOURCE_OXYGEN" "RESOURCE_UTRIUM"
|
||||
"RESOURCE_LEMERGIUM" "RESOURCE_KEANIUM" "RESOURCE_ZYNTHIUM"
|
||||
"RESOURCE_CATALYST" "RESOURCE_GHODIUM"
|
||||
|
||||
"RESOURCE_HYDROXIDE" "RESOURCE_ZYNTHIUM_KEANITE"
|
||||
"RESOURCE_UTRIUM_LEMERGITE"
|
||||
|
||||
"RESOURCE_UTRIUM_HYDRIDE" "RESOURCE_UTRIUM_OXIDE"
|
||||
"RESOURCE_KEANIUM_HYDRIDE" "RESOURCE_KEANIUM_OXIDE"
|
||||
"RESOURCE_LEMERGIUM_HYDRIDE" "RESOURCE_LEMERGIUM_OXIDE"
|
||||
"RESOURCE_ZYNTHIUM_HYDRIDE" "RESOURCE_ZYNTHIUM_OXIDE"
|
||||
"RESOURCE_GHODIUM_HYDRIDE" "RESOURCE_GHODIUM_OXIDE"
|
||||
|
||||
"RESOURCE_UTRIUM_ACID" "RESOURCE_UTRIUM_ALKALIDE"
|
||||
"RESOURCE_KEANIUM_ACID" "RESOURCE_KEANIUM_ALKALIDE"
|
||||
"RESOURCE_LEMERGIUM_ACID" "RESOURCE_LEMERGIUM_ALKALIDE"
|
||||
"RESOURCE_ZYNTHIUM_ACID" "RESOURCE_ZYNTHIUM_ALKALIDE"
|
||||
"RESOURCE_GHODIUM_ACID" "RESOURCE_GHODIUM_ALKALIDE"
|
||||
|
||||
"RESOURCE_CATALYZED_UTRIUM_ACID"
|
||||
"RESOURCE_CATALYZED_UTRIUM_ALKALIDE"
|
||||
"RESOURCE_CATALYZED_KEANIUM_ACID"
|
||||
"RESOURCE_CATALYZED_KEANIUM_ALKALIDE"
|
||||
"RESOURCE_CATALYZED_LEMERGIUM_ACID"
|
||||
"RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE"
|
||||
"RESOURCE_CATALYZED_ZYNTHIUM_ACID"
|
||||
"RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE"
|
||||
"RESOURCE_CATALYZED_GHODIUM_ACID"
|
||||
"RESOURCE_CATALYZED_GHODIUM_ALKALIDE"
|
||||
|
||||
"REACTIONS" "BODYPARTS_ALL" "RESOURCES_ALL" "COLORS_ALL"))
|
||||
|
||||
(def-project-type! screeps "screeps"
|
||||
:match "/screeps/.+$"
|
||||
:modes (nodejs-project-mode))
|
||||
|
||||
(add-hook! screeps-project-mode
|
||||
(when (eq major-mode 'js2-mode)
|
||||
(add-to-list 'flycheck-disabled-checkers 'javascript-jshint)
|
||||
(setq js2-additional-externs (append '("_") screeps-objects screeps-constants))))
|
||||
|
||||
(provide 'custom-screeps)
|
||||
;;; custom-screeps.el ends here
|
169
modules/lang/javascript/config.el
Normal file
169
modules/lang/javascript/config.el
Normal file
|
@ -0,0 +1,169 @@
|
|||
;;; module-js.el
|
||||
|
||||
(use-package unityjs-mode
|
||||
:mode "/Assets/.*\\.js$"
|
||||
:config (add-hook 'unityjs-mode-hook 'flycheck-mode))
|
||||
|
||||
(use-package js2-mode
|
||||
:mode "\\.js$"
|
||||
:interpreter "node"
|
||||
:init (add-hook! js2-mode '(tern-mode flycheck-mode))
|
||||
:config
|
||||
(def-repl! js2-mode nodejs-repl)
|
||||
(def-company-backend! js2-mode (tern))
|
||||
(def-docset! js2-mode "js,jquery,nodejs,angularjs,express")
|
||||
(def-electric! js2-mode :chars (?\} ?\) ?.) :words ("||" "&&"))
|
||||
(setq-default
|
||||
js2-skip-preprocessor-directives t
|
||||
js2-highlight-external-variables nil
|
||||
js2-mode-show-parse-errors nil)
|
||||
|
||||
(add-hook! lb6-project-mode
|
||||
(when (eq major-mode 'js2-mode)
|
||||
(setq js2-additional-externs '("LaunchBar" "File" "Action" "HTTP" "include" "Lib"))))
|
||||
|
||||
;; [pedantry intensifies]
|
||||
(add-hook! js2-mode (setq mode-name "JS2"
|
||||
js-switch-indent-offset js-indent-level))
|
||||
|
||||
(map! :map js2-mode-map (:localleader :nv ";" 'doom/append-semicolon)))
|
||||
|
||||
(use-package tern
|
||||
:after js2-mode
|
||||
:commands (tern-mode))
|
||||
|
||||
(use-package company-tern
|
||||
:after tern)
|
||||
|
||||
(use-package js2-refactor
|
||||
:after js2-mode
|
||||
:config
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
(title (cadr x))
|
||||
(region-p (caddr x))
|
||||
predicate)
|
||||
(setq predicate (cond ((eq region-p 'both) nil)
|
||||
(t (if region-p
|
||||
(lambda () (use-region-p))
|
||||
(lambda () (not (use-region-p)))))))
|
||||
(emr-declare-command
|
||||
(intern (format "js2r-%s" (symbol-name command-name)))
|
||||
:title title :modes 'js2-mode :predicate predicate)))
|
||||
'((extract-function "extract function" t)
|
||||
(extract-method "extract method" t)
|
||||
(introduce-parameter "introduce parameter" t)
|
||||
(localize-parameter "localize parameter" nil)
|
||||
(expand-object "expand object" nil)
|
||||
(contract-object "contract object" nil)
|
||||
(expand-function "expand function" nil)
|
||||
(contract-function "contract function" nil)
|
||||
(expand-array "expand array" nil)
|
||||
(contract-array "contract array" nil)
|
||||
(wrap-buffer-in-iife "wrap buffer in ii function" nil)
|
||||
(inject-global-in-iife "inject global in ii function" t)
|
||||
(add-to-globals-annotation "add to globals annotation" nil)
|
||||
(extract-var "extract variable" t)
|
||||
(inline-var "inline variable" t)
|
||||
(rename-var "rename variable" nil)
|
||||
(var-to-this "var to this" nil)
|
||||
(arguments-to-object "arguments to object" nil)
|
||||
(ternary-to-if "ternary to if" nil)
|
||||
(split-var-declaration "split var declaration" nil)
|
||||
(split-string "split string" nil)
|
||||
(unwrap "unwrap" t)
|
||||
(log-this "log this" 'both)
|
||||
(debug-this "debug this" 'both)
|
||||
(forward-slurp "forward slurp" nil)
|
||||
(forward-barf "forward barf" nil))))
|
||||
|
||||
(use-package nodejs-repl :commands (nodejs-repl))
|
||||
|
||||
;;
|
||||
(use-package jsx-mode :mode "\\.jsx$")
|
||||
|
||||
(use-package coffee-mode
|
||||
:mode "\\.coffee$"
|
||||
:config (setq-default coffee-indent-like-python-mode t))
|
||||
|
||||
(use-package typescript-mode
|
||||
:mode "\\.ts$"
|
||||
:init
|
||||
(add-hook! typescript-mode
|
||||
'(rainbow-delimiters-mode doom|ts-fontify)))
|
||||
|
||||
(use-package tide
|
||||
:after typescript-mode
|
||||
:config
|
||||
(setq tide-format-options
|
||||
'(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t
|
||||
:placeOpenBraceOnNewLineForFunctions nil))
|
||||
|
||||
(defun doom|tide-setup ()
|
||||
(tide-setup)
|
||||
(flycheck-mode +1)
|
||||
(eldoc-mode +1))
|
||||
(add-hook 'typescript-mode-hook 'doom|tide-setup)
|
||||
|
||||
(add-hook! web-mode
|
||||
(when (f-ext? buffer-file-name "tsx")
|
||||
(doom|tide-setup)))
|
||||
|
||||
(map! :map typescript-mode-map
|
||||
:m "gd" 'tide-jump-to-definition
|
||||
(:leader :n "h" 'tide-documentation-at-point))
|
||||
|
||||
(advice-add 'tide-project-root :override 'doom/project-root))
|
||||
|
||||
;;
|
||||
(defvar npm-conf (make-hash-table :test 'equal))
|
||||
(def-project-type! nodejs "node"
|
||||
:modes (web-mode js-mode coffee-mode css-mode sass-mode pug-mode)
|
||||
:files ("package.json")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project-path (doom/project-root))
|
||||
(hash (gethash project-path npm-conf))
|
||||
(package-file (f-expand "package.json" project-path))
|
||||
deps)
|
||||
(awhen (and (not hash) (f-exists? package-file)
|
||||
(ignore-errors (json-read-file package-file)))
|
||||
(puthash project-path it npm-conf)))
|
||||
t))
|
||||
|
||||
(def-project-type! expressjs "express"
|
||||
:modes (nodejs-project-mode bower-project-mode)
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(awhen (gethash (doom/project-root) npm-conf)
|
||||
(assq 'express (cdr-safe (assq 'dependencies it))))))
|
||||
|
||||
;; TODO electron-compile support
|
||||
(def-project-type! electron "electron"
|
||||
:modes (nodejs-project-mode)
|
||||
:files ("app/index.html" "app/main.js")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(awhen (gethash (doom/project-root) npm-conf)
|
||||
(let ((deps (append (car-safe (assq 'dependencies it))
|
||||
(car-safe (assq 'devDependencies it)))))
|
||||
(or (assq 'electron-prebuilt deps)
|
||||
(assq 'electron-packager deps)
|
||||
(string-prefix-p "electron" (or (assq 'start it) "") t))))))
|
||||
|
||||
(def-project-type! reactjs "react"
|
||||
:modes (nodejs-project-mode bower-project-mode)
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project (doom/project-root))
|
||||
(deps (append (cdr-safe (assq 'dependencies (gethash project bower-conf)))
|
||||
(cdr-safe (assq 'dependencies (gethash project npm-conf))))))
|
||||
(assq 'react deps))))
|
||||
|
||||
(def-project-type! gulpjs "gulp"
|
||||
:modes (nodejs-project-mode)
|
||||
:files ("gulpfile.js")
|
||||
:build ("gulp %s" "gulpfile.js"))
|
||||
|
||||
(provide 'module-js)
|
||||
;;; module-js.el ends here
|
11
modules/lang/julia/config.el
Normal file
11
modules/lang/julia/config.el
Normal file
|
@ -0,0 +1,11 @@
|
|||
;;; module-julia.el
|
||||
|
||||
(use-package julia-mode
|
||||
:mode "\\.jl$"
|
||||
:interpreter "julia"
|
||||
:config
|
||||
(def-docset! julia-mode "julia")
|
||||
(def-repl! julia-mode doom/julia-repl))
|
||||
|
||||
(provide 'module-julia)
|
||||
;;; module-julia.el ends here
|
40
modules/lang/latex/config.el
Normal file
40
modules/lang/latex/config.el
Normal file
|
@ -0,0 +1,40 @@
|
|||
;;; module-latex.el
|
||||
|
||||
(defvar doom-bibtex-dir "~/Dropbox/docs/biblio")
|
||||
|
||||
(use-package reftex
|
||||
:commands turn-on-reftex
|
||||
:init
|
||||
(setq reftex-plug-into-AUCTeX t
|
||||
reftex-ref-style-default-list '("Cleveref" "Hyperref" "Fancyref")
|
||||
reftex-default-bibliography
|
||||
`(,(expand-file-name "phys.bib" doom-bibtex-dir)))
|
||||
(add-hook! (LaTeX-mode latex-mode) 'turn-on-reftex))
|
||||
|
||||
(use-package helm-bibtex
|
||||
:commands helm-bibtex
|
||||
:init
|
||||
(setq TeX-auto-save t
|
||||
TeX-parse-self t
|
||||
bibtex-dialect 'biblatex
|
||||
bibtex-align-at-equal-sign t
|
||||
bibtex-text-indentation 20)
|
||||
(add-hook! bibtex-mode
|
||||
(local-set-key (kbd "C-c \\") 'bibtex-fill-entry)
|
||||
(setq fill-column 140))
|
||||
(add-hook! (LaTeX-mode latex-mode) 'turn-on-auto-fill)
|
||||
|
||||
:config
|
||||
(setq helm-bibtex-bibliography
|
||||
(list (f-expand "phys.bib" doom-bibtex-dir))
|
||||
|
||||
helm-bibtex-library-path
|
||||
(list (f-expand "phys-pdf" doom-bibtex-dir))
|
||||
|
||||
helm-bibtex-notes-path (f-expand "notes.org" doom-bibtex-dir)
|
||||
|
||||
helm-bibtex-pdf-open-function
|
||||
(lambda (fpath) (async-start-process "open-pdf" "/usr/bin/open" nil fpath))))
|
||||
|
||||
(provide 'module-latex)
|
||||
;;; module-latex.el ends here
|
34
modules/lang/lua/config.el
Normal file
34
modules/lang/lua/config.el
Normal file
|
@ -0,0 +1,34 @@
|
|||
;;; module-lua.el --- lua + Love2D
|
||||
|
||||
(use-package lua-mode
|
||||
:mode "\\.lua$"
|
||||
:interpreter "lua"
|
||||
:init (add-hook 'lua-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-company-backend! lua-mode (lua yasnippet))
|
||||
(def-electric! lua-mode :words ("else" "end"))
|
||||
(def-repl! lua-mode doom/inf-lua)
|
||||
|
||||
;; sp's lua-specific rules are obnoxious, so we disable them
|
||||
(setq sp-pairs (delete (assq 'lua-mode sp-pairs) sp-pairs)))
|
||||
|
||||
(use-package company-lua :after lua-mode)
|
||||
|
||||
(use-package moonscript
|
||||
:mode ("\\.moon$" . moonscript-mode)
|
||||
:config
|
||||
(push '(moonscript-mode moonscript-indent-offset) editorconfig-indentation-alist))
|
||||
|
||||
;;
|
||||
(def-project-type! love "♥"
|
||||
:modes (lua-mode markdown-mode json-mode)
|
||||
:files ("main.lua" "conf.lua")
|
||||
:build ("open -a love.app '%s'" "main.lua"))
|
||||
|
||||
(def-project-type! hammerspoon "hammer"
|
||||
:modes (lua-mode markdown-mode)
|
||||
:match "/\\.?hammerspoon/.+\\.lua$"
|
||||
:build "open hammerspoon://reload")
|
||||
|
||||
(provide 'module-lua)
|
||||
;;; module-lua.el ends here
|
18
modules/lang/octave/config.el
Normal file
18
modules/lang/octave/config.el
Normal file
|
@ -0,0 +1,18 @@
|
|||
;;; module-octave.el
|
||||
|
||||
(use-package octave
|
||||
:mode (("\\.m$" . octave-mode))
|
||||
:config
|
||||
;; (setq inferior-octave-program "/usr/local/bin/octave")
|
||||
)
|
||||
|
||||
;; (use-package ac-octave
|
||||
;; :config
|
||||
;; (add-hook! octave-mode
|
||||
;; (require 'ac-octave)
|
||||
;; (setq ac-sources '(ac-source-octave))))
|
||||
|
||||
(use-package octave-inf :commands run-octave)
|
||||
|
||||
(provide 'module-octave)
|
||||
;;; module-octave.el ends here
|
99
modules/lang/php/config.el
Normal file
99
modules/lang/php/config.el
Normal file
|
@ -0,0 +1,99 @@
|
|||
;;; module-php.el
|
||||
|
||||
(use-package hack-mode
|
||||
:mode "\\.hh$"
|
||||
:config (def-company-backend! hack-mode (capf)))
|
||||
|
||||
(use-package php-mode
|
||||
:mode ("\\.php[s345]?$" "\\.inc$" )
|
||||
:interpreter "php"
|
||||
:init
|
||||
(add-hook 'php-mode-hook 'flycheck-mode)
|
||||
(setq php-template-compatibility nil
|
||||
php-extras-eldoc-functions-file (concat doom-temp-dir "/php-extras-eldoc-functions"))
|
||||
|
||||
:config
|
||||
(def-repl! php-mode php-boris)
|
||||
(def-company-backend! php-mode '(php-extras-company company-yasnippet))
|
||||
|
||||
(map! :map php-mode-map (:localleader :nv ";" 'doom/append-semicolon))
|
||||
|
||||
(add-hook! php-mode (setq-local sp-max-pair-length 6))
|
||||
|
||||
(sp-with-modes '(php-mode)
|
||||
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
|
||||
(sp-local-pair "<? " " ?>")
|
||||
(sp-local-pair "<?php " " ?>")
|
||||
(sp-local-pair "<?=" " ?>")
|
||||
(sp-local-pair "<?" "?>" :when '(("RET")) :post-handlers '("||\n[i]"))
|
||||
(sp-local-pair "<?php" "?>" :when '(("RET")) :post-handlers '("||\n[i]"))))
|
||||
|
||||
(use-package php-extras
|
||||
:after php-mode
|
||||
:init (add-hook 'php-mode-hook 'eldoc-mode)
|
||||
:config
|
||||
(defun php-extras-company-setup ()) ;; company will set up itself
|
||||
;; Generate php-extras documentation and completion asynchronously
|
||||
(unless (file-exists-p (concat php-extras-eldoc-functions-file ".el"))
|
||||
(async-start `(lambda ()
|
||||
,(async-inject-variables "\\`\\(load-path\\|php-extras-eldoc-functions-file\\)$")
|
||||
(require 'php-extras-gen-eldoc)
|
||||
(php-extras-generate-eldoc-1 t))
|
||||
(lambda (_)
|
||||
(load (concat php-extras-eldoc-functions-file ".el"))
|
||||
(message "PHP eldoc updated!")))))
|
||||
|
||||
(use-package php-refactor-mode
|
||||
:after php-mode
|
||||
:init (add-hook 'php-mode-hook 'php-refactor-mode)
|
||||
:config
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
(title (cadr x))
|
||||
(region-p (caddr x))
|
||||
predicate)
|
||||
(setq predicate (cond ((eq region-p 'both) nil)
|
||||
(t (if region-p
|
||||
(lambda () (use-region-p))
|
||||
(lambda () (not (use-region-p)))))))
|
||||
(emr-declare-command (intern (format "php-refactor--%s" (symbol-name command-name)))
|
||||
:title title :modes 'php-mode :predicate predicate)))
|
||||
'((convert-local-to-instance-variable "convert local var to instance var" nil)
|
||||
(optimize-use "optimize FQNs in file" nil)
|
||||
(extract-method "extract method" t)
|
||||
(rename-local-variable "rename local variable" nil))))
|
||||
|
||||
(use-package phpunit
|
||||
:commands (phpunit-current-test phpunit-current-class phpunit-current-project)
|
||||
:config
|
||||
(map! :map php-mode-map
|
||||
(:localleader
|
||||
:n "tr" 'phpunit-current-project
|
||||
:n "ta" 'phpunit-current-class
|
||||
:n "ts" 'phpunit-current-test)))
|
||||
|
||||
(use-package php-boris :commands php-boris) ; PHP REPL
|
||||
|
||||
;;
|
||||
(def-project-type! laravel "laravel"
|
||||
:modes (php-mode yaml-mode web-mode nxml-mode js2-mode scss-mode)
|
||||
:files ("artisan" "server.php"))
|
||||
|
||||
(defvar php-composer-conf (make-hash-table :test 'equal))
|
||||
(def-project-type! composer "composer"
|
||||
:modes (web-mode php-mode)
|
||||
:files ("composer.json")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project-path (doom/project-root))
|
||||
(hash (gethash project-path php-composer-conf))
|
||||
(package-file (f-expand "composer.json" project-path))
|
||||
deps)
|
||||
(awhen (and (not hash) (f-exists? package-file)
|
||||
(json-read-file package-file))
|
||||
(puthash project-path it php-composer-conf)))
|
||||
t))
|
||||
|
||||
(provide 'module-php)
|
||||
;;; module-php.el ends here
|
46
modules/lang/processing/config.el
Normal file
46
modules/lang/processing/config.el
Normal file
|
@ -0,0 +1,46 @@
|
|||
;;; module-processing.el
|
||||
|
||||
(use-package processing-mode
|
||||
:when IS-MAC
|
||||
:commands (processing-mode processing-find-sketch)
|
||||
:mode "\\.pde$"
|
||||
:init (add-hook 'processing-compilation-mode-hook 'doom-hide-mode-line-mode)
|
||||
:config
|
||||
(def-builder! processing-mode processing-sketch-build)
|
||||
(def-popup! "*processing-compilation*" :align below :size 10 :noselect t)
|
||||
(setq processing-location "/usr/local/bin/processing-java"
|
||||
processing-application-dir "/Applications/Processing.app"
|
||||
processing-sketchbook-dir "~/Dropbox/work/pde"
|
||||
processing-output-dir "/tmp")
|
||||
|
||||
(map! :map processing-mode-map
|
||||
:nv "M-r" 'processing-sketch-run
|
||||
:m "gd" 'processing-find-in-reference
|
||||
:m "gF" 'processing-find-sketch
|
||||
(:localleader
|
||||
"e" 'processing-export-application
|
||||
"h" 'processing-open-reference
|
||||
"e" 'processing-open-examples
|
||||
"o" 'processing-open-sketchbook))
|
||||
|
||||
(after! quickrun
|
||||
(quickrun-add-command
|
||||
"processing" `((:command . ,processing-location)
|
||||
(:exec . (lambda () (format "--sketch=%s --output=%s --force --run"
|
||||
(doom/project-root) processing-output-dir)))
|
||||
(:description . "Run Processing sketch"))
|
||||
:mode 'processing-mode))
|
||||
|
||||
(add-hook! processing-mode
|
||||
(setq-local company-backends '((company-keywords
|
||||
:with
|
||||
company-yasnippet
|
||||
company-dabbrev-code)))
|
||||
(make-local-variable 'company-keywords-alist)
|
||||
(add-to-list 'company-keywords-alist
|
||||
(cons 'processing-mode (append processing-functions
|
||||
processing-builtins
|
||||
processing-constants)))))
|
||||
|
||||
(provide 'module-processing)
|
||||
;;; module-processing.el ends here
|
82
modules/lang/python/config.el
Normal file
82
modules/lang/python/config.el
Normal file
|
@ -0,0 +1,82 @@
|
|||
;;; module-python.el
|
||||
|
||||
(use-package python
|
||||
:mode ("\\.py\\'" . python-mode)
|
||||
:interpreter ("python" . python-mode)
|
||||
:commands python-mode
|
||||
:init
|
||||
(setq-default
|
||||
python-environment-directory doom-temp-dir
|
||||
python-shell-interpreter "ipython"
|
||||
python-shell-interpreter-args "--deep-reload"
|
||||
python-shell-prompt-regexp "In \\[[0-9]+\\]: "
|
||||
python-shell-prompt-block-regexp "\\.\\.\\.\\.: "
|
||||
python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
|
||||
python-shell-completion-setup-code
|
||||
"from IPython.core.completerlib import module_completion"
|
||||
python-shell-completion-string-code
|
||||
"';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
|
||||
|
||||
(add-hook 'python-mode-hook 'flycheck-mode)
|
||||
|
||||
:config
|
||||
(def-company-backend! python-mode (anaconda))
|
||||
(def-repl! python-mode doom/inf-python)
|
||||
(def-version-cmd! python-mode "python --version 2>&1 | cut -d' ' -f2")
|
||||
(define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens
|
||||
|
||||
(use-package anaconda-mode
|
||||
:after python
|
||||
:init
|
||||
(add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode))
|
||||
(setq anaconda-mode-installation-directory (concat doom-temp-dir "/anaconda/")
|
||||
anaconda-mode-eldoc-as-single-line t)
|
||||
|
||||
:config
|
||||
(map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions)
|
||||
(map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit)
|
||||
|
||||
(advice-add 'anaconda-mode-doc-buffer :after 'doom*anaconda-mode-doc-buffer))
|
||||
|
||||
(use-package company-anaconda
|
||||
:after anaconda-mode
|
||||
:config
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
(title (cadr x))
|
||||
(region-p (caddr x))
|
||||
predicate)
|
||||
(setq predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
(emr-declare-command (intern (format "anaconda-mode-%s" (symbol-name command-name)))
|
||||
:title title :modes 'python-mode :predicate predicate)))
|
||||
'((show-doc "view documentation" t)
|
||||
(find-assignments "find assignments" t)
|
||||
(find-definitions "find definitions" t)
|
||||
(find-file "find assignments" t)
|
||||
(find-references "show usages" nil))))
|
||||
|
||||
(use-package pip-requirements
|
||||
:mode ("/requirements.txt$" . pip-requirements-mode)
|
||||
:config (def-company-backend! pip-requirements-mode (capf)))
|
||||
|
||||
(use-package nose
|
||||
:commands nose-mode
|
||||
:preface (defvar nose-mode-map (make-sparse-keymap))
|
||||
:init (associate! nose-mode :match "/test_.+\\.py$" :in (python-mode))
|
||||
:config
|
||||
(def-popup! "*nosetests*" :align below :size 0.4 :noselect t)
|
||||
(def-yas-mode! nose-mode)
|
||||
(map! :map nose-mode-map
|
||||
(:localleader
|
||||
:n "tr" 'nosetests-again
|
||||
:n "ta" 'nosetests-all
|
||||
:n "ts" 'nosetests-one
|
||||
:n "tv" 'nosetests-module
|
||||
:n "tA" 'nosetests-pdb-all
|
||||
:n "tO" 'nosetests-pdb-one
|
||||
:n "tV" 'nosetests-pdb-module)))
|
||||
|
||||
(provide 'module-python)
|
||||
;;; module-python.el ends here
|
78
modules/lang/ruby/config.el
Normal file
78
modules/lang/ruby/config.el
Normal file
|
@ -0,0 +1,78 @@
|
|||
;;; module-ruby.el
|
||||
|
||||
(use-package ruby-mode
|
||||
:mode ("\\.rb$" "\\.rake$" "\\.gemspec$" "\\.?pryrc$"
|
||||
"/\\(Gem\\|Cap\\|Vagrant\\|Rake\\)file$")
|
||||
:interpreter "ruby"
|
||||
:init (add-hook 'ruby-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-builder! ruby-mode "rake %s" "Rakefile")
|
||||
(def-company-backend! ruby-mode (dabbrev-code))
|
||||
(def-electric! ruby-mode :words ("else" "end" "elseif"))
|
||||
(def-repl! ruby-mode inf-ruby)
|
||||
(def-version-cmd! ruby-mode "ruby --version | cut -d' ' -f2")
|
||||
(setq ruby-deep-indent-paren t)
|
||||
;; Don't interfere with my custom RET behavior
|
||||
(define-key ruby-mode-map [?\n] nil))
|
||||
|
||||
(use-package ruby-refactor
|
||||
:after ruby-mode
|
||||
:config
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
(title (cadr x))
|
||||
(region-p (caddr x))
|
||||
predicate)
|
||||
(setq predicate (cond ((eq region-p 'both) nil)
|
||||
(t (if region-p
|
||||
(lambda () (use-region-p))
|
||||
(lambda () (not (use-region-p)))))))
|
||||
(emr-declare-command (intern (format "ruby-%s" (symbol-name command-name)))
|
||||
:title title :modes 'ruby-mode :predicate predicate)))
|
||||
'((toggle-block "toggle block" nil)
|
||||
(refactor-extract-to-method "extract method" t)
|
||||
(refactor-extract-local-variable "extract local variable" t)
|
||||
(refactor-extract-constant "extract constant" t)
|
||||
(refactor-add-parameter "add parameter" nil)
|
||||
(refactor-extract-to-let "extract to let" t)
|
||||
(refactor-convert-post-conditional "convert post conditional" t))))
|
||||
|
||||
;; Highlight doc comments
|
||||
(use-package yard-mode
|
||||
:commands yard-mode
|
||||
:init (add-hook 'ruby-mode-hook 'yard-mode))
|
||||
|
||||
(use-package rspec-mode
|
||||
:mode ("/\\.rspec$" . text-mode)
|
||||
:init
|
||||
(associate! rspec-mode :match "/\\.rspec$")
|
||||
(associate! rspec-mode :in (ruby-mode yaml-mode) :files ("spec/"))
|
||||
(defvar rspec-mode-verifiable-map (make-sparse-keymap))
|
||||
(defvar evilmi-ruby-match-tags
|
||||
'((("unless" "if") ("elsif" "else") "end")
|
||||
("begin" ("rescue" "ensure") "end")
|
||||
("case" ("when" "else") "end")
|
||||
(("class" "def" "while" "do" "module" "for" "until") () "end")
|
||||
;; Rake
|
||||
(("task" "namespace") () "end")))
|
||||
:config
|
||||
(map! :map rspec-mode-map
|
||||
(:localleader
|
||||
:n "tr" 'rspec-rerun
|
||||
:n "ta" 'rspec-verify-all
|
||||
:n "ts" 'rspec-verify-single
|
||||
:n "tv" 'rspec-verify)))
|
||||
|
||||
(use-package inf-ruby
|
||||
:commands (inf-ruby inf-ruby-console-auto)
|
||||
:config (def-company-backend! inf-ruby-mode (inf-ruby)))
|
||||
|
||||
(use-package company-inf-ruby :after inf-ruby)
|
||||
|
||||
;;
|
||||
;; TODO Parse Rakefile for tasks
|
||||
(def-project-type! rake "rake"
|
||||
:files ("Rakefile"))
|
||||
|
||||
(provide 'module-ruby)
|
||||
;;; module-ruby.el ends here
|
25
modules/lang/rust/config.el
Normal file
25
modules/lang/rust/config.el
Normal file
|
@ -0,0 +1,25 @@
|
|||
;;; module-rust.el
|
||||
|
||||
(use-package rust-mode
|
||||
:mode "\\.rs$"
|
||||
:init (add-hook 'rust-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-builder! rust-mode "cargo run" "Cargo.toml")
|
||||
(def-builder! toml-mode "cargo run" "Cargo.toml"))
|
||||
|
||||
(use-package flycheck-rust
|
||||
:after rust-mode)
|
||||
|
||||
(defvar racer-cmd (concat doom-ext-dir "/racer"))
|
||||
(defvar racer-rust-src-path (concat doom-ext-dir "/rust/src/"))
|
||||
(use-package racer
|
||||
:after rust-mode
|
||||
:when (f-exists? racer-cmd)
|
||||
:init (add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
|
||||
:config
|
||||
;; TODO Unit test keybinds
|
||||
(def-company-backend! rust-mode (racer))
|
||||
(map! :map rust-mode-map :m "gd" 'racer-find-definition))
|
||||
|
||||
(provide 'module-rust)
|
||||
;;; module-rust.el ends here
|
16
modules/lang/scala/config.el
Normal file
16
modules/lang/scala/config.el
Normal file
|
@ -0,0 +1,16 @@
|
|||
;;; module-scala.el
|
||||
|
||||
(use-package scala-mode
|
||||
:mode "\\.s\\(cala\\|bt\\)$"
|
||||
:init (add-hook 'scala-mode-hook 'eldoc-mode)
|
||||
:config (def-company-backend! scala-mode '(ensime-company (company-yasnippet))))
|
||||
|
||||
(use-package sbt-mode
|
||||
:after scala-mode)
|
||||
|
||||
(use-package ensime
|
||||
:commands (ensime ensime-mode ensime-scala-mode-hook)
|
||||
:init (add-hook 'scala-mode-hook 'ensime-scala-mode-hook))
|
||||
|
||||
(provide 'module-scala)
|
||||
;;; module-scala.el ends here
|
24
modules/lang/sh/config.el
Normal file
24
modules/lang/sh/config.el
Normal file
|
@ -0,0 +1,24 @@
|
|||
;;; module-sh.el
|
||||
|
||||
(use-package sh-script
|
||||
:mode (("\\.\\(ba\\|z\\)sh$" . sh-mode)
|
||||
("/\\.?z\\(sh\\(/.*\\|$\\)\\|profile\\|log\\(in\\|out\\)\\|sh\\(rc\\|env\\)\\)$" . sh-mode)
|
||||
("/\\.?bash\\(/.*\\|rc\\|_profile\\)$" . sh-mode)
|
||||
("/\\.?xinitrc$" . sh-mode)
|
||||
("/bspwmrc$" . sh-mode))
|
||||
:init (add-hook! sh-mode '(flycheck-mode doom|sh-extra-font-lock-activate highlight-numbers-mode))
|
||||
:config
|
||||
(def-company-backend! sh-mode (shell))
|
||||
(def-electric! sh-mode :words ("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
|
||||
(def-repl! sh-mode doom/inf-shell)
|
||||
(setq sh-indent-after-continuation 'always)
|
||||
|
||||
;; [pedantry intensifies]
|
||||
(add-hook! sh-mode (setq mode-name "sh")))
|
||||
|
||||
(use-package company-shell
|
||||
:after sh-script
|
||||
:config (setq company-shell-delete-duplicates t))
|
||||
|
||||
(provide 'module-sh)
|
||||
;;; module-sh.el ends here
|
17
modules/lang/swift/config.el
Normal file
17
modules/lang/swift/config.el
Normal file
|
@ -0,0 +1,17 @@
|
|||
;;; module-swift.el
|
||||
|
||||
;; TODO Set up emacs task runners for fruitstrap
|
||||
(use-package swift-mode
|
||||
:mode "\\.swift$"
|
||||
:init (add-hook 'swift-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-company-backend! swift-mode (sourcekit yasnippet))
|
||||
(def-docset! swift-mode "swift")
|
||||
(def-repl! swift-mode swift-mode-run-repl) ; TODO test this
|
||||
(after! flycheck (push 'swift flycheck-checkers)))
|
||||
|
||||
(use-package company-sourcekit
|
||||
:after swift-mode)
|
||||
|
||||
(provide 'module-swift)
|
||||
;;; module-swift.el ends here
|
54
modules/lang/text/config.el
Normal file
54
modules/lang/text/config.el
Normal file
|
@ -0,0 +1,54 @@
|
|||
;;; module-text.el
|
||||
|
||||
(associate! text-mode :match "/LICENSE$")
|
||||
|
||||
(use-package markdown-mode
|
||||
:mode ("\\.m\\(d\\|arkdown\\)$" "/README$"
|
||||
("/README\\.md$" . gfm-mode))
|
||||
:init
|
||||
(add-hook! markdown-mode
|
||||
(auto-fill-mode +1)
|
||||
(setq line-spacing 2
|
||||
fill-column 70))
|
||||
(setq markdown-enable-wiki-links t
|
||||
markdown-enable-math t
|
||||
markdown-italic-underscore t
|
||||
markdown-make-gfm-checkboxes-buttons t
|
||||
markdown-gfm-additional-languages '("sh"))
|
||||
|
||||
:config
|
||||
(def-electric! markdown-mode :chars ("+" "#"))
|
||||
|
||||
(sp-local-pair
|
||||
'(markdown-mode gfm-mode)
|
||||
"\`\`\`" "\`\`\`" :post-handlers '(("||\n" "RET")))
|
||||
|
||||
(map! :map gfm-mode-map "`" 'self-insert-command)
|
||||
(map! :map markdown-mode-map
|
||||
"<backspace>" nil
|
||||
"<M-left>" nil
|
||||
"<M-right>" nil
|
||||
"M-*" 'markdown-insert-list-item
|
||||
"M-b" 'markdown-insert-bold
|
||||
"M-i" 'markdown-insert-italic
|
||||
"M-`" 'doom/markdown-insert-del
|
||||
;; Assumes you have a markdown renderer plugin in chrome
|
||||
:nv "M-r" (λ! (doom-open-with "Google Chrome"))
|
||||
;; TODO: Make context sensitive
|
||||
:n "[p" 'markdown-promote
|
||||
:n "]p" 'markdown-demote
|
||||
:i "M--" 'markdown-insert-hr
|
||||
(:localleader
|
||||
:nv "i" 'markdown-insert-image
|
||||
:nv "l" 'markdown-insert-link
|
||||
:nv "L" 'markdown-insert-reference-link-dwim
|
||||
:nv "b" 'markdown-preview)))
|
||||
|
||||
(use-package markdown-toc :after markdown-mode)
|
||||
|
||||
(use-package rst
|
||||
:mode ("\\.re?st$" . rst-mode)
|
||||
:config (def-builder! rst-mode rst-compile-pdf-preview))
|
||||
|
||||
(provide 'module-text)
|
||||
;;; module-text.el ends here
|
113
modules/lang/web/config.el
Normal file
113
modules/lang/web/config.el
Normal file
|
@ -0,0 +1,113 @@
|
|||
;;; module-web.el
|
||||
|
||||
(use-package haml-mode :mode "\\.haml$")
|
||||
|
||||
(use-package pug-mode
|
||||
:mode ("\\.jade$" "\\.pug$")
|
||||
:config
|
||||
(def-company-backend! pug-mode (yasnippet))
|
||||
(push '("jade" "html") projectile-other-file-alist)
|
||||
(push '("pug" "html") projectile-other-file-alist)
|
||||
(map! :map pug-mode-map
|
||||
:i [tab] 'doom/dumb-indent
|
||||
:i [backtab] 'doom/dumb-dedent))
|
||||
|
||||
(use-package web-mode
|
||||
:mode ("\\.p?html?$"
|
||||
"\\.\\(tpl\\|blade\\)\\(\\.php\\)?$"
|
||||
"\\.erb$"
|
||||
"\\.jsp$"
|
||||
"\\.as[cp]x$"
|
||||
"\\.mustache$"
|
||||
"\\.tsx$"
|
||||
"wp-content/themes/.+/.+\\.php$")
|
||||
:init
|
||||
(add-hook 'web-mode-hook 'turn-off-smartparens-mode)
|
||||
:config
|
||||
(def-company-backend! web-mode (web-html yasnippet))
|
||||
(setq web-mode-enable-html-entities-fontification t)
|
||||
(push '("html" "jade" "pug" "jsx" "tsx") projectile-other-file-alist)
|
||||
|
||||
(map! :map web-mode-map :i "SPC" 'self-insert-command)
|
||||
|
||||
(after! nlinum
|
||||
;; Fix blank line numbers after unfolding
|
||||
(advice-add 'web-mode-fold-or-unfold :after 'nlinum--flush))
|
||||
|
||||
(map! :map web-mode-map
|
||||
"M-/" 'web-mode-comment-or-uncomment
|
||||
:n "M-r" 'doom/web-refresh-browser
|
||||
:n "za" 'web-mode-fold-or-unfold
|
||||
(:localleader :n "t" 'web-mode-element-rename)
|
||||
:nv "]a" 'web-mode-attribute-next
|
||||
:nv "[a" 'web-mode-attribute-previous
|
||||
:nv "]t" 'web-mode-tag-next
|
||||
:nv "[t" 'web-mode-tag-previous
|
||||
:nv "]T" 'web-mode-element-child
|
||||
:nv "[T" 'web-mode-element-parent))
|
||||
|
||||
|
||||
;;
|
||||
;; Tools
|
||||
;;
|
||||
|
||||
(use-package emmet-mode
|
||||
:commands (emmet-mode)
|
||||
:init
|
||||
(add-hook! (scss-mode web-mode html-mode haml-mode nxml-mode) 'emmet-mode)
|
||||
(defvar emmet-mode-keymap (make-sparse-keymap))
|
||||
:config
|
||||
(setq emmet-move-cursor-between-quotes t)
|
||||
(map! :map emmet-mode-keymap
|
||||
:v "M-e" 'emmet-wrap-with-markup
|
||||
:i "M-e" 'emmet-expand-yas
|
||||
:i "M-E" 'emmet-expand-line))
|
||||
|
||||
|
||||
;;
|
||||
;; Project types
|
||||
;;
|
||||
|
||||
(defvar bower-conf (make-hash-table :test 'equal))
|
||||
(def-project-type! bower "bower"
|
||||
:modes (web-mode js-mode coffee-mode css-mode sass-mode pug-mode)
|
||||
:files ("bower.json")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project-path (doom/project-root))
|
||||
(hash (gethash project-path bower-conf))
|
||||
(package-file (f-expand "bower.json" project-path))
|
||||
deps)
|
||||
(awhen (and (not hash) (f-exists? package-file)
|
||||
(ignore-errors (json-read-file package-file)))
|
||||
(puthash project-path it bower-conf)))
|
||||
t))
|
||||
|
||||
(def-project-type! angularjs "angular"
|
||||
:modes (nodejs-project-mode bower-project-mode)
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project (doom/project-root))
|
||||
(bower (gethash project bower-conf))
|
||||
(npm (gethash project npm-conf))
|
||||
(deps (append (cdr-safe (assq 'dependencies bower))
|
||||
(cdr-safe (assq 'dependencies npm))
|
||||
(cdr-safe (assq 'devDependencies bower))
|
||||
(cdr-safe (assq 'devDependencies npm)))))
|
||||
(assq 'angular deps))))
|
||||
|
||||
(def-project-type! jekyll ":{"
|
||||
:modes (web-mode js-mode coffee-mode css-mode haml-mode pug-mode)
|
||||
:match "/\\(\\(css\\|_\\(layouts\\|posts\\|sass\\)\\)/.+\\|.+.html\\)$"
|
||||
:files ("config.yml" "_layouts/")
|
||||
(add-hook! mode
|
||||
(when (eq major-mode 'web-mode)
|
||||
(web-mode-set-engine "django"))))
|
||||
|
||||
(def-project-type! wordpress "wp"
|
||||
:modes (php-mode web-mode css-mode haml-mode pug-mode)
|
||||
:match "/wp-\\(\\(content\\|admin\\|includes\\)/\\)?.+$"
|
||||
:files ("wp-config.php" "wp-content/"))
|
||||
|
||||
(provide 'module-web)
|
||||
;;; module-web.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue