Refactoring code
This commit is contained in:
parent
4ee79f3999
commit
af5244168e
@ -7,17 +7,16 @@
|
||||
:pin "MELPA"
|
||||
:ensure t
|
||||
:bind
|
||||
("C-x t d" . dark-theme)
|
||||
("C-x t s" . semi-dark-theme)
|
||||
("C-x t l" . light-theme)
|
||||
(("C-x t d" . dark-theme)
|
||||
("C-x t s" . semi-dark-theme)
|
||||
("C-x t l" . light-theme))
|
||||
|
||||
:init
|
||||
(defun light-theme ()
|
||||
"Activate light colortheme"
|
||||
(interactive)
|
||||
(load-theme 'doom-one-light)
|
||||
(delete-selection-mode 1)
|
||||
)
|
||||
(delete-selection-mode 1))
|
||||
|
||||
(defun dark-theme ()
|
||||
"Activate dark colortheme"
|
||||
@ -25,8 +24,7 @@
|
||||
(load-theme 'doom-molokai)
|
||||
(delete-selection-mode 1)
|
||||
;; Invoke customcolors
|
||||
(darkcolor)
|
||||
)
|
||||
(darkcolor))
|
||||
|
||||
(defun semi-dark-theme ()
|
||||
"Activate semi-dark colortheme"
|
||||
@ -34,11 +32,10 @@
|
||||
(load-theme 'doom-molokai)
|
||||
(delete-selection-mode 1)
|
||||
;; Invoke customcolors
|
||||
(semidarkcolor)
|
||||
)
|
||||
(semidarkcolor))
|
||||
|
||||
;; Invoke theme
|
||||
(load-theme 'doom-molokai t) ;; global
|
||||
(load-theme 'doom-molokai t)
|
||||
|
||||
:config
|
||||
(defun darkcolor ()
|
||||
@ -49,15 +46,14 @@
|
||||
|
||||
;; Modeline
|
||||
(set-face-background 'mode-line "#0C0E10")
|
||||
(set-face-background 'modeline-inactive "#333333")
|
||||
(set-face-background 'mode-line-inactive "#333333")
|
||||
;; (set-face-foreground 'mode-line "#FFFFFF")
|
||||
|
||||
;; Fix linum current-line highlight
|
||||
(defface my-linum-hl
|
||||
'((t :background "#0C0E10" :foreground "gold"))
|
||||
"Face for the currently active Line number"
|
||||
:group 'linum)
|
||||
)
|
||||
:group 'linum))
|
||||
|
||||
(defun semidarkcolor ()
|
||||
"Simple semidarkcolor for theme."
|
||||
@ -74,12 +70,10 @@
|
||||
(defface my-linum-hl
|
||||
'((t :background "gray20" :foreground "gold"))
|
||||
"Face for the currently active Line number"
|
||||
:group 'linum)
|
||||
)
|
||||
:group 'linum))
|
||||
|
||||
;; Invoke color
|
||||
(semidarkcolor) ;; default
|
||||
)
|
||||
(semidarkcolor))
|
||||
|
||||
(provide 'init-doom-theme)
|
||||
|
||||
|
@ -8,23 +8,19 @@
|
||||
;; https://github.com/mooz/js2-mode
|
||||
(use-package js2-mode
|
||||
:ensure t
|
||||
:defer 20
|
||||
:hook ((js2-mode . (lambda ()
|
||||
(company-mode))))
|
||||
:mode (("\\.js\\'" . js2-mode))
|
||||
:pin "MELPA"
|
||||
:mode ("\\.js'\\'" . js2-mode)
|
||||
:hook (js2-mode . company-mode)
|
||||
:custom
|
||||
(js2-include-node-externs t)
|
||||
(js2-global-externs '("customElements"))
|
||||
(js2-highlight-level 3)
|
||||
(js2r-prefer-let-over-var t)
|
||||
(js2r-prefered-quote-type 2)
|
||||
(js2r-preferred-quote-type 2)
|
||||
(js-indent-align-list-continuation t)
|
||||
(global-auto-highlight-symbol-mode t)
|
||||
;; use eslint_d insetad of eslint for faster linting
|
||||
(flycheck-javascript-eslint-executable "eslint_d")
|
||||
:config
|
||||
(setq-default flycheck-javascript-eslint-executable "eslint_d")
|
||||
(setq js-indent-level 2)
|
||||
;; patch in basic private field support
|
||||
(advice-add #'js2-identifier-start-p
|
||||
:after-until
|
||||
(lambda (c) (eq c ?#))))
|
||||
@ -34,12 +30,13 @@
|
||||
(use-package js2-refactor
|
||||
:pin "MELPA"
|
||||
:after js2-mode
|
||||
:bind
|
||||
(:map js2-mode-map
|
||||
("C-k" . js2r-kill)
|
||||
("C-c h r" . js2-refactor-hydra/body))
|
||||
:hook ((js2-mode . js2-refactor-mode))
|
||||
:config (js2r-add-keybindings-with-prefix "C-c C-r")
|
||||
:hook (js2-mode . js2-refactor-mode)
|
||||
:config
|
||||
;; Add keybindings for js2-refactor with prefix "C-c C-r".
|
||||
(js2r-add-keybindings-with-prefix "C-c C-r")
|
||||
;; Assign keybindings to kill an element in js2 and to open the js2-refactor's hydra menu.
|
||||
(bind-key "C-k" 'js2r-kill js2-mode-map)
|
||||
(bind-key "C-c h r" 'js2-refactor-hydra/body js2-mode-map)
|
||||
|
||||
(defhydra js2-refactor-hydra (:color blue :hint nil)
|
||||
"
|
||||
@ -82,21 +79,26 @@
|
||||
|
||||
;; json-mode: Major mode for editing JSON files with emacs
|
||||
;; https://github.com/joshwnj/json-mode
|
||||
(use-package prettier-js
|
||||
:pin "MELPA")
|
||||
(use-package json-mode
|
||||
:pin "MELPA"
|
||||
:ensure t
|
||||
:defer 20
|
||||
:pin "MELPA"
|
||||
:mode ("\\.json\\'" "\\.jsonld\\'")
|
||||
:custom
|
||||
(json-reformat:indent-width 2)
|
||||
(json-reformat:pretty-string? t)
|
||||
(js-indent-level 2)
|
||||
:mode "\\.js\\(?:on\\|[hl]int\\(rc\\)?\\)\\'"
|
||||
:hook ((json-mode . prettier-js-mode))
|
||||
:bind (:package json-mode-map
|
||||
:map json-mode-map
|
||||
("C-c <tab>" . json-mode-beautify)))
|
||||
:hook
|
||||
(json-mode . (lambda ()
|
||||
(add-hook 'before-save-hook 'json-mode-before-save nil t)
|
||||
(prettier-js-mode)))
|
||||
:bind
|
||||
(:map json-mode-map
|
||||
("C-c <tab>" . json-mode-beautify)))
|
||||
|
||||
(use-package prettier-js
|
||||
:pin "MELPA"
|
||||
:hook
|
||||
((js-mode typescript-mode css-mode scss-mode less-mode web-mode json-mode) . prettier-js-mode))
|
||||
|
||||
;; eslintd-fix: Emacs minor-mode to automatically fix javascript with eslint_d.
|
||||
;; https://github.com/aaronjensen/eslintd-fix/tree/master
|
||||
|
Loading…
x
Reference in New Issue
Block a user