init.el 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ;; ----------- Default Variables -----------
  2. ;; Global variables
  3. (setq
  4. inhibit-startup-screen t
  5. column-number-mode t
  6. scroll-error-top-bottom t
  7. show-paren-delay 0.25)
  8. ;; Tab Config
  9. (setq tab-width 4)
  10. ;; ----------- Package Managing -----------
  11. ;; The package manager
  12. (require 'package)
  13. ;; Add package sources
  14. (setq
  15. package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
  16. ("org" . "https://orgmode.org/elpa/")
  17. ("melpa" . "https://melpa.org/packages/")
  18. ("melpa-stable" . "https://stable.melpa.org/packages/"))
  19. package-archive-priorities '(("melpa-stable" . 1)))
  20. (package-initialize)
  21. (unless (package-installed-p 'use-package)
  22. (package-refresh-contents)
  23. (package-install 'use-package))
  24. (require 'use-package)
  25. (setq use-package-always-ensure t)
  26. (use-package highlight-parentheses
  27. :config
  28. (define-globalized-minor-mode global-highlight-parentheses-mode
  29. highlight-parentheses-mode
  30. (lambda ()
  31. (highlight-parentheses-mode t)))
  32. (global-highlight-parentheses-mode t)
  33. )
  34. ;; ----------- Ensime -----------
  35. ;; Java/Scala featues. Includes:
  36. ;; * Inferred types
  37. ;; * Autocomplete
  38. ;; * Syntax highlighting
  39. ;; * Jump to source/docs
  40. ;; * Refactoring
  41. ;; * Error detection
  42. (use-package ensime
  43. :pin melpa-stable)
  44. ; --------- C Syntax checker ---------
  45. (use-package flycheck-irony)
  46. ;; xTerm mouse support
  47. ;; Disable because it became annoying, sounds cool though.
  48. ;;
  49. ;;(require 'mouse)
  50. ;;(xterm-mouse-mode t)
  51. ;; ---------- Color Themes ----------
  52. (use-package color-theme
  53. ;; Investiigate: Fixes error about missing directory
  54. :init
  55. (unless (file-exists-p "~/.emacs.d/elpa/color-theme-20070910.1007/themes") (make-directory "~/.emacs.d/elpa/color-theme-20070910.1007/themes"))
  56. :config
  57. (color-theme-initialize))
  58. (use-package base16-theme
  59. :requires color-theme
  60. :config (load-theme 'base16-tomorrow-night t))
  61. ;; ------------ Web Mode ------------
  62. (use-package multi-web-mode
  63. :config
  64. (setq mweb-default-major-mode 'html-mode)
  65. (setq mweb-tags
  66. '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
  67. (js-mode "<script[^>]*>" "</script>")
  68. (css-mode "<style[^>]*>" "</style>")))
  69. (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
  70. (multi-web-global-mode 1))
  71. ;; ------------ Git Mode ------------
  72. (use-package magit)
  73. ;; ----------- Rust Mode ------------
  74. (use-package rust-mode)
  75. (use-package rust-playground
  76. :requires rust-mode)
  77. (use-package cargo
  78. :requires rust-mode)
  79. (use-package flycheck-rust
  80. :requires rust-mode)
  81. ;; ----------- i3 Support ----------
  82. ;(if (equal (getenv "DESKTOP_SESSION") "i3")
  83. ; (use-package i3wm))
  84. ;; --------- Racket Mode ----------
  85. (use-package racket-mode)
  86. ;; --------- Scala Mode -----------
  87. (use-package scala-mode)
  88. ;; ---------- C# Mode -------------
  89. (use-package csharp-mode)
  90. ;; ---- StackOverflow Client ------
  91. ;(use-package sx)
  92. ;; -------- Spellcheck ------------
  93. (defun flyspell-detect-ispell-args (&optional run-together)
  94. (cond ((string-match "aspell$" ispell-program-name)
  95. (append (list "--sug-mode=ultra" "--lang=en_US") (if run-together '("--run-together" "--run-together-limit=5" "--run-together-min=2"))))
  96. ((string-match "hunspell$" ispell-program-name)
  97. "-d en_US"))
  98. )
  99. (use-package flyspell-correct-popup
  100. :config
  101. (cond
  102. ((executable-find "aspell")
  103. (setq ispell-program-name "aspell"))
  104. ((executable-find "hunspell")
  105. (setq ispell-program-name "hunspell")
  106. (setq ispell-local-dictionary "en_US")
  107. (setq ispell-local-dictionary-alist '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8))))
  108. (t
  109. (setq ispell-program-name nil)))
  110. (setq-default ispell-extra-args (flyspell-detect-ispell-args t))
  111. (global-set-key (kbd "M-s") 'ispell-word)
  112. (setq-default flyspell-issue-message-flag nil)
  113. (dolist (hook '(text-mode-hook magit-mode-hook)) (add-hook hook (lambda () (flyspell-mode))))
  114. (add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode)))
  115. )
  116. (custom-set-variables
  117. ;; custom-set-variables was added by Custom.
  118. ;; If you edit it by hand, you could mess it up, so be careful.
  119. ;; Your init file should contain only one such instance.
  120. ;; If there is more than one, they won't work right.
  121. '(package-selected-packages
  122. (quote
  123. (highlight-parentheses flyspell-correct-popup rust-mode rust-playground slime-volleyball use-package multi-web-mode magit ensime color-theme base16-theme))))
  124. (custom-set-faces
  125. ;; custom-set-faces was added by Custom.
  126. ;; If you edit it by hand, you could mess it up, so be careful.
  127. ;; Your init file should contain only one such instance.
  128. ;; If there is more than one, they won't work right.
  129. )