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.

755 lines
20 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. #+TITLE: Emacs Configuration
  2. #+AUTHOR: Marc Pohling
  3. Needs debian package ess
  4. #+begin_src R :results output graphics :file test.png
  5. library(ggplot2)
  6. df <- data.frame(dose=c("D0.5", "D1", "D2"),
  7. len=c(4.2, 10, 29.5))
  8. # Basic line plot with points
  9. ggplot(data=df, aes(x=dose, y=len, group=1)) +
  10. geom_line()+
  11. geom_point()
  12. # Change the line type
  13. ggplot(data=df, aes(x=dose, y=len, group=1)) +
  14. geom_line(linetype = "dashed")+
  15. geom_point()
  16. # Change the color
  17. ggplot(data=df, aes(x=dose, y=len, group=1)) +
  18. geom_line(color="red")+
  19. geom_point()
  20. #+end_src
  21. #+RESULTS:
  22. [[file:test.png]]
  23. * Personal Information
  24. #+begin_src emacs-lisp
  25. (setq user-full-name "Marc Pohling"
  26. user-mail-address "marc.pohling@googlemail.com")
  27. #+end_src
  28. * Update config in a running config
  29. Two options:
  30. - reload the open file: M-x load-file, then press twice to accept
  31. the default filename, which is the currently opened
  32. - Point at the end of any sexp and press C-x C-e
  33. * Customize settings
  34. Move the customize settings to its own file, instead of saving
  35. customize settings in [[file:init.el][init.el]].
  36. #+begin_src emacs-lisp
  37. (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
  38. (load custom-file)
  39. #+end_src
  40. * Theme
  41. ** Font
  42. #+begin_src emacs-lisp
  43. (set-face-attribute 'default nil :font "Hack-12")
  44. #+end_src
  45. ** Material Theme
  46. The [[https://github.com/cpaulik/emacs-material-theme][Material Theme]] comes in a dark and a light variant. Not too dark
  47. to be strenious though.
  48. #+begin_src emacs-lisp
  49. (use-package material-theme
  50. :if (window-system)
  51. :defer t
  52. :ensure t
  53. ;; :init
  54. ;; (load-theme 'material t)
  55. )
  56. #+end_src
  57. ** Apropospriate Theme
  58. Variants dark and light
  59. #+begin_src emacs-lisp
  60. (use-package apropospriate-theme
  61. :if (window-system)
  62. :defer t
  63. :ensure t
  64. :init
  65. (load-theme 'apropospriate-dark t)
  66. )
  67. #+end_src
  68. * Sane defaults
  69. Sources for this section include [[https://github.com/magnars/.emacs.d/blob/master/settings/sane-defaults.el][Magnars Sveen]] and [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua]]
  70. These functions are useful. Activate them.
  71. #+begin_src emacs-lisp
  72. (put 'downcase-region 'disabled nil)
  73. (put 'upcase-region 'disabled nil)
  74. (put 'narrow-to-region 'disabled nil)
  75. (put 'dired-find-alternate-file 'disabled nil)
  76. #+end_src
  77. Answering just 'y' or 'n' should be enough.
  78. #+begin_src emacs-lisp
  79. (defalias 'yes-or-no-p 'y-or-n-p)
  80. #+end_src
  81. Keep all backup and auto-save files in one directory
  82. #+begin_src emacs-lisp
  83. (setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
  84. (setq auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list/" t)))
  85. #+end_src
  86. UTF-8 please
  87. #+begin_src emacs-lisp
  88. (setq locale-coding-system 'utf-8)
  89. (set-terminal-coding-system 'utf-8)
  90. (set-keyboard-coding-system 'utf-8)
  91. (set-selection-coding-system 'utf-8)
  92. (prefer-coding-system 'utf-8)
  93. #+end_src
  94. Avoid tabs in place of multiple spaces (they look bad in TeX)
  95. and show empty lines
  96. #+begin_src emacs-lisp
  97. (setq-default indent-tabs-mode nil)
  98. (setq-default indicate-empty-lines t)
  99. #+end_src
  100. Turn off blinking cursor
  101. #+begin_src emacs-lisp
  102. (blink-cursor-mode -1)
  103. #+end_src
  104. Don't count two spaces after a period as the end of a sentence.
  105. Just one space is needed
  106. #+begin_src emacs-lisp
  107. (setq sentence-end-double-space nil)
  108. #+end_src
  109. Delete the region when typing, just like as we expect nowadays.
  110. #+begin_src emacs-lisp
  111. (delete-selection-mode t)
  112. #+end_src
  113. Auto-indent when pressing RET, just new-line when C-j
  114. #+begin_src emacs-lisp
  115. (define-key global-map (kbd "RET") 'newline-and-indent)
  116. (define-key global-map (kbd "C-j") 'newline)
  117. #+end_src
  118. Various stuff
  119. #+begin_src emacs-lisp
  120. (show-paren-mode t)
  121. (column-number-mode t)
  122. (global-visual-line-mode)
  123. (diminish 'visual-line-mode)
  124. (setq uniquify-buffer-name-style 'forward)
  125. #+end_src
  126. * List buffers
  127. Ibuffer is the improved version of list-buffers.
  128. Make ibuffer the default buffer lister. [[http://ergoemacs.org/emacs/emacs_buffer_management.html][Source]]
  129. #+begin_src emacs-lisp
  130. (defalias 'list-buffers 'ibuffer)
  131. #+end_src
  132. Also auto refresh dired, but be quiet about it. [[http://whattheemacsd.com/sane-defaults.el-01.html][Source]]
  133. #+begin_src emacs-lisp
  134. (add-hook 'dired-mode-hook 'auto-revert-mode)
  135. (setq global-auto-revert-non-file-buffers t)
  136. (setq auto-revert-verbose nil)
  137. #+end_src
  138. * Org Mode
  139. ** Installation
  140. Although org mode ships with Emacs, the latest version can be installed externally. The configuration here follows the [[http://orgmode.org/elpa.html][Org mode ELPA Installation instructions.]]
  141. Added a hook to complete org functions, company-capf is necessary for this
  142. #+begin_src emacs-lisp
  143. (use-package org
  144. :ensure org-plus-contrib
  145. :init
  146. (add-hook 'org-mode-hook
  147. (lambda ()
  148. (add-to-list 'company-backends 'company-capf)
  149. (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
  150. (company-mode t)))
  151. )
  152. #+end_src
  153. To avoid problems executing source blocks out of the box. [[https://emacs.stackexchange.com/a/28604][Others have the same problem, too]]. The solution is to remove the .elc files form the package directory:
  154. #+begin_src sh:
  155. var ORG_DIR=(let* ((org-v (cadr (split-string (org-version nil t) "@"))) (len (length org-v))) (substring org-v 1 (- len 2)))
  156. rm ${ORG_DIR}/*.elc
  157. #+end_src
  158. *** Org key bindings
  159. Set up some global key bindings that integrate with Org mode features
  160. #+begin_src emacs-lisp
  161. (bind-key "C-c l" 'org-store-link)
  162. (bind-key "C-c c" 'org-capture)
  163. (bind-key "C-c a" 'org-agenda)
  164. #+end_src
  165. Org overwrites RET and C-j, so I need to disable the rebinds
  166. #+begin_src emacs-lisp
  167. (define-key org-mode-map (kbd "RET") nil) ;;org-return
  168. (define-key org-mode-map (kbd "C-j") nil) ;;org-return-indent
  169. #+end_src
  170. *** Org agenda
  171. For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e473368adb1f63e582a6595450fcd0e787c/Sacha.org#org-agenda][see here]].
  172. #+begin_src emacs-lisp
  173. (setq org-agenda-files
  174. (delq nil
  175. (mapcar (lambda (x) (and (file-exists-p x) x))
  176. '("~/Archiv/Dokumente/Agenda"))
  177. )
  178. )
  179. #+end_src
  180. *** Org capture
  181. #+begin_src emacs-lisp
  182. (bind-key "C-c c" 'org-capture)
  183. (setq org-default-notes-file "~/Archiv/Dokumente/Notizen/notes.org")
  184. #+end_src
  185. ** Org Setup
  186. Speed commands are a nice and quick way to perform certain actions while at the beginning of a heading. It's not activated by default.
  187. See the doc for speed keys by checking out the documentation for speed keys in Org mode.
  188. #+begin_src emacs-lisp
  189. (setq org-use-speed-commands t)
  190. (setq org-image-actual-width 550)
  191. (setq org-highlight-latex-and-related '(latex script entities))
  192. #+end_src
  193. ** Org tags
  194. The default value is -77, which is weird for smaller width windows. I'd rather have the tags align horizontally with the header.
  195. 45 is a good column number to do that.
  196. #+begin_src emacs-lisp
  197. (setq org-tags-column 45)
  198. #+end_src
  199. ** Org babel languages
  200. #+begin_src emacs-lisp
  201. (org-babel-do-load-languages
  202. 'org-babel-load-languages
  203. '((python . t)
  204. (C . t)
  205. (calc . t)
  206. (latex . t)
  207. (java . t)
  208. (ruby . t)
  209. (lisp . t)
  210. (R . t)
  211. (scheme . t)
  212. (shell . t)
  213. (sqlite . t)
  214. (js . t)))
  215. (defun my-org-confirm-babel-evaluate (lang body)
  216. "Do not confirm evaluation for these languages."
  217. (not (or (string= lang "C")
  218. (string= lang "java")
  219. (string= lang "python")
  220. (string= lang "R")
  221. (string= lang "emacs-lisp")
  222. (string= lang "sqlite"))))
  223. (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
  224. #+end_src
  225. I want plots!
  226. #+begin_src emacs-lisp
  227. (use-package ess
  228. :ensure t
  229. )
  230. (add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
  231. (add-hook 'org-mode-hook 'org-display-inline-images)
  232. #+end_src
  233. ** Org babel/source blocks
  234. I like to have source blocks properly syntax highlighted and with the editing popup window staying within the same window so all the windows don't jump around. Also, having the top and bottom trailing lines in the block is a waste of space, so we can remove them
  235. I noticed that fontification doesn't work with markdown mode when the block is indented after editing it in the org src buffer - the leading #s for headers don't get fontified properly because they apppear as Org comments. Setting ~org-src-preserve-identation~ makes things consistent as it doesn't pad source blocks with leading spaces
  236. #+begin_src emacs-lisp
  237. (setq org-src-fontify-natively t
  238. org-src-window-setup 'current-window
  239. org-src-strip-leading-and-trailing-blank-lines t
  240. org-src-preserve-indentation t
  241. org-src-tab-acts-natively t)
  242. #+end_src
  243. * which-key
  244. Greatly increases discovery of functions!
  245. Click [[https://github.com/justbur/emacs-which-key][here]] for source and more info.
  246. Info in Emacs: M-x customize-group which-key
  247. #+begin_src emacs-lisp
  248. (use-package which-key
  249. :ensure t
  250. :diminish which-key-mode
  251. :config
  252. (which-key-mode)
  253. (which-key-setup-side-window-right-bottom)
  254. (which-key-setup-minibuffer)
  255. (setq which-key-idle-delay 0.5)
  256. )
  257. #+end_src
  258. * Ido (currently inactive)
  259. better completion
  260. begin_src emacs-lisp
  261. (use-package ido
  262. :init
  263. (setq ido-enable-flex-matching t)
  264. (setq ido-everywhere t)
  265. (ido-mode t)
  266. (use-package ido-vertical-mode
  267. :ensure t
  268. :defer t
  269. :init
  270. (ido-vertical-mode 1)
  271. (setq ido-vertical-define-keys 'C-n-and-C-p-only)
  272. )
  273. )
  274. end_src
  275. * ivy / counsel / swiper
  276. Flx is required for fuzzy-matching
  277. Is it really necessary?
  278. begin_src emacs-lisp
  279. (use-package flx)
  280. end_src
  281. Ivy displays a window with suggestions for hotkeys and M-x
  282. #+begin_src emacs-lisp
  283. (use-package ivy
  284. :ensure t
  285. :diminish
  286. (ivy-mode . "") ;; does not display ivy in the mode line
  287. :init
  288. (ivy-mode 1)
  289. :bind
  290. ("C-c C-r" . ivy-resume)
  291. :config
  292. (setq ivy-use-virtual-buffers t) ;; recent files and bookmarks in ivy-switch-buffer
  293. (setq ivy-height 20) ;; height of ivy window
  294. (setq ivy-count-format "%d/%d") ;; current and total number
  295. (setq ivy-re-builders-alist ;; regex replaces spaces with *
  296. '((t . ivy--regex-plus)))
  297. )
  298. #+end_src
  299. Counsel replaces:
  300. - M-x
  301. - C-x C-f find-file
  302. - C-c h f describe-function
  303. - C-c h v describe-variable
  304. - M-i imenu
  305. The find-file replacement is nicer to navigate
  306. #+begin_src emacs-lisp
  307. (use-package counsel
  308. :ensure t
  309. :bind* ;; load counsel when pressed
  310. (("M-x" . counsel-M-x)
  311. ("C-x C-f" . counsel-find-file)
  312. ("C-c h f" . counsel-describe-function)
  313. ("C-c h v" . counsel-describe-variable)
  314. ("M-i" . counsel-imenu)
  315. )
  316. )
  317. #+end_src
  318. Swiper ivy-enhances isearch
  319. #+begin_src emacs-lisp
  320. (use-package swiper
  321. :ensure t
  322. :bind
  323. (("C-s" . swiper)
  324. ("C-c C-r" . ivy-resume)
  325. )
  326. )
  327. #+end_src
  328. * Recentf
  329. Requires counsel
  330. #+begin_src emacs-lisp
  331. (use-package recentf
  332. :bind ("C-x C-r" . counsel-recentf)
  333. :config
  334. (recentf-mode t)
  335. (setq recentf-max-saved-items 200)
  336. )
  337. #+end_src
  338. * Programming
  339. ** Common things
  340. List of plugins and settings which are shared between the language plugins
  341. Highlight whitespaces, tabs, empty lines.
  342. #+begin_src emacs-lisp
  343. (use-package whitespace
  344. :demand t
  345. :ensure nil
  346. :init
  347. (dolist (hook '(prog-mode-hook
  348. text-mode-hook
  349. conf-mode-hook))
  350. (add-hook hook #'whitespace-mode))
  351. ;; :hook ;;not working in use-package 2.3
  352. ;; ((prog-mode . whitespace-turn-on)
  353. ;; (text-mode . whitespace-turn-on))
  354. :config
  355. (setq-default whitespace-style '(face empty tab trailing))
  356. )
  357. #+end_src
  358. Disable Eldoc, it interferes with flycheck
  359. #+begin_src emacs-lisp
  360. (use-package eldoc
  361. :ensure nil
  362. :config
  363. (global-eldoc-mode -1)
  364. )
  365. #+end_src
  366. Colorize colors as text with their value
  367. #+begin_src emacs-lisp
  368. (use-package rainbow-mode
  369. :ensure t
  370. :init
  371. (add-hook 'prog-mode-hook 'rainbow-mode t)
  372. ;; :hook prog-mode ;; not working in use-package 2.3
  373. :config
  374. (setq-default rainbow-x-colors-major-mode-list '())
  375. )
  376. #+end_src
  377. ** Company Mode
  378. Complete Anything!
  379. Activate company and make it react nearly instantly
  380. #+begin_src emacs-lisp
  381. (use-package company
  382. :ensure t
  383. :config
  384. (setq-default company-minimum-prefix-length 1
  385. company-tooltip-align-annotation t
  386. company-tooltop-flip-when-above t
  387. company-show-numbers t
  388. company-idle-delay 0.1)
  389. )
  390. #+end_src
  391. *** Company backend hooks
  392. Backend configuration for python-mode
  393. Common backends are:
  394. - company-files: files & directory
  395. - company-keywords: keywords
  396. - company-capf: ??
  397. - company-abbrev: ??
  398. - company-dabbrev: dynamic abbreviations
  399. - company-ispell: ??
  400. #+begin_src emacs-lisp
  401. (defun company/python-mode-hook()
  402. (set (make-local-variable 'company-backends)
  403. '((company-jedi company-dabbrev) company-capf company-files))
  404. (company-mode t)
  405. )
  406. #+end_src
  407. Backend configuration for lisp-mode
  408. #+begin_src emacs-lisp
  409. (defun company/elisp-mode-hook()
  410. (set (make-local-variable 'company-backends)
  411. '((company-elisp company-dabbrev) company-capf company-files))
  412. (company-mode t)
  413. )
  414. #+end_src
  415. *** Misc Company packages
  416. Addon to sort suggestions by usage
  417. #+begin_src emacs-lisp
  418. (use-package company-statistics
  419. :ensure t
  420. :after company
  421. :config
  422. (company-statistics-mode 1)
  423. )
  424. #+end_src
  425. Get a popup with documentation of the completion candidate.
  426. For the popups the package pos-tip.el is used and automatically installed.
  427. [[https://github.com/expez/company-quickhelp][Company Quickhelp]]
  428. [[https://www.emacswiki.org/emacs/PosTip][See here for Pos-Tip details]]
  429. #+begin_src emacs-lisp
  430. (use-package company-quickhelp
  431. :ensure t
  432. :after company
  433. :config
  434. (company-quickhelp-mode 1)
  435. )
  436. #+end_src
  437. Maybe add [[https://github.com/hlissner/emacs-company-dict][company-dict]]? It's a dictionary based on major modes, plus it has Yasnippet integration.
  438. ** Projectile
  439. Brings search functions on project level
  440. #+begin_src emacs-lisp
  441. (use-package projectile
  442. :ensure t
  443. :defer t
  444. :bind
  445. (("C-c p p" . projectile-switch-project)
  446. ("C-c p s s" . projectile-ag))
  447. :init
  448. (setq-default
  449. projectile-cache-file (expand-file-name ".projectile-cache" user-emacs-directory)
  450. projectile-known-projects-file (expand-file-name
  451. ".projectile-bookmarks" user-emacs-directory))
  452. :config
  453. (projectile-mode t)
  454. (setq-default
  455. projectile-completion-system 'ivy
  456. projectile-enable-caching t
  457. projectile-mode-line '(:eval (projectile-project-name)))
  458. )
  459. #+end_src
  460. ** Lisp
  461. #+begin_src emacs-lisp
  462. (add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook)
  463. #+end_src
  464. ** Python
  465. Systemwide following packages need to be installed:
  466. - venv
  467. The virtual environments need to have following modules installed:
  468. - jedi
  469. - epc
  470. - pylint
  471. #+begin_src emacs-lisp
  472. (use-package flycheck
  473. :ensure t
  474. :init
  475. (add-hook 'after-init-hook #'global-flycheck-mode)
  476. (add-hook 'python-mode-hook (lambda ()
  477. (semantic-mode 1)
  478. (flycheck-select-checker 'python-pylint)))
  479. )
  480. #+end_src
  481. Automatically start python-mode when opening a .py-file.
  482. Not sure if python.el is better than python-mode.el.
  483. See [[https://github.com/jorgenschaefer/elpy/issues/887][here]] for info about ~python-shell-completion-native-enable~.
  484. The custom function is to run inferiour processes (do I really need that?), see [[https://emacs.stackexchange.com/questions/16361/how-to-automatically-run-inferior-process-when-loading-major-mode][here]].
  485. Also limit the completion backends to those which make sense in Python.
  486. #+begin_src emacs-lisp
  487. (use-package python
  488. :mode ("\\.py\\'" . python-mode)
  489. :interpreter ("python" . python-mode)
  490. :init
  491. (add-hook 'python-mode-hook 'company/python-mode-hook)
  492. :config
  493. (setq python-shell-completion-native-enable nil)
  494. )
  495. #+end_src
  496. Jedi is a backend for python autocompletion and needs to be installed on the server:
  497. - pip install jedi
  498. Code checks need to be installed, too:
  499. - pip install flake8
  500. #+begin_src emacs-lisp
  501. (use-package company-jedi
  502. :defer t
  503. ;; :after company
  504. :ensure t
  505. :config
  506. (setq jedi:environment-virtualenv (list (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
  507. (setq jedi:python-environment-directory (list (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
  508. (add-hook 'python-mode-hook 'jedi:setup)
  509. (setq jedi:complete-on-dot t)
  510. (setq jedi:use-shortcuts t)
  511. ;; (add-hook 'python-mode-hook 'company/python-mode-hook)
  512. )
  513. #+end_src
  514. A wrapper to handle virtual environments.
  515. I strongly recommend to install virtual environments on the terminal, not through this wrapper, but changing venvs is fine.
  516. TODO: automatically start an inferior python process or switch to it if already created
  517. #+begin_src emacs-lisp
  518. (use-package pyvenv
  519. :ensure t
  520. :init
  521. (setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
  522. :config
  523. (pyvenv-mode t)
  524. (defun my/post-activate-hook()
  525. (setq jedi:environment-root pyvenv-virtual-env)
  526. (setq jedi:environment-virtualenv pyvenv-virtual-env)
  527. (setq jedi:tooltip-method '(nil)) ;; variants: nil or pos-tip and/or popup
  528. (setq python-shell-virtualenv-root pyvenv-virtual-env)
  529. ;; default traceback, other option M-x jedi:toggle-log-traceback
  530. ;; traceback is in jedi:pop-to-epc-buffer
  531. (jedi:setup)
  532. (company/python-mode-hook)
  533. (setq jedi:server-args '("--log-traceback")))
  534. ;; (add-to-list 'company-backends 'company-jedi)
  535. ;; (add-to-list 'company-backends 'company-anaconda)
  536. ;; (lambda ()
  537. ;; (set (make-local-variable 'company-backends)
  538. ;; '((company-jedi company-dabbrev) company-capf company-files)))
  539. ;; (setq flycheck-checker 'python-pylint))
  540. ;; (flycheck-select-checker 'python-pylint))
  541. ;; (setq flycheck-checker 'python-flake8)
  542. (add-hook 'pyvenv-post-activate-hooks 'my/post-activate-hook)
  543. )
  544. #+end_src
  545. I want Emacs to automatically start the proper virtual environment.
  546. Required is a .python-version file with, content in the first line being /path/to/virtualenv/
  547. [[https://github.com/marcwebbie/auto-virtualenv][Github source]]
  548. Depends on pyvenv
  549. #+begin_src emacs-lisp
  550. (use-package auto-virtualenv
  551. :ensure t
  552. ;; :after pyvenv
  553. ;; :defer t
  554. :init
  555. (add-hook 'python-mode-hook 'auto-virtualenv-set-virtualenv)
  556. ;; activate on changing buffers
  557. ;; (add-hook 'window-configuration-change-hook 'auto-virtualenv-set-virtualenv)
  558. ;; activate on focus in
  559. ;; (add-hook 'focus-in-hook 'auto-virtualenv-set-virtualenv)
  560. )
  561. #+end_src
  562. Anaconda test
  563. begin_src emacs-lisp
  564. (use-package anaconda-mode
  565. :ensure t
  566. :defer t
  567. :init
  568. (add-hook 'python-mode-hook 'anaconda-mode)
  569. ;; (add-hook 'python-mode-hook 'anaconda-eldoc-mode)
  570. :config
  571. (setq anaconda-eldoc-mode 1)
  572. )
  573. end_src
  574. begin_src emacs-lisp
  575. (use-package company-anaconda
  576. :ensure t
  577. :defer t
  578. :init
  579. (defun my/company-anaconda-hook()
  580. (add-to-list 'company-backends 'company-anaconda))
  581. (add-hook 'python-mode-hook 'my/company-anaconda-hook)
  582. )
  583. end_src
  584. * Hydra
  585. Hydra allows grouping of commands
  586. #+begin_src emacs-lisp
  587. (use-package hydra
  588. :ensure t
  589. :bind
  590. ("C-c f" . hydra-flycheck/body)
  591. :config
  592. (setq-default hydra-default-hint nil)
  593. )
  594. #+end_src
  595. ** Hydra Flycheck
  596. Flycheck is necessary, obviously
  597. #+begin_src emacs-lisp
  598. (defhydra hydra-flycheck (:color blue)
  599. "
  600. ^
  601. ^Flycheck^ ^Errors^ ^Checker^
  602. ^────────^──────────^──────^────────────^───────^───────────
  603. _q_ quit _<_ previous _?_ describe
  604. _m_ manual _>_ next _d_ disable
  605. _v_ verify setup _f_ check _s_ select
  606. ^^ ^^ ^^
  607. "
  608. ("q" nil)
  609. ("<" flycheck-previous-error :color red)
  610. (">" flycheck-next-error :color red)
  611. ("?" flycheck-describe-checker)
  612. ("d" flycheck-disable-checker)
  613. ("f" flycheck-buffer)
  614. ("m" flycheck-manual)
  615. ("s" flycheck-select-checker)
  616. ("v" flycheck-verify-setup)
  617. )
  618. #+end_src
  619. * Quality of Life