2020-10-24 06:12:37 +02:00
#+TITLE : Emacs Configuration from [[https://gitlab.com/TuDatTr/][TuDatTr]]
2021-01-12 11:18:49 +01:00
#+SETUPFILE : ~/Templates/Org-Mode/setupfile.org
#+OPTIONS : \n:t
2018-01-10 03:56:51 +01:00
2020-10-24 07:44:46 +02:00
* Preface
Before installing and using emacs, emacs should be run as a daemon.
This decreases the loading times of the editor enormously and enables you to return to your former emacs session at any time.
2020-11-12 18:20:18 +01:00
To do this you first need to make sure ~emace --daemon~ is run during the start up.
To access the daemonized emacs you can either run ~emacsclient -t~ to use it in the terminal or simply ~emacsclient~ if you want to use the GUI version.
2020-10-24 07:44:46 +02:00
2020-10-24 06:12:37 +02:00
* Package installation
** Preperation
2020-10-24 06:18:00 +02:00
Initialize Emacs builtin package system and add the [[https://melpa.org ][melpa ]]-package repository.
2020-10-24 06:12:37 +02:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/ "))
(package-initialize)
(package-refresh-contents)
#+end_src
2020-10-24 06:12:37 +02:00
2020-11-12 18:20:18 +01:00
** Installation
2020-10-24 07:44:46 +02:00
*** [[https://github.com/jwiegley/use-package][use-package]]
2020-11-12 18:20:18 +01:00
=A use-package declaration for simplifying your .emacs=
2020-10-24 06:12:37 +02:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(unless (package-installed-p 'use-package)
2021-01-12 11:18:49 +01:00
(package-install 'use-package))
2018-01-14 12:25:14 +01:00
2020-11-12 18:20:18 +01:00
(require 'use-package)
(setq use-package-always-ensure t)
#+end_src
2018-01-14 12:25:14 +01:00
2020-10-24 07:44:46 +02:00
*** [[https://github.com/myrjola/diminish.el][diminish]]
2020-11-12 18:20:18 +01:00
=Diminished modes are minor modes with no modeline display=
2018-01-19 06:50:57 +01:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(use-package diminish)
#+end_src
2018-05-27 18:52:35 +02:00
2020-10-24 07:44:46 +02:00
*** [[https://github.com/emacscollective/no-littering][no-littering]]
2020-11-12 18:20:18 +01:00
=Help keeping ~/.emacs.d clean=
2018-01-10 06:33:52 +01:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(use-package no-littering)
#+end_src
2018-01-10 06:33:52 +01:00
2020-10-24 07:44:46 +02:00
*** [[https://github.com/emacs-evil/evil][evil]]/[[https://github.com/emacs-evil/evil-collection][evil-collection]]
2020-11-12 18:20:18 +01:00
=The extensible vi layer for Emacs.=
=A set of keybindings for evil-mode=
#+begin_src emacs-lisp
(use-package evil
2021-01-12 11:18:49 +01:00
:init
(setq evil-want-keybinding nil)
:config
(evil-mode 1)
(setq evil-search-module 'evil-search))
2020-11-12 18:20:18 +01:00
(use-package evil-collection
2021-01-12 11:18:49 +01:00
:config
(evil-collection-init))
2020-11-12 18:20:18 +01:00
#+end_src
*** [[https://github.com/abo-abo/swiper][Ivy]]/[[https://github.com/abo-abo/swiper][Counsil]]/[[https://github.com/abo-abo/swiper][Swiper]]
2021-01-12 11:18:49 +01:00
=Ivy - a generic completion frontend for Emacs=
=Swiper - isearch with an overview, and more. Oh, man!=
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(use-package prescient)
(use-package ivy-prescient
2021-01-12 11:18:49 +01:00
:config
(ivy-prescient-mode 1))
2020-11-12 18:20:18 +01:00
(use-package ivy)
(use-package counsel
2021-01-12 11:18:49 +01:00
:diminish counsel-mode
:config
(counsel-mode 1))
2020-11-12 18:20:18 +01:00
(use-package swiper
2021-01-12 11:18:49 +01:00
:bind (("C-s" . 'swiper)))
2020-11-12 18:20:18 +01:00
#+end_src
*** [[https://magit.vc/][Magit]]
=A Git Porcelain inside Emacs.=
#+begin_src emacs-lisp
(use-package magit)
#+end_src
*** [[https://www.gnu.org/software/auctex/][AUCTeX]]
=an extensible package for writing and formatting TeX files.=
#+begin_src emacs-lisp
(use-package auctex
2021-01-12 11:18:49 +01:00
:defer t
:config
(setq TeX-parse-self t)
(setq-default TeX-master nil)
2021-10-20 14:14:29 +02:00
(setq TeX-PDF-mode t)
(add-to-list 'TeX-view-program-list '(("Zathura" "zathura %o")))
(add-to-list 'TeX-view-program-selection '((output-pdf "Zathura")))
)
2020-11-12 18:20:18 +01:00
#+end_src
2018-01-10 06:33:52 +01:00
2020-11-12 18:20:18 +01:00
*** [[https://github.com/yjwen/org-reveal][ox-reveal]]
=Exports Org-mode contents to Reveal.js HTML presentation.=
2018-06-24 13:25:59 +02:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(use-package ox-reveal)
#+end_src
2018-01-10 06:33:52 +01:00
2020-11-12 18:20:18 +01:00
*** [[https://github.com/marsmining/ox-twbs][ox-twbs]]
=Export org-mode docs as HTML compatible with Twitter Bootstrap.=
2018-04-29 23:13:10 +02:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(use-package ox-twbs)
#+end_src
2020-10-24 07:44:46 +02:00
2020-11-12 18:20:18 +01:00
*** [[https://github.com/sabof/org-bullets][org-bullets]]
=utf-8 bullets for org-mode=
2020-10-24 07:44:46 +02:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(use-package org-bullets)
#+end_src
2020-10-24 07:44:46 +02:00
2020-11-12 18:20:18 +01:00
*** [[https://elpa.gnu.org/packages/rainbow-mode.html][rainbow-mode]]
=Colorize color names in buffers=
#+begin_src emacs-lisp
(use-package rainbow-mode)
#+end_src
2020-10-24 06:55:37 +02:00
2020-11-12 18:20:18 +01:00
*** [[https://github.com/Fanael/rainbow-delimiters][rainbow-delimiters]]
=Emacs rainbow delimiters mode=
2020-10-24 06:55:37 +02:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(use-package rainbow-delimiters)
#+end_src
2018-04-05 09:46:48 +02:00
2020-11-12 18:20:18 +01:00
*** [[https://github.com/joaotavora/yasnippet][yasnippet]]
=A template system for Emacs=
#+begin_src emacs-lisp
2020-12-14 04:57:42 +01:00
(use-package yasnippet
2021-01-12 11:18:49 +01:00
:config
(setq yas-snippet-dirs '("~/.emacs.d/snippets/ "))
(yas-global-mode 1))
2020-12-14 04:57:42 +01:00
#+end_src
*** [[https://github.com/company-mode/company-mode][company-mode]]
=Modular in-buffer completion framework for Emacs=
#+begin_src emacs-lisp
(use-package company
2021-01-12 11:18:49 +01:00
:config
(global-company-mode))
2020-11-12 18:20:18 +01:00
#+end_src
2018-04-29 23:13:10 +02:00
2020-12-14 04:57:42 +01:00
*** [[https://github.com/flycheck/flycheck][flycheck]]
=On the fly syntax checking for GNU Emacs=
#+begin_src emacs-lisp
(use-package flycheck
:config
(global-flycheck-mode))
#+end_src
*** [[https://github.com/hniksic/emacs-htmlize][htmlize.el]]
=Convert buffer text and decorations to HTML.=
2021-01-12 11:18:49 +01:00
#+begin_src emacs-lisp
2020-12-14 04:57:42 +01:00
(use-package htmlize)
2021-01-12 11:18:49 +01:00
#+end_src
*** [[https://github.com/k1LoW/emacs-ansible][ansible]]
=Ansible minor mode=
#+BEGIN_SRC emacs-lisp
(use-package ansible
:config
(ansible 1))
#+END_SRC
2020-12-14 04:57:42 +01:00
2021-03-02 12:23:16 +01:00
*** [[https://github.com/flycheck/flycheck-rust][flycheck-rust]]
=Better Rust/Cargo support for Flycheck=
#+BEGIN_SRC emacs-lisp
(use-package flycheck-rust)
#+END_SRC
*** [[https://github.com/rust-lang/rust-mode][rust-mode]]
=Emacs configuration for Rust=
#+BEGIN_SRC emacs-lisp
(use-package rust-mode)
#+END_SRC
*** [[https://github.com/kwrooijen/cargo.el][cargo.el]]
#+BEGIN_SRC emacs-lisp
(use-package cargo)
#+END_SRC
2021-05-29 21:46:59 +02:00
*** [[https://github.com/millejoh/emacs-ipython-notebook][ein]]
#+begin_src emacs-lisp
(use-package ein)
#+end_src
2021-10-20 14:14:29 +02:00
*** [[https://github.com/astahlman/ob-async][ob-async]]
#+begin_src emacs-lisp
(use-package ob-async)
#+end_src
*** [[https://github.com/rolandwalker/simpleclip][simpleclip]]
#+begin_src emacs-lisp
(use-package simpleclip
:config
(simpleclip-mode 1))
#+end_src
2022-01-24 05:01:04 +01:00
*** [[https://github.com/ledger/ledger-mode][ledger-mode]]
#+BEGIN_SRC emacs-lisp
(use-package ledger-mode
:mode ("\\.ledger\\'")
:config
(autoload 'ledger-mode "ledger-mode" "A major mode for Ledger" t)
(add-to-list 'load-path
(expand-file-name "/path/to/ledger/source/lisp/ "))
(add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode))
)
#+END_SRC
*** [[https://github.com/yoshiki/yaml-mode][yaml-mode]]
#+BEGIN_SRC emacs-lisp
(use-package yaml-mode
:config
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
:bind-keymap
("\C-m" . (newline-and-indent))
)
#+END_SRC
2021-10-20 14:14:29 +02:00
2020-10-24 06:12:37 +02:00
* Appearance
2020-10-24 06:18:00 +02:00
This section is for appearance customization. Either via packages or manually.
2018-01-10 06:33:52 +01:00
2021-03-02 12:23:16 +01:00
** [[https://github.com/balajisivaraman/emacs-one-themes][emacs-one-themes]]
=A port of the Vim/Atom One Dark and Light themes to Emacs=
2018-01-22 16:34:03 +01:00
2021-03-02 12:23:16 +01:00
##+begin_src emacs-lisp
# (use-package one-themes
# :init
# (load-theme 'one-dark t))
##+end_src
2018-01-22 16:34:03 +01:00
2021-03-02 12:23:16 +01:00
** Transparent Emacs (Commented out)
#+begin_comment
2020-10-24 06:18:00 +02:00
Makes the default color of the background of emacs the same as the terminals color.
This is kind of a janky solution, but it works.
2018-01-31 04:23:36 +01:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
2021-03-02 12:23:16 +01:00
(add-hook 'window-setup-hook
'(lambda ()
(if not (display-graphic-p)
(set-face-background 'default "unspecified-bg"))))
2020-11-12 18:20:18 +01:00
#+end_src
2021-03-02 12:23:16 +01:00
#+end_comment
2020-10-24 06:12:37 +02:00
** Menubar
2018-01-31 04:23:36 +01:00
2020-10-24 06:18:00 +02:00
Remove the menu-bar at the top of the screen for better immersion.
2018-01-13 15:29:33 +01:00
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(menu-bar-mode -1)
#+end_src
2018-01-13 15:29:33 +01:00
2020-10-24 06:55:37 +02:00
* Emacs Configuration
** Symbolic Links
2020-10-24 07:44:46 +02:00
Follow symlinks without asking for confirmation.
2020-11-12 18:20:18 +01:00
#+begin_src emacs-lisp
(setq vc-follow-symlinks t)
#+end_src
2018-01-19 06:50:57 +01:00
2020-12-14 04:57:42 +01:00
** Tab Behavior (spaces > tabs)
#+BEGIN_SRC emacs-lisp
(setq-default indent-tabs-mode nil)
#+END_SRC
2022-01-24 05:01:04 +01:00
2020-10-24 06:55:37 +02:00
* Mode Configuration
2021-03-02 12:23:16 +01:00
** Org-mode
2022-01-24 05:01:04 +01:00
*** Enable org-bullets and hide leading stars.
2020-11-12 18:20:18 +01:00
2022-01-24 05:01:04 +01:00
#+begin_src emacs-lisp
(add-hook 'org-mode-hook
(lambda ()
(org-bullets-mode 1)
(setq org-pretty-entities t)
(setq org-src-fontify-natively t)))
#+end_src
2021-03-02 12:23:16 +01:00
2022-01-24 05:01:04 +01:00
*** Enable utf8x on latex output
2021-03-02 12:23:16 +01:00
2022-01-24 05:01:04 +01:00
#+begin_src emacs-lisp
(setq org-latex-inputenc-alist '(("utf8" . "utf8x")))
#+end_src
*** minted options for pdfexport
#+begin_src emacs-lisp
(setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
#+end_src
#+begin_src emacs-lisp
(setq org-latex-minted-options '(("breaklines" "true")
("breakanywhere" "true")))
#+end_src
2021-01-12 11:18:49 +01:00
2020-12-14 04:57:42 +01:00
*** Keybindings
2021-01-12 11:18:49 +01:00
#+begin_src emacs-lisp
(define-key org-mode-map (kbd "C-c ,") 'org-insert-structure-template)
#+end_src
Enables specific languages for org-babel, so those languages can be used and compiled in code blocks and disable the compilation confirmation. The code afterwords enables proper indentation inside those source blocks.
#+begin_src emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(C . t)
(makefile . t)
(shell . t)
(latex . t)
(python . t)))
(setq org-confirm-babel-evaluate nil)
(setq org-src-tab-acts-natively t)
#+end_src
2020-11-12 18:20:18 +01:00
2021-03-02 12:23:16 +01:00
** C-mode
2020-12-14 04:57:42 +01:00
#+begin_src emacs-lisp
(add-hook 'c-mode-hook
2021-01-12 11:18:49 +01:00
(lambda ()
(display-line-numbers-mode 1)))
2020-12-14 04:57:42 +01:00
#+end_src
2021-03-02 12:23:16 +01:00
** C++-mode
2020-12-14 04:57:42 +01:00
#+begin_src emacs-lisp
(add-hook 'c++-mode-hook
2021-01-12 11:18:49 +01:00
(lambda ()
(display-line-numbers-mode 1)))
2020-12-14 04:57:42 +01:00
#+end_src
2021-01-12 11:18:49 +01:00
2021-03-02 12:23:16 +01:00
** rust-mode
cargo.el
#+begin_src emacs-lisp
(add-hook 'rust-mode-hook 'cargo-minor-mode)
#+end_src
flycheck-rust
#+begin_src emacs-lisp
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
#+end_src