init.el 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. ;;; init.el --- .Emacs Configuration -*- lexical-binding: t -*-
  2. ;;; Commentary:
  3. ;;
  4. ;; Emacs!!!
  5. ;;; Code:
  6. ;; Without this comment emacs25 adds (package-initialize) here
  7. ;; (package-initialize)
  8. ;;; Time Mark
  9. (setq emacs-load-start-time (current-time))
  10. (setq package-check-signature 'allow-unsigned)
  11. ;;; Fix TLS emacs 26.x
  12. (if (version<= emacs-version "26.2")
  13. (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
  14. ;;; Welcome message
  15. (setq-default initial-scratch-message
  16. (concat ";; Happy hacking, " user-login-name " - Emacs loves you!\n\n"))
  17. (defvar before-user-init-time (current-time)
  18. "Value of `current-time' when Emacs begins loading `user-init-file'.")
  19. ;;; Garbage Collector
  20. (progn
  21. ;; Set this to true to find GC issues.
  22. (setq garbage-collection-messages nil)
  23. ;; Increase the gc-cons-threshold to a very high number to decrease
  24. ;; the load and compile time. The value will be decreased
  25. ;; significantly after initialization to avoid long GC pauses during
  26. ;; normal usage.
  27. (setq gc-cons-threshold 402653184
  28. gc-cons-percentage 0.6)
  29. (setq read-process-output-max (* 1024 1024)) ;; 1mb
  30. ;; Reset GC to normal values.
  31. (add-hook 'emacs-startup-hook
  32. (lambda ()
  33. (message
  34. "[STARTUP] Loading %s...done (%.3fs)" user-init-file
  35. (float-time (time-subtract (current-time)
  36. before-user-init-time)))
  37. (when init-file-debug
  38. (message "Rolling back GC settings to sane values."))
  39. (setq gc-cons-threshold 16777216
  40. gc-cons-percentage 0.1))))
  41. ;;; Modules directory
  42. (push (concat user-emacs-directory "modules") load-path)
  43. ;;;------------------------------
  44. ;;; Features
  45. ;;;------------------------------
  46. ;;; https://stackoverflow.com/questions/2816019/in-lisp-avoid-cannot-open-load-file-when-using-require
  47. ;; @see https://www.reddit.com/r/emacs/comments/3kqt6e/2_easy_little_known_steps_to_speed_up_emacs_start/
  48. ;; Normally file-name-handler-alist is set to
  49. ;; (("\\`/[^/]*\\'" . tramp-completion-file-name-handler)
  50. ;; ("\\`/[^/|:][^/|]*:" . tramp-file-name-handler)
  51. ;; ("\\`/:" . file-name-non-special))
  52. ;; Which means on every .el and .elc file loaded during start up, it has to runs those regexps against the filename.
  53. (let* ((file-name-handler-alist nil))
  54. ;; package-initialize' takes 35% of startup time
  55. ;; need check https://github.com/hlissner/doom-emacs/wiki/FAQ#how-is-dooms-startup-so-fast for solution
  56. (require 'init-security)
  57. (require 'init-elpa)
  58. ;; theme
  59. ;; (require 'init-doom-theme)
  60. (require 'init-vscode-theme)
  61. ;; Utils
  62. (require 'init-utils)
  63. ;; GUI
  64. (require 'init-linum)
  65. (require 'init-gui)
  66. (require 'init-editing-utils)
  67. (require 'init-diminish)
  68. (require 'init-modeline)
  69. (require 'init-indent-guides)
  70. (require 'init-icons)
  71. (require 'init-neotree)
  72. (require 'init-dashboard)
  73. ;; Tools
  74. (require 'init-apache)
  75. (require 'init-company)
  76. (require 'init-flycheck)
  77. (require 'init-ivy)
  78. (require 'init-log4j)
  79. (require 'init-whitespace)
  80. (require 'init-emmet-mode)
  81. (require 'init-nginx)
  82. (require 'init-git)
  83. (require 'init-editorconfig)
  84. ;; Languages
  85. (require 'init-ccc)
  86. (require 'init-crystal)
  87. (require 'init-html)
  88. (require 'init-js-two)
  89. (require 'init-markdown)
  90. (require 'init-go)
  91. (require 'init-php)
  92. (require 'init-projectile)
  93. (require 'init-python)
  94. (require 'init-pkgbuild)
  95. (require 'init-less)
  96. (require 'init-lua)
  97. (require 'init-smartparens)
  98. (require 'init-sass)
  99. (require 'init-scss)
  100. (require 'init-typescript)
  101. (require 'init-vue)
  102. (require 'init-yaml)
  103. ;; Plus
  104. (require 'init-rainbow)
  105. (require 'init-web-mode)
  106. (require 'init-dotenv)
  107. (require 'init-dockerfile)
  108. (require 'init-dokuwiki)
  109. (require 'init-graphviz)
  110. (require 'init-linter)
  111. (require 'init-load-env-vars)
  112. (require 'init-restclient)
  113. (require 'init-terraform)
  114. (require 'init-ox-reveal))
  115. ;;; Custom variables
  116. (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
  117. ;;; Loads custom file
  118. (when (file-exists-p custom-file)
  119. (load custom-file))
  120. ;;; Settings
  121. (setq settings-file (expand-file-name "settings.el" user-emacs-directory))
  122. ;;; Loads settings file
  123. (when (file-exists-p custom-file)
  124. (load settings-file))
  125. ;; enable erase-buffer command
  126. (put 'erase-buffer 'disabled nil)
  127. (provide 'init)
  128. ;; Local Variables:
  129. ;; byte-compile-warnings: (not free-vars)
  130. ;; End:
  131. ;;; init.el ends here