An Emacs configuration to work with LaTeX, Python, C, C++, Pandoc, Markdown, Slack, and git running natively in different OS like MacOS, ArchLinux, and Ubuntu.
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.

211 lines
7.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. ;;; My basic configuration Gerardo Marx 20/May/2021
  2. ;; MacOS version
  3. ;;--------
  4. ;; Melpa repository:
  5. (require 'package)
  6. (add-to-list 'package-archives
  7. '("melpa" . "https://melpa.org/packages/")t)
  8. (package-initialize)
  9. ;;+++++++++++++
  10. ;;function to check installed packages:
  11. (defun is-installed (pack)
  12. "Check if a package is istalled"
  13. (unless (package-installed-p pack)
  14. (package-refresh-contents)
  15. (package-install pack)))
  16. ;;++++++++++++++++
  17. ;; use-package
  18. (is-installed 'use-package)
  19. (is-installed 'helm)
  20. (require 'helm-config)
  21. (global-set-key (kbd "M-x") 'helm-M-x)
  22. (global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
  23. (global-set-key (kbd "C-x C-f") #'helm-find-files)
  24. (helm-mode 1)
  25. ;;++++++++++++
  26. ;; which-key
  27. (is-installed 'which-key)
  28. (require 'which-key)
  29. (which-key-mode)
  30. ;;+++++++++++++
  31. ;; frame size
  32. (setq initial-frame-alist '((top . 35)(left . 10)
  33. (width . 80)(height . 45)))
  34. ;;+++++++++++
  35. ;; Doom-themes, all-the-icons, mode-line and font
  36. (unless (package-installed-p 'doom-themes)
  37. (package-install 'doom-themes))
  38. (unless (package-installed-p 'all-the-icons)
  39. (package-install 'all-the-icons))
  40. (require 'doom-themes)
  41. ;; Global settings (defaults)
  42. (setq doom-themes-enable-bold t ; if nil, bold is universally disabled
  43. doom-themes-enable-italic t) ; if nil, italics is universally disabled
  44. ;; Load the theme (doom-one, doom-molokai, etc); keep in mind that each
  45. ;; theme may have their own settings.
  46. (load-theme 'doom-one t)
  47. ;; Enable flashing mode-line on errors
  48. (doom-themes-visual-bell-config)
  49. ;; Enable custom neotree theme
  50. (doom-themes-neotree-config) ; all-the-icons fonts must be installed!
  51. ;; Installling doom-modeline:
  52. (unless (package-installed-p 'doom-modeline)
  53. (package-install 'doom-modeline))
  54. (require 'doom-modeline)
  55. (doom-modeline-mode 1)
  56. ;;Intalling all-the-icons font:
  57. (unless (package-installed-p 'all-the-icons)
  58. (package-install 'all-the-icons))
  59. ;; Set default font:
  60. (add-to-list 'default-frame-alist
  61. '(font . "Source Code Pro-18"))
  62. ;;+++++++
  63. ;;auctex:
  64. (is-installed 'auctex)
  65. ;;(is-installed 'pdf-tools);; PDFtools
  66. ;;(pdf-tools-install)
  67. (setenv "PATH" (concat "/Library/TeX/texbin:"
  68. (getenv "PATH")))
  69. (add-to-list 'exec-path "/Library/TeX/texbin")
  70. (setq TeX-auto-save t)
  71. (setq TeX-save-query nil)
  72. (setq LaTeX-includegraphics-read-file 'LaTeX-includegraphics-read-file-relative)
  73. (setq TeX-parse-self t)
  74. (setq-default TeX-master nil)
  75. (add-hook 'LaTeX-mode-hook 'visual-line-mode)
  76. (add-hook 'LaTeX-mode-hook 'flyspell-mode)
  77. (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
  78. (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
  79. (custom-set-variables
  80. '(pdf-tools-handle-upgrades nil)) ; Use brew upgrade pdf-tools instead.
  81. (setq pdf-info-epdfinfo-program "/usr/local/bin/epdfinfo")
  82. (pdf-tools-install)
  83. (setq reftex-plug-into-AUCTeX t)
  84. (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
  85. TeX-source-correlate-start-server t)
  86. ;; Update PDF buffers after successful LaTeX runs
  87. (add-hook 'TeX-after-compilation-finished-functions
  88. #'TeX-revert-document-buffer)
  89. (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode))
  90. (add-hook 'pdf-view-mode-hook
  91. (lambda () (pdf-tools-enable-minor-modes)))
  92. (setq TeX-source-correlate-method 'synctex)
  93. (custom-set-variables '(LaTeX-command "latex -synctex=1"))
  94. (setq reftex-bibliography-commands '("bibliography" "nobibliography" "addbibresource"))
  95. ;;--end----
  96. ;;++++++++
  97. ;; emacs startup config
  98. (setq inhibit-startup-message t) ;;inhibit startup
  99. (global-visual-line-mode t)
  100. (tool-bar-mode -1)
  101. (menu-bar-mode -1)
  102. (global-hl-line-mode +1) ;; highlith current line
  103. (delete-selection-mode +1) ;; deletes selected text and replace it
  104. (scroll-bar-mode -1)
  105. (setq ns-right-alternate-modifier nil) ;; right option macos key enable
  106. (fset 'yes-or-no-p 'y-or-n-p) ;; Ask y/n instead of yes/no
  107. (add-hook 'prog-mode-hook 'display-line-numbers-mode) ;; display line number when programming
  108. (show-paren-mode +1) ;; show matching parentheses
  109. ;;---------
  110. ;;========
  111. ;;Flyspell
  112. (setq ispell-program-name "/usr/local/bin/aspell")
  113. ;(setq ispell-aspell-data-dir "/usr/local/Cellar/ispell/3.4.04/lib/ispell/")
  114. ;(setq ispell-aspell-dict-dir ispell-aspell-data-dir)
  115. (dolist (hook '(text-mode-hook))
  116. (add-hook hook (lambda () (flyspell-mode 1))))
  117. ;; ==========
  118. ;; ORG files:
  119. (is-installed 'org-ref)
  120. (require 'org-ref)
  121. (setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f"))
  122. (setq org-latex-prefer-user-labels t)
  123. ;; ==========
  124. ;; TRMAP
  125. (eval-after-load 'tramp '(setenv "SHELL" "/bin/bash"))
  126. ;;=========
  127. ;;Shell
  128. (setq-default explicit-shell-file-name "/bin/bash")
  129. ;; =========
  130. ;; markdown
  131. (is-installed 'markdown-mode)
  132. (autoload 'markdown-mode "markdown-mode"
  133. "Major mode for editing Markdown files" t)
  134. (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
  135. (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  136. (autoload 'gfm-mode "markdown-mode"
  137. "Major mode for editing GitHub Flavored Markdown files" t)
  138. (add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
  139. ;; ========
  140. ;; docker
  141. (is-installed 'docker-compose-mode)
  142. (require 'docker-compose-mode)
  143. ;;========
  144. ;;Neotree
  145. (is-installed 'neotree)
  146. (require 'neotree)
  147. (global-set-key [f8] 'neotree-toggle)
  148. ;;========
  149. ;; auto-complete
  150. (is-installed 'auto-complete)
  151. (ac-config-default)
  152. ;;=======
  153. ;; Python completion:
  154. (is-installed 'anaconda-mode)
  155. (add-hook 'python-mode-hook 'anaconda-mode)
  156. (add-hook 'python-mode-hook 'anaconda-eldoc-mode)
  157. ;(add-hook 'python-mode-hook 'jedi:setup)
  158. ;(setq jedi:complete-on-dot t) ; optional
  159. ;(setq jedi:environment-root "/usr/local/bin/python3")
  160. ;;=======
  161. ;; Python pyvenv
  162. (is-installed 'pyvenv)
  163. (pyvenv-mode t)
  164. (setenv "WORKON_HOME" "~/.pyvenv/")
  165. ;(setq python-shell-interpreter (concat pyvenv-virtual-env "bin/python3"))
  166. ;(setq python-shell-interpreter "/usr/local/bin/python3")
  167. ;;==========
  168. (custom-set-variables
  169. ;; custom-set-variables was added by Custom.
  170. ;; If you edit it by hand, you could mess it up, so be careful.
  171. ;; Your init file should contain only one such instance.
  172. ;; If there is more than one, they won't work right.
  173. '(custom-safe-themes
  174. '("0fe24de6d37ea5a7724c56f0bb01efcbb3fe999a6e461ec1392f3c3b105cc5ac" "e1ef2d5b8091f4953fe17b4ca3dd143d476c106e221d92ded38614266cea3c8b" "08a27c4cde8fcbb2869d71fdc9fa47ab7e4d31c27d40d59bf05729c4640ce834" "7a994c16aa550678846e82edc8c9d6a7d39cc6564baaaacc305a3fdc0bd8725f" default))
  175. '(org-agenda-files
  176. '("~/ownCloud/org/linux.org" "~/ownCloud/org/phd.org" "~/ownCloud/org/iDesiIng.org" "~/ownCloud/org/index.org"))
  177. '(package-selected-packages
  178. '(anaconda-mode which-key use-package pyvenv pkg-info org-ref neotree markdown-mode jedi helm-projectile doom-themes doom-modeline docker-compose-mode auctex))
  179. '(safe-local-variable-values
  180. '((LaTeX-includegraphics-read-file . LaTeX-includegraphics-read-file-relative)
  181. (org-attach-use-inheritance . t)
  182. (org-attach-id-dir . /Users/gmarx/ownCLoud/org/phd/)
  183. (org-attach-id-dir . /Users/gmarx/ownCloud/org/phd/)
  184. (org-startup-folded . "fold")
  185. (org-startup-folded . fold)
  186. (org-startup-folded . t)
  187. (gnus-group-uncollapsed-levels)
  188. (gnus-group-uncollapsed-levels . t)
  189. (org-todo-keywords
  190. (sequence "Marx" "Luis" "Pascual" "Osvaldo" "DONE"))
  191. (org-todo-keywords
  192. (sequence "Marx" "Luis" "Pascual" "Osvaldo" | "DONE"))
  193. (org-todo-keywords
  194. (type "Marx" "Luis" "Pascual" "Osvaldo" | "DONE"))
  195. (org-todo-keywords quote
  196. ((type "Marx" "Luis" "Pascual" "Osvaldo" | "DONE"))))))
  197. (custom-set-faces
  198. ;; custom-set-faces was added by Custom.
  199. ;; If you edit it by hand, you could mess it up, so be careful.
  200. ;; Your init file should contain only one such instance.
  201. ;; If there is more than one, they won't work right.
  202. )