Skip to content

Latest commit

 

History

History
996 lines (942 loc) · 31 KB

config.org

File metadata and controls

996 lines (942 loc) · 31 KB

My Emacs config

1 Introduction

This documentation is build by Emacs’ orgmode. The init.el looks like this:

(require 'cl)
(require 'org)

(require 'cask); "~/.cask/cask.el")
(cask-initialize)
(require 'pallet)
(pallet-mode t)

(when (file-exists-p "~/.emacs.d/local.conf.el")
  (load "~/.emacs.d/local.conf.el"))

(require 'use-package)
(org-babel-load-file "~/.emacs.d/config.org")

That’s all. The rest is done in the config.org and that’s this document.

1.1 Installation

This configuration uses use-package to install most of the required packages at the startup.

1.2 Other configs

Other intresting configurations build with Orgmode:

2 General

This section contains the configuration for some general parts of Emacs that are not mode-specific.

2.1 general variables

(setq
 custom-file "~/.emacs.d/custom.el"

 ;; fortune file
 fortune-file "~/.emacs.d/fortunes/emacs"

 ;; set orgmode as default mode for the scratch buffer
 initial-major-mode 'org-mode

 ;; and remove the initial scratch message
 initial-scratch-message nil

 make-backup-files nil

 ;; sentences end with one space instead of two
 sentence-end-double-space nil
 )

The following variables provide some general editing setting.

(setq-default
 tab-width 4
 fill-column 80
 indent-tabs-mode nil
 )
(setq
 kill-whole-line t
 )

Shorten the question of “yes or no” to simply “y” or “n”

(fset 'yes-or-no-p 'y-or-n-p)

2.2 GUI

(setq
 ;; frame title
 frame-title-format "%b - Emacs"

 ;; start with a new buffer instead of start screen
 inhibit-startup-screen t
 )

Disable the toolbar and the scrollbars:

(tool-bar-mode -1)
(scroll-bar-mode -1)

And highlight the current line for a better cognition:

(global-hl-line-mode 1)

The default font is the mono variation of the Ubuntu font family.

(set-frame-font "Ubuntu Mono" nil t)

2.2.1 Faces

(set-face-attribute 'font-lock-warning-face nil :foreground "#C15757" :underline nil :weight 'bold)

2.3 Hooks

Customize the behaviour during the startup of Emacs. Finally call the local-startup-hook which can define platform specific things.

(add-hook 'emacs-startup-hook
          (lambda ()
            (load custom-file)

            ;; Orgmode "startpage"
            (org-agenda nil "y")
            (org-agenda-clockreport-mode)
            (delete-other-windows)

            (split-window-horizontally)
            ;(fortune)

            ;; load theme
            (load-theme 'solarized-light)

            (local-startup-hook)

            ;; show startup time
            (message (format "startup time: %s" (emacs-init-time)))
            ) t
          )

3 Global keybindings

I was very confused that the global-map of Emacs isn’t that global as one could think. That means major modes are able to override such “global” keybindings. So to get really global keybindings I use a minor mode that sets the appropriate bindings in all major modes.

First we define a custom keymap:

(defvar global-minor-mode-map (make-keymap) "global-minor-mode keymap.")

And now we add arbitrary key bindings to this map.

(define-key global-minor-mode-map (kbd "<f10>") (lambda () (interactive) (org-capture nil "t")))
(define-key global-minor-mode-map (kbd "C-c a")   'org-agenda)
(define-key global-minor-mode-map (kbd "C-x e")   'eshell)
(define-key global-minor-mode-map (kbd "C-s")   'save-buffer)
(define-key global-minor-mode-map (kbd "M-<down>") 'move-line-down)
(define-key global-minor-mode-map (kbd "M-<up>")   'move-line-up)

The following bindings allow me to navigate windows in Emacs by using directional keys. This is more effective than native C-x o in my opinion.

(define-key global-minor-mode-map (kbd "M-H") 'windmove-left)
(define-key global-minor-mode-map (kbd "M-J") 'windmove-down)
(define-key global-minor-mode-map (kbd "M-K") 'windmove-up)
(define-key global-minor-mode-map (kbd "M-L") 'windmove-right)  

And yeah, if you are an Emacs hardliner, feel free to skip ne next block. Otherwise I declare that for me the hjkl movement is much more effective, ergonomic etc. than the native movement keybindings.

(define-key global-minor-mode-map (kbd "M-h") 'backward-char)
(define-key global-minor-mode-map (kbd "M-j") 'next-line)
(define-key global-minor-mode-map (kbd "M-k") 'previous-line)
(define-key global-minor-mode-map (kbd "M-l") 'forward-char)

The following keybindings provide a common way to increase/decrease the font-size of the current buffer.

(define-key global-minor-mode-map (kbd "C-+") 'text-scale-increase)
(define-key global-minor-mode-map (kbd "<C-mouse-4>") 'text-scale-increase)

(define-key global-minor-mode-map (kbd "C--") 'text-scale-decrease)
(define-key global-minor-mode-map (kbd "<C-mouse-5>") 'text-scale-decrease)

And finally the minor mode is build and loaded:

(define-minor-mode global-minor-mode
  "A minor mode so that my key settings aren't shadowed by other major/minor modes"
  t "" 'global-minor-mode-map)
(global-minor-mode 1)
(define-key global-map (kbd "RET") 'newline-and-indent)

4 Global functions

This function looks for typical keywords like TODO or FIXME in the current buffer and shows them in an occur buffer.

(defun show-todos ()
  (interactive)
  (occur "TODO\\|FIXME\\|HACK")
  ;; (if (not (eq (get-buffer "*Occur*") nil))
  ;;     (switch-to-buffer "*Occur*")
  ;;   )
  )

The following functions define simple commands for moving a line up or down.

(defun move-line-down ()
  (interactive)
  (let ((col (current-column)))
    (save-excursion
      (next-line)
      (transpose-lines 1))
    (next-line)
    (move-to-column col)))

(defun move-line-up ()
  (interactive)
  (let ((col (current-column)))
    (save-excursion
      (next-line)
      (transpose-lines -1))
    (move-to-column col)))

5 Major Modes

5.1 calendar

;; weeks start with monday
(setq calendar-week-start-day 1
      calendar-date-style 'european)

5.2 dired

;(require 'ls-lisp)

(setq
 ;; default output of dired listing
 dired-listing-switches "-lhv"

 ;; copy files to open panes
 dired-dwim-target t

 delete-by-moving-to-trash t

 dired-recursive-deletes 'always

 ;; use lisp implementation of ls
 ls-lisp-use-insert-directory-program nil
 ;ls-lisp-emulation nil
 ;ls-lisp-format-time-list (quote ("%d.%m.%Y %H:%M" "%d.%m.%Y %H:%M"))
 ls-lisp-use-localized-time-format t
 ;ls-lisp-ignore-case t
 ;ls-lisp-verbosity nil
 )

5.2.1 functions

This function runs an ediff session on the marked files in dired.

(defun dired-ediff-marked-files ()
  (interactive)
  (set 'marked-files (dired-get-marked-files))
  (when (= (safe-length marked-files) 2)
    (ediff-files (nth 0 marked-files) (nth 1 marked-files)))
  
  (when (= (safe-length marked-files) 3)
    (ediff3 (buffer-file-name (nth 0 marked-files))
            (buffer-file-name (nth 1 marked-files)) 
            (buffer-file-name (nth 2 marked-files)))))
(defun dired-xdg-open (&optional file-list)
  "Opens the markes files by xdg-open."
  (interactive
   (list (dired-get-marked-files t current-prefix-arg)))
  (apply 'call-process "xdg-open" nil 0 nil file-list))
;(define-key dired-mode-map (kbd "o") 'dired-xdg-open)

5.3 js2-mode

(use-package js2-mode
             :mode ("\\.js$" . js2-mode)
             :config
             (progn
               (setq js2-auto-indent-p t
                     js2-basic-offset 4
                     js2-enter-indents-newline t
                     js2-indent-on-enter-key t))
             )  

5.4 LaTeX

(setq TeX-PDF-mode t
      TeX-debug-bad-boxes t
      reftex-plug-into-AUCTeX t)
;; format paragraphs as one sentence per line
(defadvice LaTeX-fill-region-as-paragraph (around LaTeX-sentence-filling)
  "Start each sentence on a new line."
  (let ((from (ad-get-arg 0))
        (to-marker (set-marker (make-marker) (ad-get-arg 1)))
        tmp-end)
    (while (< from (marker-position to-marker))
      (forward-sentence)
      ;; might have gone beyond to-marker --- use whichever is smaller:
      (ad-set-arg 1 (setq tmp-end (min (point) (marker-position to-marker))))
      ad-do-it
      (ad-set-arg 0 (setq from (point)))
      (unless (or
               (bolp)
               (looking-at "\\s *$"))
        (LaTeX-newline)))
    (set-marker to-marker nil)))
(ad-activate 'LaTeX-fill-region-as-paragraph)
(add-hook 'LaTeX-mode-hook
          (lambda ()
            (reftex-mode 1)
            (outline-minor-mode 1)
            (define-key LaTeX-mode-map (kbd "M-z") 'outline-toggle-children)
            )
          )

5.5 magit

(use-package magit
  :ensure t
  :config
  (progn
    (define-key global-minor-mode-map (kbd "C-x m")   'magit-status)
    )
  )

5.6 orgmode

(setq 
 org-lowest-priority ?D
 org-highest-priority ?A

 org-hide-block-startup t
)
(org-add-link-type "thunderlink" 'org-thunderlink-open)

(defun org-thunderlink-open (path)
  "Opens an email in Thunderbird with ThunderLink."
  (start-process "myname" nil "thunderbird" "-thunderlink" (concat "thunderlink:" path)))

5.6.1 Agenda

(setq org-agenda-cmp-user-defined 'org-compare-todo-state)

(defun org-compare-todo-state (a b)
  (let* ((ma (org-entry-get (get-text-property 1 'org-marker a) "TODO"))
         (mb (org-entry-get (get-text-property 1 'org-marker b) "TODO")))
  
    (cond
     ((and
       (member ma '("TODO" "INWORK"))
       (member mb '("DONE" "FDBCK" "DLGTD" "CANC")))
      1)
     ((and
       (member mb '("TODO" "INWORK"))
       (member ma '("DONE" "FDBCK" "DLGTD" "CANC")))
      -1)
     (t nil))
    )
  )

(setq org-agenda-todo-ignore-scheduled 'all
      org-deadline-warning-days 5

      org-agenda-todo-keyword-format "%-6s"

      org-agenda-custom-commands
      '(("y"
         ((agenda "Overview")
          (alltodo ""  ((org-agenda-overriding-header "TODO list private:          ")))
          (alltodo "" ((org-agenda-overriding-header "TODO list work:             ")))
          (todo "FDBCK" ((org-agenda-overriding-header "Tasks waiting for feedback: "))))
          ((org-agenda-remove-tags t)
           (org-agenda-sorting-strategy '(
                                          ;(agenda user-defined-down timestamp-up)
                                          (todo priority-down)
                                          ));todo-state-down priority-down)))
           ;;  priority-down 
           (org-agenda-prefix-format '(
                                       (agenda . " %i %?-12t% s")
                                       (timeline . "  % s")
                                       (todo . " %i ")
                                       ;;(todo . " %i %?-5(concat \"\"(org-format-outline-path (org-get-outline-path))\"\")")
                                       (tags . " %i %-12:c")
                                       (search . " %i %-12:c")
                                       ))
           )
          )
        )
      )

5.6.2 Babel

(require 'ob-python)
(setq
 org-babel-load-languages (quote ((R . t) (emacs-lisp . t) (python . t) (sparql . t)))
 org-confirm-babel-evaluate nil
 )

5.6.3 Capture

(setq org-capture-templates
      '((
         "t"
         "Create new TODO in Inbox"
         entry
         (file+headline "~/Dokumente/todo.inbox.org" "Inbox")
         "** TODO [#%^{PRIO}] %^{TITLE}
  %^{DESC}"
         :immediate-finish t
         )))

5.6.4 Clocking

(setq
 org-clock-modeline-total 'current
 org-log-into-drawer t
)

5.6.5 Exporting

;(require 'ox-md)
;(require 'ox-beamer)
(setq
 org-src-fontify-natively t
 org-export-creator-info nil
 org-export-time-stamp-file nil
 org-export-with-section-numbers nil
 org-export-with-toc nil
 org-html-postamble nil
 org-export-latex-classes
 (quote
  (("article" "\\documentclass[11pt]{scrartcl}
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage{graphicx}
\\usepackage{longtable}
\\usepackage{listings}
\\usepackage[ngerman]{babel}
\\usepackage{float}
%\\usepackage{wrapfig}
\\usepackage{soul}
\\usepackage{amssymb}
\\usepackage{hyperref}"
    ("\\section{%s}" . "\\section{%s}")
    ("\\subsection{%s}" . "\\subsection{%s}")
    ("\\subsubsection{%s}" . "\\subsubsection{%s}")
    ("\\paragraph{%s}" . "\\paragraph{%s}")
    ("\\subparagraph{%s}" . "\\subparagraph{%s}"))
   ("lni" "\\documentclass[english]{lni}
IfFileExists{latin1.sty}{\\usepackage{latin1}}{\\usepackage{isolatin1}}
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage{graphicx}
\\usepackage{caption}
\\usepackage{url}
\\usepackage{longtable}
\\usepackage{listings}
%\\usepackage[ngerman]{babel}
\\usepackage{float}
%\\usepackage{wrapfig}
\\usepackage{soul}
\\usepackage{amssymb}
\\usepackage{hyperref}"
    ("\\section{%s}" . "\\section{%s}")
    ("\\subsection{%s}" . "\\subsection{%s}")
    ("\\subsubsection{%s}" . "\\subsubsection{%s}")
    ("\\paragraph{%s}" . "\\paragraph{%s}")
    ("\\subparagraph{%s}" . "\\subparagraph{%s}"))
   ("report" "\\documentclass[11pt]{report}
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage{graphicx}
\\usepackage{longtable}
\\usepackage{float}
\\usepackage{wrapfig}
\\usepackage{soul}
\\usepackage{amssymb}
\\usepackage{hyperref}"
    ("\\part{%s}" . "\\part*{%s}")
    ("\\chapter{%s}" . "\\chapter*{%s}")
    ("\\section{%s}" . "\\section*{%s}")
    ("\\subsection{%s}" . "\\subsection*{%s}")
    ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
   ("beamer" "\\documentclass[xcolor=dvipsnames]{beamer}
\\usepackage[utf8]{inputenc}
\\usepackage{graphicx}
\\usepackage{color}
\\setbeamertemplate{navigation symbols}{}
\\usetheme{Ilmenau}
\\usecolortheme[named\=MidnightBlue]{structure}
\\beamersetuncovermixins{\\opaqueness<1>{25}}{\\opaqueness<2->{15}}
\\setbeamertemplate{footline}[frame number]"
    ("\\section{%s}" . "\\section{%s}")
    ("\\begin{frame}\\frametitle{%s}"
     "\\end{frame}"
     "\\begin{frame}\\frametitle{%s}"
     "\\end{frame}")
    ("\\subsection{%s}" . "\\subsection*{%s}"))
   ;; ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
   ))

 org-export-latex-date-format "%d. %B %Y"
 org-beamer-frame-level 2
 org-export-html-title-format "<h1 class=\"title\">%s</h1>"
 org-export-html-table-tag "<table class=\"table table-condensed table-striped table-bordered\" border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">"
 org-export-html-use-infojs (quote when-configured)
 )

5.6.6 Publishing

;(require 'org-publish)
;(require 'ox-html)

(setq org-publish-project-alist
      '(
        ("kendix.org"
         :base-directory "~/Code/websites/kendix.org/org/"
         :publishing-directory "~/Code/websites/kendix.org/content/blog"
         :recursive t
         :publishing-function org-html-publish-to-html
         :headline-levels 4 
         :html-extension "html"
         :body-only t
         )
        ("emacs-config"
         :base-directory "~/.emacs.d/"
         :publishing-directory "~/.emacs.d/doc/"
         :recursive nil
         :publishing-function org-html-publish-to-html
         :headline-levels 3
         :auto-preamble t
         )
        ))

5.7 ttl-mode

(use-package ttl-mode
  :mode ("\\.ttl$" . ttl-mode)
  :init
  (progn (add-hook 'ttl-mode-hook    ; Turn on font lock when in ttl mode
          'turn-on-font-lock)))

5.8 typescript-mode

(use-package typescript-mode
             :mode ("\\.ts$" . typescript-mode))

5.9 web-mode

(use-package web-mode
  :ensure t
  :mode ("\\.\\(html\\|jsx\\|tsx\\)$" . web-mode)
  :init
  (add-hook 'web-mode-hook #'(lambda () (yas-activate-extra-mode 'html-mode)))
  :config
  (progn
    (setq
     web-mode-code-indent-offset 4
     web-mode-css-indent-offset 4
     web-mode-markup-indent-offset 4
     web-mode-enable-auto-closing t
     web-mode-enable-current-element-highlight t
     web-mode-enable-current-column-highlight nil)
    )
  )

6 Minor Modes

6.1 aggressive-indent

(use-package aggressive-indent
  :ensure t)

6.2 auto-dim-other-buffers

(use-package auto-dim-other-buffers
  :ensure t
  :config
  (progn
    (auto-dim-other-buffers-mode 1)
    ))

6.3 avy

(use-package avy
  :ensure t)

6.4 company-mode

Add yasnippet support for all company backends:

(use-package company-mode
  :ensure t
  :hook prog-mode
 ;   :init
    ;;    (progn
;    (push '(company-dabbrev-code :with company-yasnippet) company-backends)
    ;;   (defvar company-mode/enable-yas t
    ;;     "Enable yasnippet for all backends.")
    
    ;;   (defun company-mode/backend-with-yas (backend)
    ;;     (if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend)))
    ;;         backend
    ;;       (append (if (consp backend) backend (list backend))
    ;;               '(:with company-yasnippet))))
    
    ;;                                       ;(setq company-backends (mapcar #'company-mode/backend-with-yas company-backends))
    ;;   )
    ;;    )
    )

6.5 cua-mode

(cua-mode 1)

6.6 delete-selection-mode

This mode enables us to overwrite or delete marked regions by just hitting <DEL> or any other character.

(delete-selection-mode 1)

6.7 dumb-jump

(use-package dumb-jump
  :ensure t
  :config
  (progn
    (setq dumb-jump-selector 'ivy)
    )
  )

6.8 editorconfig

(use-package editorconfig
  :ensure t
  :config
  (editorconfig-mode 1))

6.9 flycheck

(use-package flycheck
  :ensure t
  :config
  (progn
    (global-flycheck-mode 1)
    )
  )

6.10 git-gutter

Git-gutter is a way to display changes of a file since the last commit in a tiny visual way besides the code. Because I don’t like any signs like a plus for added or something like this I removed these signs (maybe in a hackish way) and only show the colored background.

(use-package fringe-helper
  :ensure t
  :init
  (progn

    ;; added
    (fringe-helper-define 'git-gutter-fr:added nil
      "........."
      "........."
      "........."
      "........."
      "........."
      "........."
      "........."
      ".........")
    (set-face-background 'git-gutter-fr:added "#859900")

    ;; modified
    (fringe-helper-define 'git-gutter-fr:modified nil
      "........."
      "........."
      "........."
      "........."
      "........."
      "........."
      "........."
      ".........")
    (set-face-background 'git-gutter-fr:modified "#b58900")

    ;; removed
    (fringe-helper-define 'git-gutter-fr:deleted nil
      "........."
      "........."
      "........."
      "........."
      "........."
      "........."
      "........."
      ".........")
    (set-face-background 'git-gutter-fr:deleted "#dc322f")
    )
  )
(use-package git-gutter-fringe
  :ensure t
  :config
  (progn
    (global-git-gutter-mode t)
    )
  )

6.11 hydra

(use-package hydra
  :ensure t
  :config
  (progn
    (define-key global-minor-mode-map (kbd "M-p")     'hydra-projectile/body)
    (define-key global-minor-mode-map (kbd "M-g")     'hydra-jump/body)
    )
  )
(defhydra hydra-projectile
  (:color blue
          :columns 3)
  "Project commands"
  ("f" counsel-git "Find file")
  ("g" counsel-git-grep "grep")
  ("r" counsel-rg "ripgrep")
  ("a" counsel-ag "ag")
  ("o" projectile-switch-project "Open project")
  ("q" nil "cancel"))
(defhydra hydra-jump
  (:color blue
          :columns 3)
  "Jump commands"
  ("d" dumb-jump-go "Go to definition")
  ("g" goto-line "Go to line number")
  ("l" avy-goto-line "Go to line")
  ("w" avy-goto-word-1 "Go to word")
  ("c" avy-goto-char "Go to char")
  ("s" imenu "Go to symbol")
  ("q" nil "cancel"))

6.12 isearch

(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)

6.13 ispell

(require 'ispell)

(add-to-list 'ispell-local-dictionary-alist
             '("de_DE"
               "[a-zA-Z\304\326\334\311\344\366\374\351\337]"
               "[^a-zA-Z\304\326\334\311\344\366\374\351\337]"
               "[']" t 
               ("-d" "de_DE") 
               nil iso-8859-1))
(setq
 ispell-program-name "hunspell"
 ispell-dictionary "de_DE"
 ispell-personal-dictionary "~/.hunspell_de_DE"
; ispell-extra-args '("-a" "-i" "utf-8")
)

6.14 ivy

(use-package counsel
  :ensure t
  :init
  (progn
    (ivy-mode 1)
    (counsel-mode 1)
    )
  :config
  (progn
    (define-key global-minor-mode-map (kbd "C-f") 'swiper)
    (define-key global-minor-mode-map (kbd "C-x b") 'ivy-switch-buffer)
    (define-key global-minor-mode-map (kbd "M-x") 'counsel-M-x)
    (define-key global-minor-mode-map (kbd "C-x C-f") 'counsel-find-file)
    (define-key global-minor-mode-map (kbd "M-y") 'counsel-yank-pop)
    ))

6.15 keyfreq

(use-package keyfreq
  :ensure t
  :config
  (progn
    (setq keyfreq-file "~/.emacs.d/doc/keyfreq")
    (keyfreq-mode 0)
    (keyfreq-autosave-mode 0)
    )
  )

This function is a hacky copy of the html export function of keyfreq.el to save the data as csv … But it works.

(defun keyfreq-csv (filename)
  "Saves an CSV file with all the global statistics."

  (interactive
   (list (if buffer-file-name
             (read-file-name "Write CSV file: "
                             nil nil nil nil)
           (read-file-name "Write CSV file: " default-directory
                           (expand-file-name
                            (file-name-nondirectory (buffer-name))
                            default-directory)
                           nil nil))
         (not current-prefix-arg)))

  (let ((table (copy-hash-table keyfreq-table))
        (htmltable (lambda (list)
                     (keyfreq-format-list list
                                          (lambda (count perc command)
                                            (insert (format "%s,%d\n" command count))))
                     )))

    ;; Merge with the values in .emacs.keyfreq file
    (keyfreq-table-load table)

    (with-temp-file filename
      (funcall htmltable (keyfreq-list (keyfreq-groups-major-modes table)))
      )
    ))

6.16 linum

(if (> emacs-major-version 25)
    (progn
      (add-hook 'prog-mode-hook (lambda () (display-line-numbers-mode 1))))
  (use-package linum-mode
    :hook prog-mode
    :config
    (progn
      (set-face-background 'linum "#EEE8D5"))
    )
  )

6.17 powerline

(defun powerline-my-theme ()
  (interactive)
  (defface powerline-readonly '((t (:background "#dc322f" :foreground "#300b0a" :inherit mode-line)))
    "Powerline readonly face."
    :group 'powerline)

  (defface powerline-modified '((t (:background "#b58900" :foreground "#5e4700" :inherit mode-line)))
    "Powerline modified face."
    :group 'powerline)

  (defface powerline-saved '((t (:background "#859900" :foreground "#394200" :inherit mode-line)))
    "Powerline saved file face."
    :group 'powerline)

  (setq powerline-default-separator 'slant)

  (setq-default mode-line-format
                '(
                  (:eval
                   (let* ((active (eq (frame-selected-window) (selected-window)))
                          (face1 (if active 'powerline-active1 'powerline-inactive1))
                          (face2 (if active 'powerline-active2 'powerline-inactive2))
                          (face-main (if active
                                         (cond (buffer-read-only 'powerline-readonly)
                                               ((buffer-modified-p) 'powerline-modified)
                                               (t 'powerline-saved))
                                       'mode-line-inactive))
                          (face-flycheck (cond
                                          ((flycheck-has-current-errors-p 'error) 'powerline-readonly)
                                          ((flycheck-has-current-errors-p 'warning) 'powerline-modified)
                                          (t 'powerline-saved)))
                          (separator-left
                           (intern (format "powerline-%s-%s"
                                           powerline-default-separator 'right)))
                          (separator-right
                           (intern (format "powerline-%s-%s"
                                           powerline-default-separator 'left)))
                          (lhs (list
                                (powerline-raw " %b " face-main)
                                (funcall separator-right face-main face1)

                                (powerline-major-mode face1 'l)
                                        ;(powerline-minor-modes face1 'l)
                                (powerline-raw mode-line-process face1 'l)
                                        ;(powerline-narrow face1 'l)
                                (powerline-raw " " face1)
                                (funcall separator-right face1 face2)
                                (when (not (equal (projectile-project-name) "-"))
                                  (powerline-raw (concat " " [#xf07c] " " (projectile-project-name)) face2))
                                (when (not (equal (powerline-vc) nil))
                                  (powerline-raw (concat " " [#xf0e8] (powerline-vc)) face2))
                                (when (not (equal (flycheck-has-current-errors-p) nil))
                                  (powerline-raw (concat " " [#xf040] (flycheck-mode-line-status-text) " ") face2))
                                (powerline-raw global-mode-string face2 'r)
                                ))
                          (rhs (list
                                (funcall separator-left face2 face1)
                                (powerline-raw " L%l," face1 'r)
                                (powerline-raw "C%c " face1 'r)
                                )))
                     (concat
                      (powerline-render lhs)
                      (powerline-fill face2 (powerline-width rhs))
                      (powerline-render rhs)))))))
(use-package powerline
  :ensure t
  :config
  (progn
    (powerline-my-theme)
    )
  )

6.18 projectile

(use-package projectile
  :ensure t
  :config
  (progn
    (projectile-global-mode 1)
    (add-to-list 'projectile-globally-ignored-directories "node_modules")
    (setq
     projectile-completion-system 'ivy
     )
    )
  )

6.19 rainbow-delimiters

(use-package rainbow-delimiters
  :ensure t
  :hook (prog-mode . rainbow-delimiters-mode)
  )

6.20 show-paren-mode

;; load parenmode for highlighting matching parentheses
(show-paren-mode 1)

(setq
 ;; do not delay matching parenthesis
 show-paren-delay 0
)

6.21 uniquify

(require 'uniquify)

(setq
 ;; gleichnamige buffer um ordner ergänzen
 uniquify-buffer-name-style 'forward
 )

6.22 whitespace-mode

(use-package whitespace-mode
  :hook prog-mode
  :init
  (progn
    (setq
     whitespace-line-column 121
     whitespace-style '(face tab-mark trailing lines-tail)
     show-trailing-whitespace t)
    )
  :config
  (progn
    (set-face-attribute 'whitespace-line nil
                        :foreground "red1"
                        :slant 'italic)
    )
  )

6.23 yasnippet

(use-package yasnippet
  :ensure t
  :config
  (progn
    (setq yas-snippet-dirs
          '("~/.emacs.d/snippets"                 ;; personal snippets
            ))
    (yas-global-mode 1)
    )
  )