diff --git a/init.el b/init.el index 3c58fd7..bf0424b 100644 --- a/init.el +++ b/init.el @@ -26,75 +26,22 @@ There are two things you can do about this warning: ;; If there is more than one, they won't work right. '(custom-safe-themes (quote - ("44961a9303c92926740fc4121829c32abca38ba3a91897a4eab2aa3b7634bed4" "9be1d34d961a40d94ef94d0d08a364c3d27201f3c98c9d38e36f10588469ea57" "50b64810ed1c36dfb72d74a61ae08e5869edc554102f20e078b21f84209c08d1" "2540689fd0bc5d74c4682764ff6c94057ba8061a98be5dd21116bf7bf301acfb" "36ca8f60565af20ef4f30783aa16a26d96c02df7b4e54e9900a5138fb33808da" "cdb4ffdecc682978da78700a461cdc77456c3a6df1c1803ae2dd55c59fa703e3" "d6c5b8dc6049f2e9dabdfcafa9ef2079352640e80dffe3e6cc07c0f89cbf9748" "a24c5b3c12d147da6cef80938dca1223b7c7f70f2f382b26308eba014dc4833a" "a7051d761a713aaf5b893c90eaba27463c791cd75d7257d3a8e66b0c8c346e77" default))) + ("68fb87a1805393d7a00ba5064d28b8277de5a75addf0d34094012408cfcf2eea" "23ba4b4ba4d1c989784475fed58919225db8d9a9751b32aa8df835134fe7ba6f" "043c8375cad0cf1d5c42f5d85cbed601075caf09594da04a74712510e9437d2b" "722e1cd0dad601ec6567c32520126e42a8031cd72e05d2221ff511b58545b108" "0c3b1358ea01895e56d1c0193f72559449462e5952bded28c81a8e09b53f103f" "d9850d120be9d94dd7ae69053630e89af8767c36b131a3aa7b06f14007a24656" "fee4e306d9070a55dce4d8e9d92d28bd9efe92625d2ba9d4d654fc9cd8113b7f" "93268bf5365f22c685550a3cbb8c687a1211e827edc76ce7be3c4bd764054bad" "f984e2f9765a69f7394527b44eaa28052ff3664a505f9ec9c60c088ca4e9fc0b" "350dc341799fbbb81e59d1e6fff2b2c8772d7000e352a5c070aa4317127eee94" "bf798e9e8ff00d4bf2512597f36e5a135ce48e477ce88a0764cfb5d8104e8163" "732b807b0543855541743429c9979ebfb363e27ec91e82f463c91e68c772f6e3" "a62f0662e6aa7b05d0b4493a8e245ab31492765561b08192df61c9d1c7e1ddee" "c9f102cf31165896631747fd20a0ca0b9c64ecae019ce5c2786713a5b7d6315e" "c9ddf33b383e74dac7690255dd2c3dfa1961a8e8a1d20e401c6572febef61045" "44961a9303c92926740fc4121829c32abca38ba3a91897a4eab2aa3b7634bed4" "9be1d34d961a40d94ef94d0d08a364c3d27201f3c98c9d38e36f10588469ea57" "50b64810ed1c36dfb72d74a61ae08e5869edc554102f20e078b21f84209c08d1" "2540689fd0bc5d74c4682764ff6c94057ba8061a98be5dd21116bf7bf301acfb" "36ca8f60565af20ef4f30783aa16a26d96c02df7b4e54e9900a5138fb33808da" "cdb4ffdecc682978da78700a461cdc77456c3a6df1c1803ae2dd55c59fa703e3" "d6c5b8dc6049f2e9dabdfcafa9ef2079352640e80dffe3e6cc07c0f89cbf9748" "a24c5b3c12d147da6cef80938dca1223b7c7f70f2f382b26308eba014dc4833a" "a7051d761a713aaf5b893c90eaba27463c791cd75d7257d3a8e66b0c8c346e77" default))) + '(global-display-line-numbers-mode t) '(package-selected-packages (quote - (all-the-icons neotree base16-theme afternoon-theme ample-theme nord-theme company-racer racer markdown-mode+ vue-mode dumb-jump magit company flycheck-rust flycheck json-mode flymake-json tss tide material-theme zenburn-theme ac-js2 auto-complete projectile helm js2-mode cargo rust-mode)))) + (rust-playground all-the-icons neotree base16-theme afternoon-theme ample-theme nord-theme company-racer racer markdown-mode+ vue-mode dumb-jump magit company flycheck-rust flycheck json-mode flymake-json tss tide material-theme zenburn-theme ac-js2 auto-complete projectile helm js2-mode cargo rust-mode))) + '(tool-bar-mode nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - ) + '(default ((t (:family "Fira Code" :foundry "CTDB" :slant normal :weight normal :height 120 :width normal))))) -(require 'rust-mode) -(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) -(setq rust-format-on-save t) -(add-hook 'rust-mode-hook 'cargo-minor-mode) -(with-eval-after-load 'rust-mode - (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)) -(add-hook 'rust-mode-hook #'racer-mode) -(add-hook 'racer-mode-hook #'eldoc-mode) -(add-hook 'racer-mode-hook #'company-mode) -(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) -(setq company-tooltip-align-annotations t) +(add-to-list 'load-path "~/.emacs.d/lib") +(require 'init-editor) +(require 'init-web) +(require 'init-js-ts) +(require 'init-rust) -(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) -(require 'helm-config) -(projectile-mode +1) -(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map) -(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) -(require 'auto-complete-config) -(ac-config-default) -(add-hook 'js2-mode-hook 'ac-js2-mode) -(setq ac-js2-evaluate-calls t) - -(require 'typescript-mode) -(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode)) - -(defun setup-tide-mode () - (interactive) - (tide-setup) - (flycheck-mode +1) - (setq flycheck-check-syntax-automatically '(save mode-enabled)) - (eldoc-mode +1) - (tide-hl-identifier-mode +1) - ;; company is an optional dependency. You have to - ;; install it separately via package-install - ;; `M-x package-install [ret] company` - (company-mode +1)) - -;; aligns annotation to the right hand side -(setq company-tooltip-align-annotations t) - -;; formats the buffer before saving -(add-hook 'before-save-hook 'tide-format-before-save) - -(add-hook 'typescript-mode-hook #'setup-tide-mode) -(add-hook 'json-mode #'flycheck-mode) -(dumb-jump-mode) -(global-display-line-numbers-mode) -(require 'vue-mode) -;; (add-to-list 'auto-mode-alist '("\\.vue\\'" . vue-mode)) - -(load-theme 'nord t) -;;(set-frame-parameter (selected-frame) 'alpha '( . )) -;;(set-frame-parameter (selected-frame) 'alpha ) -;;(set-frame-parameter (selected-frame) 'alpha '(50 50)) -;;(add-to-list 'default-frame-alist '(alpha . (50 50))) -(require 'neotree) -(global-set-key (kbd "C-c n") 'neotree-toggle) - -(require 'all-the-icons) - -(setq neo-theme (if (display-graphic-p) 'icons 'arrow)) diff --git a/lib/init-editor.el b/lib/init-editor.el new file mode 100644 index 0000000..c67ee09 --- /dev/null +++ b/lib/init-editor.el @@ -0,0 +1,25 @@ +;; Editor initialization + +(setq company-tooltip-align-annotations t) +(require 'helm-config) +(projectile-mode +1) +(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map) +(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) +(require 'auto-complete-config) +(ac-config-default) +(require 'neotree) +(global-set-key (kbd "C-c n") 'neotree-toggle) + +(require 'all-the-icons) + +(setq neo-theme (if (display-graphic-p) 'icons 'arrow)) +(setq tab-width 4) +(tool-bar-mode -1) +(electric-pair-mode +1) +(dumb-jump-mode) +(global-display-line-numbers-mode) +(load-theme 'base16-horizon-dark t) +;; Born to be wild +(setq make-backup-files nil) + +(provide 'init-editor) diff --git a/lib/init-js-ts.el b/lib/init-js-ts.el new file mode 100644 index 0000000..12285df --- /dev/null +++ b/lib/init-js-ts.el @@ -0,0 +1,33 @@ +;; Javascript and Typescript init +(require 'json-mode) +(require 'js2-mode) +(add-to-list 'auto-mode-alist '("\\.js[x]\\'" . js2-mode)) + +(add-hook 'js2-mode-hook 'ac-js2-mode) +(setq ac-js2-evaluate-calls t) + +(require 'typescript-mode) +(add-to-list 'auto-mode-alist '("\\.ts[x]\\'" . typescript-mode)) + +(defun setup-tide-mode () + (interactive) + (tide-setup) + (flycheck-mode +1) + (setq flycheck-check-syntax-automatically '(save mode-enabled)) + (eldoc-mode +1) + (tide-hl-identifier-mode +1) + ;; company is an optional dependency. You have to + ;; install it separately via package-install + ;; `M-x package-install [ret] company` + (company-mode +1)) + +;; aligns annotation to the right hand side + + +;; formats the buffer before saving +(add-hook 'before-save-hook 'tide-format-before-save) + +(add-hook 'typescript-mode-hook #'setup-tide-mode) +(add-hook 'json-mode #'flycheck-mode) + +(provide 'init-js-ts) diff --git a/init-pkg.el b/lib/init-pkg.el similarity index 92% rename from init-pkg.el rename to lib/init-pkg.el index 6df6fa4..1f61209 100644 --- a/init-pkg.el +++ b/lib/init-pkg.el @@ -14,7 +14,7 @@ ; list the packages you want (setq package-list - '(all-the-icons neotree base16-theme afternoon-theme ample-theme nord-theme company-racer racer markdown-mode+ vue-mode dumb-jump magit company flycheck-rust flycheck json-mode flymake-json tss tide material-theme zenburn-theme ac-js2 auto-complete projectile helm js2-mode cargo rust-mode)) + '(all-the-icons neotree base16-theme afternoon-theme ample-theme nord-theme company-racer racer markdown-mode+ vue-mode dumb-jump magit company flycheck-rust flycheck json-mode flymake-json tss tide material-theme zenburn-theme ac-js2 auto-complete projectile helm js2-mode cargo rust-mode rust-playground css-mode skewer-mode)) ; activate all the packages diff --git a/lib/init-rust b/lib/init-rust new file mode 100644 index 0000000..a3200af --- /dev/null +++ b/lib/init-rust @@ -0,0 +1,17 @@ +;; Rust config +(require 'rust-mode) +(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) +(setq rust-format-on-save t) +(add-hook 'rust-mode-hook 'cargo-minor-mode) +(with-eval-after-load 'rust-mode + (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)) +(add-hook 'rust-mode-hook #'racer-mode) +(add-hook 'racer-mode-hook #'eldoc-mode) +(add-hook 'racer-mode-hook #'company-mode) +(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) + +;; Rust playground https://github.com/grafov/rust-playground +;; M-x rust-playground -> Type -> Ctrl-RET -> See results -> M-x rust-playground-rm +(require rust-playground) + +(provide 'rust-init) diff --git a/lib/init-rust.el b/lib/init-rust.el new file mode 100644 index 0000000..f01a588 --- /dev/null +++ b/lib/init-rust.el @@ -0,0 +1,17 @@ +;; Rust config +(require 'rust-mode) +(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) +(setq rust-format-on-save t) +(add-hook 'rust-mode-hook 'cargo-minor-mode) +(with-eval-after-load 'rust-mode + (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)) +(add-hook 'rust-mode-hook #'racer-mode) +(add-hook 'racer-mode-hook #'eldoc-mode) +(add-hook 'racer-mode-hook #'company-mode) +(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) + +;; Rust playground https://github.com/grafov/rust-playground +;; M-x rust-playground -> Type -> Ctrl-RET -> See results -> M-x rust-playground-rm +(require 'rust-playground) + +(provide 'init-rust) diff --git a/lib/init-web.el b/lib/init-web.el new file mode 100644 index 0000000..961b000 --- /dev/null +++ b/lib/init-web.el @@ -0,0 +1,12 @@ +;; Init Web configuration +(require 'css-mode) + +(require 'vue-mode) +;; (add-to-list 'auto-mode-alist '("\\.vue\\'" . vue-mode)) + +(require 'skewer-mode) +(add-hook 'js2-mode-hook 'skewer-mode) +(add-hook 'css-mode-hook 'skewer-css-mode) +(add-hook 'html-mode-hook 'skewer-html-mode) + +(provide 'init-web)