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.

327 lines
10 KiB

4 years ago
4 years ago
4 years ago
4 years ago
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. :after projectile
  75. :ensure t
  76. :init
  77. (require 'tramp)
  78. :config
  79. (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. (setq dashboard-startup-banner 'logo)
  95. )
  96. :config
  97. (dashboard-setup-startup-hook))
  98. ;; treemacs
  99. (use-package treemacs
  100. :ensure t
  101. :init
  102. (with-eval-after-load 'winum
  103. (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
  104. :config
  105. (progn
  106. (setq treemacs-is-never-other-window t)
  107. (setq treemacs-width 35))
  108. :bind
  109. (:map global-map
  110. ("M-0" . treemacs-select-window)
  111. ("C-x t t" . treemacs)))
  112. ;; treemacs-projectile
  113. (use-package treemacs-projectile
  114. :after treemacs projectile
  115. :ensure t)
  116. ;; magit
  117. (use-package magit
  118. :ensure t)
  119. ;; latex
  120. (use-package tex
  121. :defer t
  122. :ensure auctex
  123. :init
  124. (progn
  125. (setq-default TeX-master nil) ; Query for master file.
  126. (setq TeX-auto-save t) ; Enable parse on save.
  127. (setq TeX-save-query nil)
  128. (setq TeX-command-force "LaTex")
  129. (setq latex-run-command "pdflatex")
  130. (setq TeX-parse-self t) ; Enable parse on load.
  131. (setenv "PATH" (concat (getenv "PATH") ":/Library/TeX/texbin/"))
  132. (setq exec-path (append exec-path '("/Library/TeX/texbin/")))
  133. ;; pdf-tools configuration
  134. (setq TeX-PDF-mode t)
  135. (add-hook 'TeX-after-compilation-finished-functions
  136. #'TeX-revert-document-buffer)
  137. (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
  138. TeX-source-correlate-start-server t)
  139. (setq pdf-info-epdfinfo-program "/usr/local/bin/epdfinfo")
  140. (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode))
  141. (add-hook 'pdf-view-mode-hook
  142. (lambda () (pdf-tools-enable-minor-modes)))
  143. )
  144. )
  145. ;; pdf-tools
  146. (use-package pdf-tools
  147. :ensure t
  148. :pin melpa
  149. :magic ("%PDF" . pdf-view-mode)
  150. :config
  151. (custom-set-variables
  152. '(pdf-tools-handle-upgrades nil))
  153. )
  154. ;;--------
  155. ;; latex-preview
  156. (use-package latex-preview-pane
  157. :ensure t)
  158. ;; latexmk
  159. (use-package auctex-latexmk
  160. :ensure t
  161. :init
  162. (auctex-latexmk-setup)
  163. :config
  164. (setq auctex-latexmk-inherit-TeX-PDF-mode t))
  165. ;;----------------------
  166. ;; flycheck
  167. (use-package flycheck
  168. :ensure t
  169. :init (global-flycheck-mode))
  170. ;; expand region
  171. (use-package expand-region
  172. :ensure t
  173. :bind
  174. ("C-=" . er/expand-region)
  175. ("C--" . er/contract-region))
  176. ;; org-bullets
  177. (use-package org-bullets
  178. :ensure t
  179. :init
  180. (setq org-support-shift-select t))
  181. ;; :hook
  182. ;; (org-mode . org-bullets-mode))
  183. ;;------pomodoro
  184. (use-package org-pomodoro
  185. :ensure t
  186. :after org
  187. :bind ("C-x p" . org-pomodoro))
  188. ;; org configuration:
  189. ;;(setq org-agenda-files '("~/beorg/phd.org" "~/beorg/students.org" "~/beorg/inbox.org" "~/beorg/academia.org"))
  190. (add-hook 'org-mode-hook
  191. (lambda()
  192. ;; dictionary
  193. (org-bullets-mode 1)
  194. (ispell-change-dictionary "en")
  195. (setq org-image-actual-width nil)
  196. (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5))
  197. (setq org-latex-create-formula-image-program 'imagemagick)
  198. (setq org-startup-indented t) ; Enable `org-indent-mode' by default
  199. (visual-line-mode 1)
  200. ))
  201. ;; Company-mode
  202. (use-package company
  203. :ensure t
  204. :init
  205. (add-hook 'after-init-hook 'global-company-mode))
  206. ;; ispell
  207. (dolist (hook '(org-mode-hook latex-mode-hook tex-mode-hook git-commit-mode-hook))
  208. (add-hook hook (lambda () (flyspell-mode 1))))
  209. ;;(setq ispell-dictionary "en")
  210. (setq ispell-program-name "/usr/bin/aspell")
  211. ;; Set default font:
  212. (add-to-list 'default-frame-alist
  213. '(font . "Source Code Pro-14"))
  214. ;; Activation org-agenda and capture
  215. (global-set-key (kbd "C-c l") 'org-store-link)
  216. (global-set-key (kbd "C-c a") 'org-agenda)
  217. (global-set-key (kbd "C-c c") 'org-capture)
  218. ;;++++++++++
  219. ;; sentence one space definition
  220. (setq sentence-end-double-space nil)
  221. ;;---------
  222. ;; Todo states for ORG:
  223. (setq org-todo-keywords
  224. (quote
  225. ((sequence "TODO(t)" "PROGRESS(g)" "PAUSE(p)" "CHECK(k)" "|" "DONE(d)" "CANCELED(c)"))))
  226. (setq org-todo-keyword-faces
  227. '(("PROGRESS" . "orange") ("PAUSE" . "magenta") ("CHECK" . "purple") ("CANCELED" . "red") ("DONE" . "green")))
  228. ;; capture:
  229. (setq org-capture-templates
  230. (quote (
  231. ("a" ; hotkey
  232. "Academia Todo" ; name
  233. entry ; type
  234. (file+headline "/Users/gmarx/beorg/academia.org" "Tasks") ;target
  235. "* TODO [#B] %^{Task}" ; template
  236. )
  237. ("t"
  238. "Task PhD"
  239. entry
  240. (file+datetree "~/beorg/phd.org")
  241. "* TODO [#A] %^{Task}")
  242. ("d"
  243. "Students"
  244. item
  245. (file+datetree "~/beorg/students.org")
  246. "- %U - %^{Activity}")
  247. ("r"
  248. "to Read"
  249. entry
  250. (file+headline "~/beorg/inbox.org" "to read")
  251. "* TODO %^{topic to read}\n%^{Why to read this?}"
  252. )
  253. ("s"
  254. "Schedule an event"
  255. entry
  256. (file+headline "~/beorg/inbox.org" "Scheduled events")
  257. "* %^{Event}\nSCHEDULED: %^t"
  258. )
  259. ("k"
  260. "Task inbox"
  261. entry
  262. (file+headline "~/beorg/inbox.org" "Tasks")
  263. "* TODO %^{Task} -> %^{move to}"
  264. )
  265. ("c"
  266. "Cheat-Sheet"
  267. entry
  268. (file+headline "~/beorg/cheatsheets.org" "Notes")
  269. "* %^{what solves}\n%^{the commands are}"
  270. )
  271. )))
  272. ;;-------end capture
  273. ;;=======
  274. ;;python
  275. (use-package virtualenvwrapper
  276. :ensure t
  277. :config
  278. (setq python-shell-interpreter "python3")
  279. (setq venv-location "~/.virtualenvs"))
  280. ;; pyenv:
  281. (use-package pyvenv
  282. :ensure t
  283. :config
  284. (pyvenv-mode 1))
  285. (custom-set-variables
  286. ;; custom-set-variables was added by Custom.
  287. ;; If you edit it by hand, you could mess it up, so be careful.
  288. ;; Your init file should contain only one such instance.
  289. ;; If there is more than one, they won't work right.
  290. '(custom-safe-themes
  291. (quote
  292. ("71e5acf6053215f553036482f3340a5445aee364fb2e292c70d9175fb0cc8af7" "99ea831ca79a916f1bd789de366b639d09811501e8c092c85b2cb7d697777f93" "bf387180109d222aee6bb089db48ed38403a1e330c9ec69fe1f52460a8936b66" default)))
  293. '(package-selected-packages
  294. (quote
  295. (pyvenv latex-preview-pane org-pomodoro which-key virtualenvwrapper use-package treemacs-projectile pdf-tools org-bullets mu4e-maildirs-extension mu4e-alert magit helm-projectile helm-mu flycheck expand-region doom-themes doom-modeline dashboard company auctex)))
  296. '(pdf-tools-handle-upgrades nil)
  297. '(safe-local-variable-values
  298. (quote
  299. ((LaTeX-includegraphics-read-file . LaTeX-includegraphics-read-file-relative)
  300. (set-fill-column . 5000)
  301. (set-fill-column . 2000)
  302. (TeX-auto-save . t)
  303. (TeX-parse-self . t)
  304. (org-attach-directory . "students/")
  305. (org-attach-use-inheritance . t)
  306. (org-attach-preferred-new-method . ask))))
  307. '(send-mail-function (quote smtpmail-send-it)))
  308. (custom-set-faces
  309. ;; custom-set-faces was added by Custom.
  310. ;; If you edit it by hand, you could mess it up, so be careful.
  311. ;; Your init file should contain only one such instance.
  312. ;; If there is more than one, they won't work right.
  313. '(org-document-title ((t (\,@headline (\,@ variable-tuple) :height 1.5 :underline nil))))
  314. '(org-level-1 ((t (\,@headline (\,@ variable-tuple) :height 1.25))))
  315. '(org-level-2 ((t (\,@headline (\,@ variable-tuple) :height 1.15))))
  316. '(org-level-3 ((t (\,@headline (\,@ variable-tuple) :height 1.12))))
  317. '(org-level-4 ((t (\,@headline (\,@ variable-tuple) :height 1.1))))
  318. '(org-level-5 ((t (\,@headline (\,@ variable-tuple)))))
  319. '(org-level-6 ((t (\,@headline (\,@ variable-tuple)))))
  320. '(org-level-7 ((t (\,@headline (\,@ variable-tuple)))))
  321. '(org-level-8 ((t (\,@headline (\,@ variable-tuple))))))