alex / emacs-config

~/.emacs.d/init.el Commits Diff Raw
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;;; All Buffers
;; Show line numbers
(when (version<= "26.0.50" emacs-version)
  (global-display-line-numbers-mode))

;; powerline status bar
(use-package powerline
  :ensure t
  :config
  (powerline-default-theme))

;; evil for vim emulation
(use-package evil
  :ensure t
  :config
  (evil-mode))

;; flycheck for syntax checking (error squigglies)
(use-package flycheck
  :ensure t
  :hook ((after-init . global-flycheck-mode)))

;; company for autocomplete
(use-package company
  :ensure t
  :hook ((after-init . global-company-mode)))

;;; GraphQL Editor
(use-package graphql-mode
  :ensure t)

;;; Typescript IDE
;; Add node_modules to PATH
(use-package add-node-modules-path
  :ensure t
  :hook ((typescript-mode . add-node-modules-path)))

;; typescript-mode for typescript
(use-package typescript-mode
  :ensure t
  :after (flycheck)
  :config
  (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
)

;; tide for typescript
(use-package tide
  :ensure t
  :after (typescript-mode company flycheck)
  :hook ((typescript-mode . tide-setup)
         (typescript-mode . tide-hl-identifier-mode)
         (before-save . tide-format-before-save))
  :config
  (flycheck-add-next-checker 'typescript-tide 'javascript-eslint)
)

;; Backup files in separate directory
(setq
   backup-by-copying t      ; don't clobber symlinks
   backup-directory-alist
    '(("." . "~/.emacs/backups/"))    ; don't litter my fs tree
   delete-old-versions t
   kept-new-versions 6
   kept-old-versions 2
   version-control t)       ; use versioned backups

;; Fill Column Indicator
(use-package fill-column-indicator
  :ensure t
  :after (typescript-mode)
  :hook ((typescript-mode . fci-mode))
  :config
  (setq fci-rule-width 1)
  (setq fci-rule-column 100)
)

(custom-set-variables
 ;; custom-set-variables 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.
 '(custom-enabled-themes '(wombat))
 '(inhibit-startup-screen t)
 '(package-selected-packages '(typescript-mode tide company evil powerline use-package))
 '(warning-suppress-log-types '((comp))))
(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.
 )