refactor
This commit is contained in:
25
lib/init-editor.el
Normal file
25
lib/init-editor.el
Normal file
@@ -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)
|
||||
33
lib/init-js-ts.el
Normal file
33
lib/init-js-ts.el
Normal file
@@ -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)
|
||||
30
lib/init-pkg.el
Normal file
30
lib/init-pkg.el
Normal file
@@ -0,0 +1,30 @@
|
||||
(require 'package)
|
||||
|
||||
(add-to-list 'package-archives
|
||||
'("elpy" . "http://jorgenschaefer.github.io/packages/"))
|
||||
|
||||
(add-to-list 'package-archives
|
||||
'("marmalade" . "http://marmalade-repo.org/packages/"))
|
||||
|
||||
(add-to-list 'package-archives
|
||||
'("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") t)
|
||||
|
||||
(add-to-list 'load-path "~/.emacs.d/site-lisp/")
|
||||
|
||||
|
||||
; 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 rust-playground css-mode skewer-mode))
|
||||
|
||||
|
||||
; activate all the packages
|
||||
(package-initialize)
|
||||
|
||||
; fetch the list of packages available
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
|
||||
; install the missing packages
|
||||
(dolist (package package-list)
|
||||
(unless (package-installed-p package)
|
||||
(package-install package)))
|
||||
17
lib/init-rust
Normal file
17
lib/init-rust
Normal file
@@ -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)
|
||||
17
lib/init-rust.el
Normal file
17
lib/init-rust.el
Normal file
@@ -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)
|
||||
12
lib/init-web.el
Normal file
12
lib/init-web.el
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user