Klimi's new dotfiles with stow.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

324 righe
9.6 KiB

  1. #+STARTUP: overview
  2. #+PROPERTY: header-args :comments yes :results silent
  3. * Font Inconsolata
  4. #+BEGIN_SRC emacs-lisp
  5. (set-default-font "Inconsolata-12")
  6. #+END_SRC
  7. * Define Default packages
  8. #+BEGIN_SRC emacs-lisp
  9. (defvar abedra/packages '(ac-slime
  10. auto-complete
  11. autopair
  12. cider
  13. clojure-mode
  14. elpy
  15. f
  16. feature-mode
  17. flycheck
  18. graphviz-dot-mode
  19. htmlize
  20. magit
  21. markdown-mode
  22. org
  23. paredit
  24. powerline
  25. rvm
  26. smex
  27. solarized-theme
  28. web-mode
  29. writegood-mode
  30. yaml-mode)
  31. "Default packages")
  32. #+END_SRC
  33. * Install Default packages
  34. #+BEGIN_SRC emacs-lisp
  35. (defun abedra/packages-installed-p ()
  36. (cl-loop for pkg in abedra/packages
  37. when (not (package-installed-p pkg)) do (cl-return nil)
  38. finally (cl-return t)))
  39. (unless (abedra/packages-installed-p)
  40. (message "%s" "Refreshing package database...")
  41. (package-refresh-contents)
  42. (dolist (pkg abedra/packages)
  43. (when (not (package-installed-p pkg))
  44. (package-install pkg))))
  45. #+END_SRC
  46. * Backup files
  47. #+BEGIN_SRC emacs-lisp
  48. (setq make-backup-files nil)
  49. #+END_SRC
  50. * Yes and No
  51. #+BEGIN_SRC emacs-lisp
  52. (defalias 'yes-or-no-p 'y-or-n-p)
  53. #+END_SRC
  54. * Misc
  55. #+BEGIN_SRC emacs-lisp
  56. (setq echo-keystrokes 0.1
  57. use-dialog-box nil
  58. visible-bell t)
  59. (show-paren-mode t)
  60. #+END_SRC
  61. * repos
  62. #+BEGIN_SRC emacs-lisp
  63. (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
  64. #+END_SRC
  65. * Reveal.js
  66. #+BEGIN_SRC emacs-lisp :tangle no
  67. (use-package org-reveal
  68. :ensure t
  69. :config
  70. (setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
  71. (setq org-reveal-mathjax t)
  72. )
  73. (use-package htmlize
  74. :ensure t)
  75. #+END_SRC
  76. #+RESULTS:
  77. * Better Shell
  78. #+BEGIN_SRC emacs-lisp :tangle no
  79. (use-package better-shell
  80. :ensure t
  81. :bind (("C-\"" . better-shell-shell)
  82. ("C-:" . better-shell-remote-open)))
  83. #+END_SRC
  84. * c++
  85. #+BEGIN_SRC emacs-lisp
  86. (use-package ggtags
  87. :ensure t
  88. :config
  89. (add-hook 'c-mode-common-hook
  90. (lambda ()
  91. (when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
  92. (ggtags-mode 1))))
  93. )
  94. #+END_SRC
  95. * Orgmode
  96. #+BEGIN_SRC emacs-lisp
  97. (global-set-key "\C-ca" 'org-agenda)
  98. (global-set-key "\C-cc" 'org-capture)
  99. ;;(add-hook 'after-init-hook 'org-agenda-list)
  100. ;;(delete-other-windows)
  101. (add-to-list 'org-modules "org-habit")
  102. (require 'org)
  103. (require 'org-install)
  104. (require 'org-habit)
  105. (add-to-list 'org-modules "org-habit")
  106. (setq org-habit-preceding-days 7
  107. org-habit-following-days 1
  108. org-habit-graph-column 50
  109. org-habit-show-habits-only-for-today t
  110. org-habit-show-all-today t
  111. )
  112. ;; ORG REVEAL
  113. ;(use-package org-reveal
  114. ;:ensure t
  115. ;(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js")
  116. ;; DOCUMENTS MINTED
  117. ;(require 'ox-latex)
  118. ;(add-to-list 'org-latex-packages-alist '("" "minted"))
  119. ;(setq org-latex-listings 'minted)
  120. ;(require 'org-latex)
  121. ;(setq org-export-latex-listings 'minted)
  122. ;(add-to-list 'org-export-latex-packages-alist '("" "minted"))
  123. ;; Minted
  124. ; (require 'ox-latex)
  125. ; (setq org-latex-listings 'minted)
  126. ;(setq org-latex-pdf-process
  127. ; '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
  128. ; "bibtex $(basename %b)"
  129. ; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
  130. ; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
  131. ;; Babel src evaluator
  132. ;(setq debug-on-error t)
  133. ;(org-babel-do-load-languages
  134. ;'org-babel-load-languages
  135. ;'((python . t)))
  136. ;; Custom colors for the keywords
  137. (setq org-todo-keywords
  138. '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
  139. (sequence "WAITING(w@/!)" "INACTIVE(i)" "|" "CANCELLED(c@/!)" "MEETING")
  140. (sequence "LEARN(l)" "REVISE(r)" "|" "PASSED(p!)")))
  141. (setq org-todo-keyword-faces
  142. '(("TODO" :foreground "red" :background "gold" :weight bold)
  143. ("NEXT" :foreground "DodgerBlue" :background "LightCyan" :weight bold)
  144. ("DONE" :foreground "forest green" :background "MediumSpringGreen" :weight bold)
  145. ("WAITING" :foreground "orange" :background "LightGoldenrodYellow" :weight bold)
  146. ("INACTIVE" :foreground "magenta" :background "violet" :weight bold)
  147. ("CANCELLED" :foreground "forest green" :background "LimeGreen" :weight bold)
  148. ("MEETING" :foreground "forest green" :background "PaleGreen" :weight bold)
  149. ("LEARN" :foreground "yellow1" :background "red2" :weight bold)
  150. ("REVISE" :foreground "RosyBrown1" :background "OrangeRed2" :weight bold)
  151. ("PASSED" :foreground "green yellow" :background "forest green" :weight bold)
  152. ))
  153. ;; Auto-update tags whenever the state is changed
  154. (setq org-todo-state-tags-triggers
  155. '(("CANCELLED" ("CANCELLED" . t))
  156. ("WAITING" ("WAITING" . t))
  157. ("INACTIVE" ("WAITING") ("INACTIVE" . t))
  158. (done ("WAITING") ("INACTIVE"))
  159. ("TODO" ("WAITING") ("CANCELLED") ("INACTIVE"))
  160. ("NEXT" ("WAITING") ("CANCELLED") ("INACTIVE"))
  161. ("DONE" ("WAITING") ("CANCELLED") ("INACTIVE"))))
  162. (setq org-agenda-files (list "~/Documents/org/todo.org"
  163. "~/Documents/org/i.org"
  164. "~/Documents/org/habits.org"
  165. "~/Documents/org/links.org"
  166. "~/Documents/org/school.org"
  167. "~/Documents/org/ideas.org"))
  168. (setq org-agenda-start-on-weekday 1)
  169. (setq org-agenda-custom-commands
  170. '(("h" "Daily habits"
  171. ((agenda ""))
  172. ((org-agenda-show-log t)
  173. (org-agenda-ndays 7)
  174. (org-agenda-log-mode-items '(state))
  175. (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp ":DAILY:"))))
  176. ;; other commands here
  177. ))
  178. (setq org-capture-templates
  179. '(("a" "Appointment" entry (file "~/Documents/org/i.org" )
  180. "* %^{Appointment:}%?\n\n%^T\n\n:PROPERTIES:\n\n:END:\n\n")
  181. ("l" "Link" entry (file+headline "~/Documents/org/links.org" "Links")
  182. "* %? %^L %^g \n%T" :prepend t)
  183. ("b" "Blog idea" entry (file+headline "~/Documents/org/i.org" "Blog Topics:")
  184. "* %?\n%T" :prepend t)
  185. ("t" "To Do Item" entry (file+headline "~/Documents/org/todo.org" "To Do")
  186. "* TODO %^{TODO:}\nSCHEDULED: %^t\nPROPERTIES:\n:CREATED: %u\n:END:\n\n" )
  187. ("m" "Meeting" entry (file "~/Documents/org/i.org")
  188. "* MEETING with %? :MEETING:\n%t" :clock-in t :clock-resume t)
  189. ("i" "Idea" entry (file+headline "~/Documents/org/ideas.org" "IDEA")
  190. "* INACTIVE %? :IDEA:\n")
  191. ("n" "Note" entry (file+headline "~/Documents/org/i.org" "Note space")
  192. "* %?\n%u" :prepend t)
  193. ("j" "Journal" entry (file+datetree "~/Documents/org/journal.org")
  194. "* %?\nEntered on %U\n %i\n %a")
  195. ("s" "Screencast" entry (file "~/Documents/org/screencastnotes.org")
  196. "* %?\n%i\n")
  197. ;; School templates
  198. ("T" "Test" entry (file+headline "~/Documents/org/school.org" "Testy")
  199. "* LEARN [#A] %^{Test:}%?\n\tDEADLINE: %^t\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines 1)
  200. )) ;; end
  201. (setq org-log-done 'time)
  202. #+END_SRC
  203. * Themes and modeline
  204. #+BEGIN_SRC emacs-lisp
  205. (use-package moe-theme
  206. :ensure t)
  207. (load-theme 'moe-dark t)
  208. #+END_SRC
  209. * Htmlize
  210. #+BEGIN_SRC emacs-lisp
  211. (use-package htmlize
  212. :ensure t)
  213. #+END_SRC
  214. * yasnippet
  215. #+BEGIN_SRC emacs-lisp
  216. ;(global-set-key "\C-i" 'yas-expand)
  217. (setq yas-trigger-key "TAB")
  218. (setq yas-triggers-in-field t)
  219. ;;; use popup menu for yas-choose-value
  220. ;; trigger using TAB and disable auto-start
  221. ;(custom-set-variables
  222. ; '(ac-trigger-key "TAB")
  223. ; '(ac-auto-start nil)
  224. ; '(ac-use-menu-map t))
  225. ;(define-key ac-menu-map (kbd "<tab>") nil)
  226. ;(define-key ac-menu-map (kbd "<S-tab>") nil)
  227. (use-package validate
  228. :ensure t)
  229. (defmacro validate-setq (&rest svs)
  230. "Like `setq', but throw an error if validation fails.
  231. VALUE is validated against SYMBOL's custom type.
  232. \(fn [SYM VAL] ...)"
  233. (let ((out))
  234. (while svs
  235. (let ((symbol (pop svs))
  236. (value (if (not svs)
  237. (error "`validate-setq' takes an even number of arguments")
  238. (pop svs))))
  239. (push `(if (boundp ',symbol)
  240. (setq ,symbol (validate-value ,value (custom-variable-type ',symbol)))
  241. (user-error "Trying to validate a variable that's not defined yet: `%s'.\nYou need to require the package before validating"
  242. ',symbol))
  243. out)))
  244. `(progn ,@(reverse out))))
  245. (use-package yasnippet
  246. :ensure t
  247. :diminish yas-minor-mode
  248. :init (yas-global-mode t))
  249. ;; Autocomplete
  250. ;; Code-comprehension server
  251. (defun check-expansion ()
  252. (save-excursion
  253. (if (looking-at "\\_>") t
  254. (backward-char 1)
  255. (if (looking-at "\\.") t
  256. (backward-char 1)
  257. (if (looking-at "->") t nil)))))
  258. (defun do-yas-expand ()
  259. (let ((yas/fallback-behavior 'return-nil))
  260. (yas/expand)))
  261. (defun tab-indent-or-complete ()
  262. (interactive)
  263. (if (minibufferp)
  264. (minibuffer-complete)
  265. (if (or (not yas/minor-mode)
  266. (null (do-yas-expand)))
  267. (if (check-expansion)
  268. (company-complete-common)
  269. (indent-for-tab-command)))))
  270. (global-set-key [tab] 'tab-indent-or-complete)
  271. (use-package yasnippet-snippets
  272. :ensure t)
  273. #+END_SRC
  274. * Multiple cursors
  275. #+BEGIN_SRC emacs-lisp
  276. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  277. ;; multiple cursors ;;
  278. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  279. (use-package multiple-cursors
  280. :ensure t)
  281. (global-set-key (kbd "C-c m c") 'mc/edit-lines)
  282. #+END_SRC