Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 7.66 KB | None | 0 0
  1. ;;; .emacs.el -- Emacs configuration file.
  2.  
  3. ;;; Commentary:
  4.  
  5. ;;; Code:
  6. (package-initialize)
  7.  
  8. (when (memq window-system '(mac ns x))
  9.   (exec-path-from-shell-initialize))
  10.  
  11. (require 'package)
  12. (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
  13.                     (not (gnutls-available-p))))
  14.        (proto (if no-ssl "http" "https")))
  15.   ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  16.   (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  17.   ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  18.   (when (< emacs-major-version 24)
  19.   ;; For important compatibility libraries like cl-lib
  20.     (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
  21. (package-initialize)
  22. (custom-set-variables
  23.  ;; custom-set-variables was added by Custom.
  24.  ;; If you edit it by hand, you could mess it up, so be careful.
  25.  ;; Your init file should contain only one such instance.
  26.  ;; If there is more than one, they won't work right.
  27.  '(company-quickhelp-color-background "#4F4F4F")
  28.  '(company-quickhelp-color-foreground "#DCDCCC")
  29.  '(custom-enabled-themes (quote (spacemacs-dark)))
  30.  '(custom-safe-themes
  31.    (quote
  32.     ("ec5f697561eaf87b1d3b087dd28e61a2fc9860e4c862ea8e6b0b77bd4967d0ba" "f71859eae71f7f795e734e6e7d178728525008a28c325913f564a42f74042c31" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" default)))
  33.  '(fci-rule-color "#383838")
  34.  '(haskell-process-type (quote stack-ghci))
  35.  '(nrepl-message-colors
  36.    (quote
  37.     ("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")))
  38.  '(package-selected-packages
  39.    (quote
  40.     (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)))
  41.  '(py-shell-name "python3")
  42.  '(vc-annotate-background "#2B2B2B")
  43.  '(vc-annotate-color-map
  44.    (quote
  45.     ((20 . "#BC8383")
  46.      (40 . "#CC9393")
  47.      (60 . "#DFAF8F")
  48.      (80 . "#D0BF8F")
  49.      (100 . "#E0CF9F")
  50.      (120 . "#F0DFAF")
  51.      (140 . "#5F7F5F")
  52.      (160 . "#7F9F7F")
  53.      (180 . "#8FB28F")
  54.      (200 . "#9FC59F")
  55.      (220 . "#AFD8AF")
  56.      (240 . "#BFEBBF")
  57.      (260 . "#93E0E3")
  58.      (280 . "#6CA0A3")
  59.      (300 . "#7CB8BB")
  60.      (320 . "#8CD0D3")
  61.      (340 . "#94BFF3")
  62.      (360 . "#DC8CC3"))))
  63.  '(vc-annotate-very-old-color "#DC8CC3"))
  64. (custom-set-faces
  65.  ;; custom-set-faces was added by Custom.
  66.  ;; If you edit it by hand, you could mess it up, so be careful.
  67.  ;; Your init file should contain only one such instance.
  68.  ;; If there is more than one, they won't work right.
  69.  )
  70.  
  71. (setq inhibit-startup-screen t)
  72. (menu-bar-mode 0)
  73. (tool-bar-mode 0)
  74. (scroll-bar-mode 0)
  75. (setq mac-command-modifier 'meta)
  76. (setq mac-option-modifier nil)
  77. ;; (setq spacemacs-theme-comment-bg nil)
  78. (set-face-attribute 'default nil :height 145)
  79.  
  80. (when (version<= "26.0.50" emacs-version )
  81.   (global-display-line-numbers-mode))
  82. (setq ring-bell-function 'ignore)
  83. (require 'ido)
  84. (ido-mode t)
  85.  
  86. (require 'spaceline-config)
  87. (spaceline-spacemacs-theme)
  88.  
  89. (require 'flymd)
  90.  
  91. (require 'js2-mode)
  92.  
  93. ;; use web-mode for .js and .jsx files
  94. (add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))
  95. (add-to-list 'auto-mode-alist '("\\.js$" . web-mode))
  96.  
  97. ;; http://www.flycheck.org/manual/latest/index.html
  98. (require 'flycheck)
  99.  
  100. ;; turn on flychecking globally
  101. (add-hook 'after-init-hook #'global-flycheck-mode)
  102.  
  103. ;; disable jshint since we prefer eslint checking
  104. (setq-default flycheck-disabled-checkers
  105.   (append flycheck-disabled-checkers
  106.     '(javascript-jshint)))
  107.  
  108. ;; use eslint with web-mode for js and jsx files
  109. (flycheck-add-mode 'javascript-eslint 'web-mode)
  110.  
  111. ;; customize flycheck temp file prefix
  112. (setq-default flycheck-temp-prefix ".flycheck")
  113.  
  114. ;; disable json-jsonlist checking for json files
  115. (setq-default flycheck-disabled-checkers
  116.   (append flycheck-disabled-checkers
  117.       '(json-jsonlist)))
  118.  
  119. ;; use local eslint from node_modules before global
  120. ;; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable
  121. (defun my/use-eslint-from-node-modules ()
  122.   (let* ((root (locate-dominating-file
  123.                 (or (buffer-file-name) default-directory)
  124.                 "node_modules"))
  125.          (eslint (and root
  126.                       (expand-file-name "node_modules/eslint/bin/eslint.js"
  127.                                         root))))
  128.     (when (and eslint (file-executable-p eslint))
  129.       (setq-local flycheck-javascript-eslint-executable eslint))))
  130. (add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
  131.  
  132. ;; adjust indents for web-mode to 2 spaces
  133. (defun my-web-mode-hook ()
  134.   "Hooks for Web mode.  Adjust indent."
  135.   ;;; http://web-mode.org/
  136.   (setq web-mode-markup-indent-offset 2)
  137.   (setq web-mode-css-indent-offset 2)
  138.   (setq web-mode-code-indent-offset 2))
  139. (add-hook 'web-mode-hook  'my-web-mode-hook)
  140.  
  141. ;; for better jsx syntax-highlighting in web-mode
  142. ;; - courtesy of Patrick @halbtuerke
  143. (defadvice web-mode-highlight-part (around tweak-jsx activate)
  144.   "Match on js and jsx files."
  145.   (if (or (equal web-mode-content-type "js")
  146.       (equal web-mode-content-type "jsx"))
  147.     (let ((web-mode-enable-part-face nil))
  148.       ad-do-it)
  149.     ad-do-it))
  150. ;;  (if (equal web-mode-content-type "jsx")
  151. ;;    (let ((web-mode-enable-part-face nil))
  152. ;;      ad-do-it)
  153. ;;    ad-do-it))
  154.  
  155.  
  156. ;;; runs eslint --fix on the current file after save
  157. ;;; alpha quality -- use at your own risk
  158.  
  159. (defun eslint-fix-file ()
  160.   (interactive)
  161.   (message "eslint --fixing the file" (buffer-file-name))
  162.   (shell-command (concat "eslint --fix " (buffer-file-name))))
  163.  
  164. (defun eslint-fix-file-and-revert ()
  165.   (interactive)
  166.   (eslint-fix-file)
  167.   (revert-buffer t t))
  168.  
  169. (add-hook 'js2-mode-hook
  170.           (lambda ()
  171.             (add-hook 'after-save-hook #'eslint-fix-file-and-revert)))
  172.  
  173. (require 'neotree)
  174. (global-set-key [f8] 'neotree-toggle)
  175.  
  176. (add-to-list 'exec-path "/usr/local/bin/stack")
  177. (add-to-list 'exec-path "/usr/local/bin/ghc-8.4.3")
  178. (add-to-list 'exec-path "/usr/local/bin/ghci-8.4.3")
  179.  
  180. ;; Haskell setup
  181. (require 'haskell-mode)
  182. (require 'haskell-interactive-mode)
  183. (require 'haskell-process)
  184. (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
  185.  
  186. ;; Parinfer
  187. (require 'use-package)
  188. (require 'parinfer)
  189. (use-package parinfer
  190.   :ensure t
  191.   :bind
  192.   (("C-," . parinfer-toggle-mode))
  193.   :init
  194.   (progn
  195.     (setq parinfer-extensions
  196.           '(defaults       ; should be included.
  197.              pretty-parens  ; different paren styles for different modes.
  198.              ;;evil           ; If you use Evil.
  199.              ;;lispy          ; If you use Lispy. With this extension, you should install Lispy and do not enable lispy-mode directly.
  200.              paredit        ; Introduce some paredit commands.
  201.              smart-tab      ; C-b & C-f jump positions and smart shift with tab & S-tab.
  202.              smart-yank))   ; Yank behavior depend on mode.
  203.     (add-hook 'clojure-mode-hook #'parinfer-mode)
  204.     (add-hook 'emacs-lisp-mode-hook #'parinfer-mode)
  205.     (add-hook 'common-lisp-mode-hook #'parinfer-mode)
  206.     (add-hook 'scheme-mode-hook #'parinfer-mode)
  207.     (add-hook 'lisp-mode-hook #'parinfer-mode)))
  208.  
  209. (require 'python-mode)
  210. (setq py-install-directory "/usr/local/bin/python3")
  211. (add-to-list 'load-path py-install-directory)
  212.  
  213. (defun load-into-py-shell ()
  214.   "Start interactive shell with file loaded."
  215.   (interactive)
  216.   (py-shell-send-file buffer-file-name))
  217.  
  218. (define-key python-mode-map (kbd "C-c C-l") 'load-into-py-shell)
  219.  
  220. (provide '.emacs)
  221. ;; (mac-auto-operator-composition-mode t)
  222. ;;; .emacs ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement