Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;; .emacs.el -- Emacs configuration file.
- ;;; Commentary:
- ;;; Code:
- (package-initialize)
- (when (memq window-system '(mac ns x))
- (exec-path-from-shell-initialize))
- (require 'package)
- (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
- (not (gnutls-available-p))))
- (proto (if no-ssl "http" "https")))
- ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
- (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
- ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
- (when (< emacs-major-version 24)
- ;; For important compatibility libraries like cl-lib
- (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
- (package-initialize)
- (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.
- '(company-quickhelp-color-background "#4F4F4F")
- '(company-quickhelp-color-foreground "#DCDCCC")
- '(custom-enabled-themes (quote (spacemacs-dark)))
- '(custom-safe-themes
- (quote
- ("ec5f697561eaf87b1d3b087dd28e61a2fc9860e4c862ea8e6b0b77bd4967d0ba" "f71859eae71f7f795e734e6e7d178728525008a28c325913f564a42f74042c31" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" default)))
- '(fci-rule-color "#383838")
- '(haskell-process-type (quote stack-ghci))
- '(nrepl-message-colors
- (quote
- ("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")))
- '(package-selected-packages
- (quote
- (python-mode paredit parinfer clojure-mode-extra-font-locking cider flymd zenburn-theme challenger-deep-theme haskell-mode neotree web-mode json-mode flycheck js2-mode spaceline spacemacs-theme)))
- '(py-shell-name "python3")
- '(vc-annotate-background "#2B2B2B")
- '(vc-annotate-color-map
- (quote
- ((20 . "#BC8383")
- (40 . "#CC9393")
- (60 . "#DFAF8F")
- (80 . "#D0BF8F")
- (100 . "#E0CF9F")
- (120 . "#F0DFAF")
- (140 . "#5F7F5F")
- (160 . "#7F9F7F")
- (180 . "#8FB28F")
- (200 . "#9FC59F")
- (220 . "#AFD8AF")
- (240 . "#BFEBBF")
- (260 . "#93E0E3")
- (280 . "#6CA0A3")
- (300 . "#7CB8BB")
- (320 . "#8CD0D3")
- (340 . "#94BFF3")
- (360 . "#DC8CC3"))))
- '(vc-annotate-very-old-color "#DC8CC3"))
- (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.
- )
- (setq inhibit-startup-screen t)
- (menu-bar-mode 0)
- (tool-bar-mode 0)
- (scroll-bar-mode 0)
- (setq mac-command-modifier 'meta)
- (setq mac-option-modifier nil)
- ;; (setq spacemacs-theme-comment-bg nil)
- (set-face-attribute 'default nil :height 145)
- (when (version<= "26.0.50" emacs-version )
- (global-display-line-numbers-mode))
- (setq ring-bell-function 'ignore)
- (require 'ido)
- (ido-mode t)
- (require 'spaceline-config)
- (spaceline-spacemacs-theme)
- (require 'flymd)
- (require 'js2-mode)
- ;; use web-mode for .js and .jsx files
- (add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.js$" . web-mode))
- ;; http://www.flycheck.org/manual/latest/index.html
- (require 'flycheck)
- ;; turn on flychecking globally
- (add-hook 'after-init-hook #'global-flycheck-mode)
- ;; disable jshint since we prefer eslint checking
- (setq-default flycheck-disabled-checkers
- (append flycheck-disabled-checkers
- '(javascript-jshint)))
- ;; use eslint with web-mode for js and jsx files
- (flycheck-add-mode 'javascript-eslint 'web-mode)
- ;; customize flycheck temp file prefix
- (setq-default flycheck-temp-prefix ".flycheck")
- ;; disable json-jsonlist checking for json files
- (setq-default flycheck-disabled-checkers
- (append flycheck-disabled-checkers
- '(json-jsonlist)))
- ;; use local eslint from node_modules before global
- ;; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable
- (defun my/use-eslint-from-node-modules ()
- (let* ((root (locate-dominating-file
- (or (buffer-file-name) default-directory)
- "node_modules"))
- (eslint (and root
- (expand-file-name "node_modules/eslint/bin/eslint.js"
- root))))
- (when (and eslint (file-executable-p eslint))
- (setq-local flycheck-javascript-eslint-executable eslint))))
- (add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
- ;; adjust indents for web-mode to 2 spaces
- (defun my-web-mode-hook ()
- "Hooks for Web mode. Adjust indent."
- ;;; http://web-mode.org/
- (setq web-mode-markup-indent-offset 2)
- (setq web-mode-css-indent-offset 2)
- (setq web-mode-code-indent-offset 2))
- (add-hook 'web-mode-hook 'my-web-mode-hook)
- ;; for better jsx syntax-highlighting in web-mode
- ;; - courtesy of Patrick @halbtuerke
- (defadvice web-mode-highlight-part (around tweak-jsx activate)
- "Match on js and jsx files."
- (if (or (equal web-mode-content-type "js")
- (equal web-mode-content-type "jsx"))
- (let ((web-mode-enable-part-face nil))
- ad-do-it)
- ad-do-it))
- ;; (if (equal web-mode-content-type "jsx")
- ;; (let ((web-mode-enable-part-face nil))
- ;; ad-do-it)
- ;; ad-do-it))
- ;;; runs eslint --fix on the current file after save
- ;;; alpha quality -- use at your own risk
- (defun eslint-fix-file ()
- (interactive)
- (message "eslint --fixing the file" (buffer-file-name))
- (shell-command (concat "eslint --fix " (buffer-file-name))))
- (defun eslint-fix-file-and-revert ()
- (interactive)
- (eslint-fix-file)
- (revert-buffer t t))
- (add-hook 'js2-mode-hook
- (lambda ()
- (add-hook 'after-save-hook #'eslint-fix-file-and-revert)))
- (require 'neotree)
- (global-set-key [f8] 'neotree-toggle)
- (add-to-list 'exec-path "/usr/local/bin/stack")
- (add-to-list 'exec-path "/usr/local/bin/ghc-8.4.3")
- (add-to-list 'exec-path "/usr/local/bin/ghci-8.4.3")
- ;; Haskell setup
- (require 'haskell-mode)
- (require 'haskell-interactive-mode)
- (require 'haskell-process)
- (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
- ;; Parinfer
- (require 'use-package)
- (require 'parinfer)
- (use-package parinfer
- :ensure t
- :bind
- (("C-," . parinfer-toggle-mode))
- :init
- (progn
- (setq parinfer-extensions
- '(defaults ; should be included.
- pretty-parens ; different paren styles for different modes.
- ;;evil ; If you use Evil.
- ;;lispy ; If you use Lispy. With this extension, you should install Lispy and do not enable lispy-mode directly.
- paredit ; Introduce some paredit commands.
- smart-tab ; C-b & C-f jump positions and smart shift with tab & S-tab.
- smart-yank)) ; Yank behavior depend on mode.
- (add-hook 'clojure-mode-hook #'parinfer-mode)
- (add-hook 'emacs-lisp-mode-hook #'parinfer-mode)
- (add-hook 'common-lisp-mode-hook #'parinfer-mode)
- (add-hook 'scheme-mode-hook #'parinfer-mode)
- (add-hook 'lisp-mode-hook #'parinfer-mode)))
- (require 'python-mode)
- (setq py-install-directory "/usr/local/bin/python3")
- (add-to-list 'load-path py-install-directory)
- (defun load-into-py-shell ()
- "Start interactive shell with file loaded."
- (interactive)
- (py-shell-send-file buffer-file-name))
- (define-key python-mode-map (kbd "C-c C-l") 'load-into-py-shell)
- (provide '.emacs)
- ;; (mac-auto-operator-composition-mode t)
- ;;; .emacs ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement