My emacs configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

260 lines
8.3 KiB

4 years ago
  1. ;;; My basic configuration Gerardo Marx 15/Jul/2020
  2. ;;--------
  3. ;; Melpa repository:
  4. (require 'package)
  5. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  6. (package-initialize)
  7. ;; use-package
  8. (unless (package-installed-p 'use-package)
  9. (package-refresh-contents)
  10. (package-install 'use-package))
  11. ;; frame size
  12. (setq initial-frame-alist '((top . 10)(left . 20)
  13. (width . 90)(height . 50)))
  14. ;; which-key:
  15. (use-package which-key
  16. :ensure t
  17. :config (which-key-mode))
  18. ;; doom-themes
  19. (use-package doom-themes
  20. :ensure t
  21. :config
  22. (setq doom-themes-enable-bold t ; if nil, bold is universally disabled
  23. doom-themes-enable-italic t) ; if nil, italics is universally disabled
  24. (load-theme ;'doom-one
  25. 'doom-tomorrow-day t)
  26. ;; Enable flashing mode-line on errors
  27. (doom-themes-visual-bell-config)
  28. ;; Enable custom neotree theme (all-the-icons must be installed!)
  29. (doom-themes-neotree-config)
  30. ;; or for treemacs users
  31. (setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
  32. (doom-themes-treemacs-config)
  33. ;; Corrects (and improves) org-mode's native fontification.
  34. (doom-themes-org-config))
  35. ;; modeline
  36. (use-package doom-modeline
  37. :ensure t
  38. :init (doom-modeline-mode 1))
  39. ;; icons:
  40. (use-package all-the-icons
  41. :ensure t) ;; --> you need this M-x all-the-icons-install-fonts
  42. ;; startup config
  43. (setq inhibit-startup-message t) ;;inhibit startup
  44. (tool-bar-mode -1)
  45. (menu-bar-mode -1)
  46. (global-hl-line-mode +1) ;; highlith current line
  47. (delete-selection-mode +1) ;; deletes selected text and replace it
  48. (scroll-bar-mode -1)
  49. (setq ns-right-alternate-modifier nil) ;; right option macos key enable
  50. (setq backup-directory-alist '(("." . "~/.saves"))) ;; a backup dir to store no saved files
  51. (fset 'yes-or-no-p 'y-or-n-p) ;; Ask y/n instead of yes/no
  52. (add-hook 'prog-mode-hook 'display-line-numbers-mode) ;; display line number when programming
  53. (show-paren-mode +1) ;; show matching parentheses
  54. ;; helm package:
  55. (use-package helm
  56. :ensure t
  57. :demand t
  58. :bind (("M-x" . helm-M-x)
  59. ("C-c h x" . helm-register) ; C-x r SPC and C-x r j
  60. ("C-c h g" . helm-google-suggest)
  61. ("C-c h M-:" . helm-eval-expression-with-eldoc)
  62. ("C-x C-f" . helm-find-files))
  63. :config
  64. (require 'helm-config)
  65. (helm-mode t))
  66. ;; projectile:
  67. (use-package projectile
  68. :ensure t
  69. :config
  70. (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
  71. (projectile-mode t))
  72. ;; helm-projectile:
  73. (use-package helm-projectile
  74. :ensure t
  75. :init
  76. (progn
  77. (require 'tramp)
  78. )
  79. :config (helm-projectile-on))
  80. ;; temp:
  81. (setq ido-enable-flex-matching t)
  82. ;; dash-board:
  83. (use-package dashboard
  84. :ensure t
  85. :init
  86. (progn
  87. (setq dashboard-items '((recents . 5)
  88. (bookmarks . 5)
  89. (projects . 5)
  90. (agenda . 5)))
  91. (setq dashboard-banner-logo-title "Welcome gMarx")
  92. (setq dashboard-set-file-icons t)
  93. (setq dashboard-set-init-info t)
  94. (add-to-list 'dashboard-items '(agenda) t)
  95. (setq dashboard-startup-banner 'logo)
  96. )
  97. :config
  98. (dashboard-setup-startup-hook))
  99. ;; treemacs
  100. (use-package treemacs
  101. :ensure t
  102. :init
  103. (with-eval-after-load 'winum
  104. (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
  105. :config
  106. (progn
  107. (setq treemacs-is-never-other-window t)
  108. (setq treemacs-width 35))
  109. :bind
  110. (:map global-map
  111. ("M-0" . treemacs-select-window)
  112. ("C-x t t" . treemacs)))
  113. ;; treemacs-projectile
  114. (use-package treemacs-projectile
  115. :after treemacs projectile
  116. :ensure t)
  117. ;; magit
  118. (use-package magit
  119. :ensure t)
  120. ;; latex
  121. (use-package auctex
  122. :defer t
  123. :ensure t)
  124. ;; pdlatex:
  125. (setq latex-run-command "pdflatex")
  126. (setenv "PATH" (concat (getenv "PATH") ":/Library/TeX/texbin/"))
  127. (setq exec-path (append exec-path '("/Library/TeX/texbin/")))
  128. ;; Use pdf-tools to open PDF files
  129. (use-package pdf-tools
  130. :ensure nil
  131. :pin melpa
  132. :config
  133. (custom-set-variables
  134. '(pdf-tools-handle-upgrades nil)) ; Use brew upgrade pdf-tools instead.
  135. (setq pdf-info-epdfinfo-program "/usr/local/bin/epdfinfo"))
  136. ;; Use pdf-tools to open PDF files
  137. (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
  138. TeX-source-correlate-start-server t)
  139. (add-hook 'LaTeX-mode-hook 'pdf-view-mode)
  140. ;; Update PDF buffers after successful LaTeX runs
  141. (add-hook 'TeX-after-compilation-finished-functions
  142. #'TeX-revert-document-buffer)
  143. ;; flycheck
  144. (use-package flycheck
  145. :ensure t
  146. :init (global-flycheck-mode))
  147. ;; expand region
  148. (use-package expand-region
  149. :ensure t
  150. :bind
  151. ("C-=" . er/expand-region)
  152. ("C--" . er/contract-region))
  153. ;; org-bullets
  154. (use-package org-bullets
  155. :ensure t
  156. :init
  157. (setq org-support-shift-select t)
  158. :config
  159. (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
  160. ;; Company-mode
  161. (use-package company
  162. :ensure t
  163. :init
  164. (add-hook 'after-init-hook 'global-company-mode))
  165. ;; ispell
  166. (dolist (hook '(org-mode-hook latex-mode-hook tex-mode-hook git-commit-mode-hook))
  167. (add-hook hook (lambda () (flyspell-mode 1))))
  168. (setq ispell-dictionary "english")
  169. (setq ispell-program-name "/usr/local/bin/aspell")
  170. ;; Set default font:
  171. (add-to-list 'default-frame-alist
  172. '(font . "Source Code Pro-18"))
  173. ;; Activatiin ORG-mode
  174. (global-set-key (kbd "C-c l") 'org-store-link)
  175. (global-set-key (kbd "C-c a") 'org-agenda)
  176. (global-set-key (kbd "C-c c") 'org-capture)
  177. ;;++++++++++
  178. ;; Todo states for ORG:
  179. (setq org-todo-keywords
  180. (quote
  181. ((sequence "TODO(t)" "PROGRESS(g)" "PAUSE(p)" "CHECK(k)" "|" "DONE(d)" "CANCELED(c)"))))
  182. (setq org-todo-keyword-faces
  183. '(("PROGRESS" . "orange") ("PAUSE" . "magenta") ("CHECK" . "purple") ("CANCELED" . "red") ("DONE" . "green")))
  184. ;; capture:
  185. (setq org-capture-templates
  186. (quote (
  187. ("a" ; hotkey
  188. "Academia Todo" ; name
  189. entry ; type
  190. (file+headline "/Users/gmarx/beorg/academia.org" "Tasks") ;target
  191. "* TODO [#B] %^{Task}" ; template
  192. )
  193. ("t"
  194. "Task PhD"
  195. entry
  196. (file+datetree "~/beorg/phd.org")
  197. "* TODO [#A] %^{Task}")
  198. ("d"
  199. "Students"
  200. item
  201. (file+datetree "~/beorg/students.org")
  202. "- %U - %^{Activity}")
  203. ("r"
  204. "to Read"
  205. entry
  206. (file+headline "~/beorg/inbox.org" "to read")
  207. "* TODO %^{topic to read}\n%^{Why to read this?}"
  208. )
  209. ("s"
  210. "Schedule an event"
  211. entry
  212. (file+headline "~/beorg/inbox.org" "Scheduled events")
  213. "* %^{Event}\nSCHEDULED: %^t"
  214. )
  215. ("k"
  216. "Task inbox"
  217. entry
  218. (file+headline "~/beorg/inbox.org" "Tasks")
  219. "* TODO %^{Task} -> %^{move to}"
  220. )
  221. ("c"
  222. "Cheat-Sheet"
  223. entry
  224. (file+headline "~/beorg/cheatsheets.org" "Notes")
  225. "* %^{what solves}\n%^{the commands are}"
  226. )
  227. )))
  228. (custom-set-variables
  229. ;; custom-set-variables was added by Custom.
  230. ;; If you edit it by hand, you could mess it up, so be careful.
  231. ;; Your init file should contain only one such instance.
  232. ;; If there is more than one, they won't work right.
  233. '(custom-safe-themes
  234. (quote
  235. ("2f1518e906a8b60fac943d02ad415f1d8b3933a5a7f75e307e6e9a26ef5bf570" "fe94e2e42ccaa9714dd0f83a5aa1efeef819e22c5774115a9984293af609fce7" default)))
  236. '(org-agenda-files
  237. (quote
  238. ("~/beorg/students.org" "~/beorg/inbox.org" "~/beorg/academia.org")))
  239. '(package-selected-packages
  240. (quote
  241. (pdf-tools company org-bullets expand-region flycheck treemacs-projectile treemacs magit auctex dashboard helm-projectile helm doom-modeline doom-themes which-key use-package projectile)))
  242. '(pdf-tools-handle-upgrades nil)
  243. '(safe-local-variable-values
  244. (quote
  245. ((org-attach-directory . "students/")
  246. (org-attach-use-inheritance . t)
  247. (org-attach-preferred-new-method . ask)
  248. (pyvenv-workon . keesman_env)
  249. (org-edit-src-content . 0)
  250. (org-src-preserve-indentation . t)))))
  251. (custom-set-faces
  252. ;; custom-set-faces was added by Custom.
  253. ;; If you edit it by hand, you could mess it up, so be careful.
  254. ;; Your init file should contain only one such instance.
  255. ;; If there is more than one, they won't work right.
  256. )