init.el 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. ;; Requires:
  2. ;; aspell - Spell checking
  3. ;; xclip - Copy/Paste
  4. ;; Optional:
  5. ;; gocode - Go auto complete
  6. ;; Enable loading my custom config files
  7. ;; Added by Package.el. This must come before configurations of
  8. ;; installed packages. Don't delete this line. If you don't want it,
  9. ;; just comment it out by adding a semicolon to the start of the line.
  10. ;; You may delete these explanatory comments.
  11. (package-initialize)
  12. (add-to-list 'load-path "~/.emacs.d/configs/")
  13. ;; ----------- Default Variables -----------
  14. ;; Global variables
  15. (defvar backup-directory (concat user-emacs-directory "backups"))
  16. (unless (file-exists-p backup-directory)
  17. (make-directory backup-directory))
  18. (setq-default inhibit-startup-screen t
  19. column-number-mode t
  20. scroll-error-top-bottom t
  21. show-paren-delay 0.25
  22. tab-width 4
  23. indent-tabs-mode nil
  24. backup-directory-alist `(("." . ,backup-directory))
  25. delete-old-versions t)
  26. ;; (global-linum-mode)
  27. ;; Delete selected text when typing (normal editor behavior)
  28. (delete-selection-mode t)
  29. ;; ------------- Keybindings -------------
  30. (require 'smart-home)
  31. (global-set-key (kbd "C-c /") 'comment-or-uncomment-region)
  32. (global-set-key (kbd "C-c C-k") 'compile)
  33. (global-set-key (kbd "M-<left>") 'backward-list)
  34. (global-set-key (kbd "M-<right>") 'forward-list)
  35. (global-set-key (kbd "M-<up>") 'racket-backward-up-list)
  36. ;; Can't seem to find forward-down-list.
  37. ;; Not very important since I would rarely use it anyway
  38. ;;(global-set-key (kbd "M-<down>") '?)
  39. (global-set-key (kbd "M-<delete>") 'kill-sexp)
  40. ;; ----------- Package Managing -----------
  41. (require 'package-loader)
  42. ;; ---------- Color Themes ----------
  43. ;; TODO: Fix warning underline to always be orange/yellow
  44. ;; Update: Seems it always takes the color of the foreground.
  45. ;; Also seems to ignore most properties. (e.g. overline, underline,
  46. ;; strike-though, etc.) Maybe it's an xterm problem?
  47. (use-package color-theme
  48. :config
  49. (color-theme-initialize)
  50. (load-theme 'Thomas-Experiement t))
  51. ;; ---------- Use X11 clipboard -----------
  52. (use-package xclip
  53. :if (executable-find "xclip")
  54. :init
  55. (add-to-list 'load-path "~/.emacs.d/elpa/xclip-1.4/")
  56. :config
  57. (xclip-mode 1))
  58. ;; --------- Parentheses Matching ---------
  59. (show-paren-mode)
  60. (use-package highlight-parentheses
  61. :init
  62. (define-globalized-minor-mode global-highlight-parentheses-mode
  63. highlight-parentheses-mode
  64. (lambda ()
  65. (highlight-parentheses-mode t)))
  66. :config
  67. (global-highlight-parentheses-mode t))
  68. ;; Use built-in pairing if available.
  69. ;; Otherwise install substitute
  70. (if (version<= "24.4" emacs-version)
  71. (electric-pair-mode)
  72. (use-package autopair
  73. :config
  74. (autopair-global-mode)))
  75. ;; ------------ xTerm Mouse ------------
  76. ;; Disable because it became annoying, sounds cool though.
  77. (use-package mouse
  78. :disabled
  79. :config
  80. (xterm-mouse-mode t))
  81. ;; ---------- Auto-complete -----------
  82. (use-package company
  83. :init
  84. (add-hook 'after-init-hook 'global-company-mode)
  85. :config
  86. (setq
  87. company-minimum-prefix-length 2
  88. ;; company-idle-delay nil
  89. ;; company-show-numbers t
  90. ;; company-tooltip-limit 20
  91. ;; company-dabbrev-downcase nil
  92. )
  93. ;; :bind ("C-;" . company-complete-common)
  94. )
  95. ;; ---------- Syntax Checking -----------
  96. (use-package flycheck
  97. :config
  98. (setq flycheck-check-syntax-automatically '(mode-enabled idle-change save)))
  99. ;; ----------- Scala Mode -----------
  100. (require 'scala)
  101. ;; ------------ Web Mode ------------
  102. (require 'web)
  103. ;; ------------ Git Mode ------------
  104. ;; TODO: make resolving merge conflicts hotkeys not use "^"
  105. ;; TODO: Conflict resolution theme is unreadable
  106. (when (version<= "24.4" emacs-version)
  107. (use-package magit
  108. :bind ("C-x g" . magit-status)))
  109. ;; ----------- Rust Mode ------------
  110. (require 'rust)
  111. ;; ----------- Go Mode -------------
  112. (require 'go)
  113. ;; ----------- i3 Support ----------
  114. (use-package i3wm
  115. :disabled
  116. :if (equal (getenv "DESKTOP_SESSION") "i3"))
  117. ;; --------- Racket Mode ----------
  118. (use-package racket-mode)
  119. ;; ---------- C# Mode -------------
  120. (use-package csharp-mode
  121. :if (version<= "24.4" emacs-version))
  122. ;; ------- Markdown Mode ----------
  123. (when (version<= "24.4" emacs-version)
  124. (use-package markdown-mode))
  125. ;; ---- StackOverflow Client ------
  126. (require 'stackoverflow)
  127. ;; -------- Spellcheck ------------
  128. (require 'spellcheck)
  129. ;; -------- REST Client ---------
  130. (require 'rest-client)
  131. ;; ------- Highlight TODO -------
  132. (require 'todo)
  133. ;; ---- Printer Integration -----
  134. (require 'printer)