marc 4 years ago
parent
commit
0a3e7ae7a0
2 changed files with 347 additions and 336 deletions
  1. 683
      init.org
  2. 0
      user-global/elisp/beancount.el

683
init.org

@ -1,4 +1,4 @@
#+TITLE: Emacs configuration file
#+TITLE: Emacs configuration file
#+AUTHOR: Marc
#+BABEL: :cache yes
#+PROPERTY: header-args :tangle yes
@ -21,14 +21,18 @@
- visual-regexp
- org configuration: paths
- org custom agenda
- org-ql (related to org agendas)
- org configuration: everything else
- beancount configuration from config.org
- CONTINUE TODO from config.org at Programming
- all-the-icons?
* Header
Emacs variables are dynamically scoped. That's unusual for most languages, so disable it here, too
#+begin_src emacs-lisp
;;; init.el --- -*- lexical-binding: t -*-
#+end_src
* First start
:PROPERTIES:
:ID: ec248005-527f-4fa1-bdef-9343f2fa28b0
:END:
When pulling the repository the first time, an initial init.el needs to be setup. After start it will replace itself with the configuration from init.org
#+BEGIN_SRC emacs-lisp :tangle no
@ -84,104 +88,133 @@
#+END_SRC
* Default settings
:PROPERTIES:
:ID: 00b48602-2a95-492e-a90b-c1e3a94c1ecb
:END:
#+BEGIN_SRC emacs-lisp
(defvar me/whoami
(if (string-equal (system-name) "PMTS01")
"work_remote"
(if (string-equal (system-name) "laptop")
"home_laptop"
(if (string-equal (system-name) "PMPCNEU08")
"work_local"
"home_desktop"))))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defvar MY--PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/"))
(defvar MY--PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/"))
(pcase me/whoami
("home"
(progn
(defvar MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/"))
(defvar MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/"))
(defvar MY--PATH_ORG_JOURNAl (expand-file-name "~/Archiv/Organisieren/Journal/"))))
("home_laptop"
(progn
(defvar MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/"))
(defvar MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/"))
(defvar MY--PATH_ORG_JOURNAL (expand-file-name "~/Archiv/Organisieren/Journal/"))))
("work_remote"
(progn
(defvar MY--PATH_ORG_FILES "p:/Eigene Dateien/Notizen/")
(defvar MY--PATH-ORG-JOURNAL "p:/Eigene Dateien/Notizen/Journal/")
(defvar MY--PATH_START "p:/Eigene Dateien/Notizen/"))))
(setq bookmark-default-file (concat MY--PATH_USER_LOCAL "bookmarks"))
(setq recentf-save-file (concat MY--PATH_USER_LOCAL "recentf"))
(setq custom-file (concat MY--PATH_USER_LOCAL "custom.el")) ;; don't spam init.e with saved customization settings
(setq abbrev-file-name (concat MY--PATH_USER_GLOBAL "abbrev_defs"))
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory)))
(setq save-abbrevs 'silently) ;; don't bother me with asking for abbrev saving
(setq-default create-lockfiles nil) ;; disable lock files, can cause trouble in e.g. lsp-mode
(defalias 'yes-or-no-p 'y-or-n-p) ;; answer with y and n
(setq custom-safe-themes t) ;; don't ask me if I want to load a theme
(setq sentence-end-double-space nil) ;; don't coun two spaces after a period as the end of a sentence.
(delete-selection-mode t) ;; delete selected region when typing
(save-place-mode 1) ;; saves position in file when it's closed
(setq save-place-forget-unreadable-files nil) ;; checks if file is readable before saving position
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(if (eq system-type 'windows-nt)
(prefer-coding-system 'utf-8-dos)
(prefer-coding-system 'utf-8))
(blink-cursor-mode -1) ;; turn off blinking cursor
(show-paren-mode t) ;; show other part of brackets
(column-number-mode t)
(setq uniquify-buffer-name-style 'forward)
(setq-default indent-tabs-mode nil) ;; avoid tabs in place of multiple spaces (they look bad in tex)
(setq-default indicate-empty-lines t) ;; show empty lines
(setq scroll-margin 5 ;; smooth scrolling
scroll-conservatively 10000
scroll-preserve-screen-position 1
scroll-step 1)
(global-hl-line-mode t) ;; highlight current line
(menu-bar-mode 0) ;; disable menu bar
(tool-bar-mode 0) ;; disable tool bar
(scroll-bar-mode 0) ;; disable scroll bar
#+BEGIN_SRC emacs-lisp
(defconst *sys/gui*
(display-graphic-p)
"Is emacs running in a gui?")
(defconst *sys/linux*
(string-equal system-type 'gnu/linux)
"Is the system running Linux?")
(defconst *sys/windows*
(string-equal system-type 'windows-nt)
"Is the system running Windows?")
(defconst *home_desktop*
(string-equal (system-name) "marc")
"Is emacs running on my desktop?")
(defconst *home_laptop*
(string-equal (system-name) "laptop")
"Is emacs running on my laptop?")
(defconst *work_local*
(string-equal (system-name) "PMPCNEU08")
"Is emacs running at work on the local system?")
(defconst *work_remote*
(string-equal (system-name) "PMTS01")
"Is emacs running at work on the remote system?")
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defvar MY--PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/"))
(defvar MY--PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/"))
(when *sys/linux*
(defconst MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/"))
(defconst MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/")))
(defconst MY--PATH_ORG_JOURNAl (expand-file-name "~/Archiv/Organisieren/Journal/"))
(when *work_remote*
(defconst MY--PATH_ORG_FILES "p:/Eigene Dateien/Notizen/")
(defconst MY--PATH_ORG_FILES_MOBILE nil) ;; hacky way to prevent "free variable" compiler error
(defconst MY--PATH_ORG_JOURNAL nil) ;; hacky way to prevent "free variable" compiler error
(defconst MY--PATH_START "p:/Eigene Dateien/Notizen/"))
(setq bookmark-default-file (concat MY--PATH_USER_LOCAL "bookmarks"))
(setq recentf-save-file (concat MY--PATH_USER_LOCAL "recentf"))
(setq custom-file (concat MY--PATH_USER_LOCAL "custom.el")) ;; don't spam init.e with saved customization settings
(setq abbrev-file-name (concat MY--PATH_USER_GLOBAL "abbrev_defs"))
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory)))
(setq save-abbrevs 'silently) ;; don't bother me with asking for abbrev saving
(setq-default create-lockfiles nil) ;; disable lock files, can cause trouble in e.g. lsp-mode
(defalias 'yes-or-no-p 'y-or-n-p) ;; answer with y and n
(setq custom-safe-themes t) ;; don't ask me if I want to load a theme
(setq sentence-end-double-space nil) ;; don't coun two spaces after a period as the end of a sentence.
(delete-selection-mode t) ;; delete selected region when typing
(save-place-mode 1) ;; saves position in file when it's closed
(setq save-place-forget-unreadable-files nil) ;; checks if file is readable before saving position
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(if *sys/windows*
(prefer-coding-system 'utf-8-dos)
(prefer-coding-system 'utf-8))
(blink-cursor-mode -1) ;; turn off blinking cursor
(show-paren-mode t) ;; show other part of brackets
(column-number-mode t)
(setq uniquify-buffer-name-style 'forward)
(setq-default indent-tabs-mode nil) ;; avoid tabs in place of multiple spaces (they look bad in tex)
(setq-default indicate-empty-lines t) ;; show empty lines
(setq scroll-margin 5 ;; smooth scrolling
scroll-conservatively 10000
scroll-preserve-screen-position 1
scroll-step 1)
(global-hl-line-mode t) ;; highlight current line
(menu-bar-mode 0) ;; disable menu bar
(tool-bar-mode 0) ;; disable tool bar
(scroll-bar-mode 0) ;; disable scroll bar
#+END_SRC
Some windows specific stuff
#+BEGIN_SRC emacs-lisp
(when (eq system-type 'windows-nt)
(when *sys/windows*
(remove-hook 'find-file-hooks 'vc-refresh-state)
(progn
(setq gc-cons-threshold (* 511 1024 1024)
gc-cons-percentage 0.5
garbage-collection-messages t
w32-pipe-read-delay 0
w32-get-true-file-attributes nil)
(run-with-idle-timer 5 t #'garbage-collect)))
garbage-collection-messages t)
(run-with-idle-timer 5 t #'garbage-collect))
(when (boundp 'w32-pipe-read-delay)
(setq w32-pipe-read-delay 0))
(when (boundp 'w32-get-true-file-attributes)
(setq )w32-get-true-file-attributes nil))
#+END_SRC
* visuals
** Font
:PROPERTIES:
:ID: cdfaaf73-b027-4b86-8d27-ebdce4b85009
:END:
#+BEGIN_SRC emacs-lisp
(if (string-equal system-type "gnu/linux")
(set-face-font 'default "Hack-10"))
(when *sys/linux*
(set-face-font 'default "Hack-10"))
(when *work_remote*
(set-face-font 'default "Lucida Sans Typewriter-11"))
#+END_SRC
** Themes
#+BEGIN_SRC emacs-lisp
(defun my/toggle-theme ()
(interactive)
(when (or *sys/windows* *sys/linux*)
(if (eq (car custom-enabled-themes) 'tango-dark)
(progn (disable-theme 'tango-dark)
(load-theme 'tango))
(progn
(disable-theme 'tango)
(load-theme 'tango-dark)))))
(bind-key "C-c t" 'my/toggle-theme)
#+END_SRC
Windows Theme:
#+BEGIN_SRC emacs-lisp
(when (or *sys/windows* *sys/linux*)
(load-theme 'tango))
#+END_SRC
** line wrappings
:PROPERTIES:
:ID: 60b1f231-ab1e-4c47-ac6d-262dc208a520
:END:
#+BEGIN_SRC emacs-lisp
(global-visual-line-mode)
(diminish 'visual-line-mode)
@ -197,9 +230,6 @@ Some windows specific stuff
; (add-hook 'visual-line-mode-hook 'my/activate-adaptive-wrap-prefix-mode)))
#+END_SRC
** line numbers
:PROPERTIES:
:ID: d3dfb79a-103a-4318-a5af-5a55e12674ce
:END:
#+BEGIN_SRC emacs-lisp
(use-package display-line-numbers
:init
@ -213,9 +243,6 @@ Some windows specific stuff
; (add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode)
#+END_SRC
** misc
:PROPERTIES:
:ID: f0f774d6-db13-4871-9192-d36e78120dde
:END:
#+BEGIN_SRC emacs-lisp
(use-package rainbow-mode
:ensure t
@ -224,9 +251,6 @@ Some windows specific stuff
emacs-lisp-mode) . rainbow-mode))
#+END_SRC
* undo
:PROPERTIES:
:ID: fde526fa-b053-48dd-9ac1-c443d987f4d2
:END:
#+BEGIN_SRC emacs-lisp
(use-package undo-tree
:ensure t
@ -235,9 +259,6 @@ Some windows specific stuff
(global-undo-tree-mode 1))
#+END_SRC
* imenu-list
:PROPERTIES:
:ID: 796d00db-aadb-412b-a291-619b029977f3
:END:
A minor mode to show imenu in a sidebar.
Call imenu-list-smart-toggle.
[[https://github.com/bmag/imenu-list][Source]]
@ -255,9 +276,6 @@ Some windows specific stuff
)
#+END_SRC
* which-key
:PROPERTIES:
:ID: 0a67aeb4-4060-4f4d-a7ff-61c70fe7ec7b
:END:
#+BEGIN_SRC emacs-lisp
(use-package which-key
:ensure t
@ -270,9 +288,6 @@ Some windows specific stuff
#+END_SRC
* Evil
:PROPERTIES:
:ID: a3389b7d-3833-42b7-97e1-413b8c4d9833
:END:
#+BEGIN_SRC emacs-lisp
(use-package evil
@ -282,9 +297,6 @@ Some windows specific stuff
(evil-mode 1))
#+END_SRC
* General (key mapper)
:PROPERTIES:
:ID: 027bdcf8-95c9-4e9b-88ba-6e9d3e5116c0
:END:
#+BEGIN_SRC emacs-lisp
(use-package general
:ensure t)
@ -297,11 +309,106 @@ Some windows specific stuff
"d" '(imenu-list-display-entry :which-key "show")
"q" '(imenu-list-quit-window :which-key "quit"))
#+END_SRC
* ivy / counsel / swiper
#+BEGIN_SRC emacs-lisp
; (require 'ivy)
(use-package ivy
:ensure t
:diminish
(ivy-mode . "")
:init
(ivy-mode 1)
:bind
("C-r" . ivy-resume) ;; overrides isearch-backwards binding
:config
(setq ivy-use-virtual-buffers t ;; recent files and bookmarks in ivy-switch-buffer
ivy-height 20 ;; height of ivy window
ivy-count-format "%d/%d" ;; current and total number
ivy-re-builders-alist ;; regex replaces spaces with *
'((t . ivy--regex-plus))))
(use-package counsel
:ensure t
:bind*
(("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file)
("C-x C-r" . counsel-recentf)
("C-c C-f" . counsel-git)
("C-c h f" . counsel-describe-function)
("C-c h v" . counsel-describe-variable)
("M-i" . counsel-imenu)))
(use-package swiper
:ensure t
:bind
("C-s" . swiper))
(use-package ivy-hydra
:ensure t)
#+END_SRC
* company
#+BEGIN_SRC emacs-lisp
(use-package company
:defer 1
:bind
(:map company-active-map
("RET" . nil)
([return] . nil)
("TAB" . company-complete-selection)
([tab] . company-complete-selection)
("<right>" . company-complete-common))
:hook
(after-init . global-company-mode)
:config
(setq company-idle-delay .2
company-minimum-prefix-length 1
company-require-match nil
company-show-numbers t
company-tooltip-align-annotations t))
(use-package company-statistics
:ensure t
:after company
:init
(setq company-statistics-file (concat MY--PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
:config
(company-statistics-mode 1))
(use-package company-dabbrev
:ensure nil
:after company
:config
(setq-default company-dabbrev-downcase nil))
(use-package company-box
:ensure t
:init
(add-hook 'company-mode-hook 'company-box-mode))
#+END_SRC
** company backends
#+BEGIN_SRC emacs-lisp
(defun company/org-mode-hook()
(set (make-local-variable 'company-backends)
'(company-capf company-files))
(add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
(message "company/org-mode-hook"))
(defun company/elisp-mode-hook()
(set (make-local-variable 'company-backends)
'((company-elisp company-dabbrev) company-capf company-files))
(message "company/elisp-mode-hook"))
(defun company/beancount-mode-hook()
(set (make-local-variable 'company-backends)
'(company-beancount)))
#+END_SRC
* orgmode
** org
:PROPERTIES:
:ID: 3877251e-5ece-4006-baa6-1f1b4846a8f3
:END:
#+BEGIN_SRC emacs-lisp
(use-package org
:ensure org-plus-contrib
@ -315,9 +422,13 @@ Some windows specific stuff
org-tempo ;; easy templates
)))
(setq org-default-notes-file (concat MY--PATH_ORG_FILES "notes.org")
org-agenda-files (list MY--PATH_ORG_FILES
MY--PATH_ORG_FILES_MOBILE)
org-id-locations-file (concat MY--PATH_USER_LOCAL ".org-id-locations")
org-agenda-files (list (concat MY--PATH_ORG_FILES "notes.org")
(concat MY--PATH_ORG_FILES "projects.org")
(concat MY--PATH_ORG_FILES "todo.org")))
(when *sys/linux*
(setq org-agenda-files (list org-agenda-files
MY--PATH_ORG_FILES_MOBILE)))
(setq org-id-locations-file (concat MY--PATH_USER_LOCAL ".org-id-locations")
org-log-into-drawer "LOGBOOK")
;; some display customizations
@ -332,39 +443,25 @@ Some windows specific stuff
org-src-tab-acts-natively t))
#+END_SRC
** languages
:PROPERTIES:
:ID: 467efd58-e928-4ccf-9ac4-d144eaede8ed
:END:
#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(gnuplot . t)
(js . t)
(latex . t)
(lisp . t)
(python . t)
(shell . t)
(sqlite . t)
(org . t)
(R . t)
(scheme . t)
))
(defun me--org-confirm-babel-evaluate (lang body)
"Do not confirm evaluation for these languages."
(not (or (string= lang "python")
(string= lang "ipython")
(string= lang "emacs-lisp")
(string= lang "R")
(string= lang "latex")
(string= lang "sqlite"))))
(setq org-confirm-babel-evaluate 'me--org-confirm-babel-evaluate)
Set some languages and disable confirmation for evaluating code blocks C-c C-c
#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(gnuplot . t)
(js . t)
(latex . t)
(lisp . t)
(python . t)
(shell . t)
(sqlite . t)
(org . t)
(R . t)
(scheme . t)))
(setq org-confirm-babel-evaluate nil)
#+END_SRC
** habits
:PROPERTIES:
:ID: 61735b0c-5016-4697-80c6-beb7b3f27a1b
:END:
#+BEGIN_SRC emacs-lisp
(require 'org-habit) ;;TODO Lösung ohne require finden, scheint mir nicht ideal zu sein, nur um ein org-modul zu aktivieren
;; (add-to-list 'org-modules "org-habit")
@ -374,24 +471,18 @@ Some windows specific stuff
org-habit-show-habits-only-for-today nil)
#+END_SRC
** org-id
:PROPERTIES:
:ID: 017ef411-8239-4bfe-bbef-66b98a2971a9
:END:
Currently it causes some debugger errors "not a standard org time string", so it's disabled
#+BEGIN_SRC emacs-lisp
(use-package org-id
:config
(setq org-id-link-to-org-use-id t)
(org-id-update-id-locations)) ;; update id file .org-id-locations on startup
;; (use-package org-id
;; :config
;; (setq org-id-link-to-org-use-id t)
;; (org-id-update-id-locations)) ;; update id file .org-id-locations on startup
#+END_SRC
** org-agenda
:PROPERTIES:
:ID: 10e65f59-ba2c-47e4-a40c-3097c15544aa
:END:
Custom keywords, depending on environment
#+BEGIN_SRC emacs-lisp
(pcase me/whoami
("work_remote")
(when *work_remote*
(setq org-todo-keywords
'((sequence "OPEN" "TODO" "UNCLEAR" "|" "DONE" "IMPOSSIBLE"))))
#+END_SRC
@ -445,9 +536,6 @@ Customize the org agenda
org-super-agenda
** org-caldav
:PROPERTIES:
:ID: 58aa11ef-80f7-4629-a957-a9e00e070136
:END:
Vorerst deaktiviert, Nutzen evtl. nicht vorhanden
#+BEGIN_SRC emacs-lisp
;;(use-package org-caldav
@ -459,134 +547,20 @@ Vorerst deaktiviert, Nutzen evtl. nicht vorhanden
;; org-caldav-files (concat MY--PATH_ORG_FILES "tasks")))
#+END_SRC
** journal
:PROPERTIES:
:ID: 0b7243ac-049f-4b9c-a062-7a349c515133
:END:
[[https://github.com/bastibe/org-journal][Source]]
#+BEGIN_SRC emacs-lisp
(use-package org-journal
:ensure t
:defer t
:custom
(org-journal-dir MY--PATH_ORG_JOURNAl)
(org-journal-enable-agenda-integration t))
#+END_SRC
* ivy / counsel / swiper
:PROPERTIES:
:ID: c2146a70-03f4-4f60-9bce-094eec28cefe
:END:
#+BEGIN_SRC emacs-lisp
; (require 'ivy)
(use-package ivy
:ensure t
:diminish
(ivy-mode . "")
:init
(ivy-mode 1)
:bind
("C-r" . ivy-resume) ;; overrides isearch-backwards binding
:config
(setq ivy-use-virtual-buffers t ;; recent files and bookmarks in ivy-switch-buffer
ivy-height 20 ;; height of ivy window
ivy-count-format "%d/%d" ;; current and total number
ivy-re-builders-alist ;; regex replaces spaces with *
'((t . ivy--regex-plus))))
(use-package counsel
:ensure t
:bind*
(("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file)
("C-x C-r" . counsel-recentf)
("C-c C-f" . counsel-git)
("C-c h f" . counsel-describe-function)
("C-c h v" . counsel-describe-variable)
("M-i" . counsel-imenu)))
(use-package swiper
:ensure t
:bind
("C-s" . swiper))
(use-package ivy-hydra
:ensure t)
#+END_SRC
* company
:PROPERTIES:
:ID: 1630ac5e-7467-458c-940c-4f724e283813
:END:
#+BEGIN_SRC emacs-lisp
; (require 'company)
(use-package company
:defer 1
:bind
(:map company-active-map
("RET" . nil)
([return] . nil)
("TAB" . company-complete-selection)
([tab] . company-complete-selection)
("<right>" . company-complete-common))
:config
(global-company-mode 1)
(setq-default
company-idle-delay .2
company-minimum-prefix-length 1
company-require-match nil
company-show-numbers t
company-tooltip-align-annotations t))
; (require 'company-statistics)
(use-package company-statistics
:ensure t
:after company
:init
(setq company-statistics-file (concat MY--PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
:config
(company-statistics-mode 1))
(use-package company-dabbrev
:ensure nil
:after company
:config
(setq-default company-dabbrev-downcase nil))
(use-package company-box
:ensure t
:init
(add-hook 'company-mode-hook 'company-box-mode))
#+END_SRC
** company backends
:PROPERTIES:
:ID: 6ac59f9d-54e3-422d-883f-128fb172468d
:END:
#+BEGIN_SRC emacs-lisp
(defun company/org-mode-hook()
(set (make-local-variable 'company-backends)
'(company-capf company-files))
(add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
(message "company/org-mode-hook"))
(defun company/elisp-mode-hook()
(set (make-local-variable 'company-backends)
'((company-elisp company-dabbrev) company-capf company-files))
(message "company/elisp-mode-hook"))
(defun company/beancount-mode-hook()
(set (make-local-variable 'company-backends)
'(company-beancount)))
(use-package org-journal
:if *sys/linux*
:ensure t
:defer t
:config
(setq org-journal-dir MY--PATH_ORG_JOURNAl
org-journal-enable-agenda-integration t))
#+END_SRC
* Programming
** Magit / Git
:PROPERTIES:
:ID: a947f806-181d-4d33-9734-435849385b0b
:END:
Little crash course in magit:
- magit-init to init a git project
- magit-status (C-x g) to call the status window
@ -615,9 +589,6 @@ In status buffer:
#+END_SRC
** LSP
:PROPERTIES:
:ID: d529d096-ec38-42e6-91c9-099c1d8bdd06
:END:
Configuration for the language server protocol
*ACHTUNG* Dateipfad muss absolut sein, symlink im Pfad führt zumindest beim ersten Start zu Fehlern beim lsp
Sobald der lsp einmal lief, kann zukünftig der symlink-Pfad genommen werden.
@ -653,7 +624,7 @@ TODO Unterverzeichnisse wurden noch nicht getestet
lsp-ui-sideline-enable nil
lsp-ui-sideline-ignore-duplicate t
lsp-ui-sideline-show-code-actions nil)
(when (display-graphic-p)
(when *sys/gui*
(setq lsp-ui-doc-use-webkit t))
;; workaround hide mode-line of lsp-ui-imenu buffer
(defadvice lsp-ui-imenu (after hide-lsp-ui-imenu-mode-line activate)
@ -670,10 +641,34 @@ TODO Unterverzeichnisse wurden noch nicht getestet
company-lsp-cache-candidates nil))
#+END_SRC
** yasnippet
For useful snippet either install yasnippet-snippets or get them from here
[[https://github.com/AndreaCrotti/yasnippet-snippets][Github]]
#+begin_src emacs-lisp
(use-package yasnippet
:ensure t
:diminish yas-minor-mode
:config
(setq yas-snippet-dirs (list (concat MY--PATH_USER_GLOBAL "snippets")))
(yas-global-mode t)
(yas-reload-all)
(unbind-key "TAB" yas-minor-mode-map)
(unbind-key "<tab>" yas-minor-mode-map))
#+end_src
** hippie expand
With hippie expand I am able to use yasnippet and emmet at the same time with the same key.
#+begin_src emacs-lisp
(use-package hippie-exp
:defer t
:bind
("C-<return>" . hippie-expand)
:config
(setq hippie-expand-try-functions-list
'(yas-hippie-try-expand emmet-expand-line)))
#+end_src
** flycheck
:PROPERTIES:
:ID: c8090ddb-4f22-49ba-8ab1-1de132e1d772
:END:
#+BEGIN_SRC emacs-lisp
(use-package flycheck
:ensure t
@ -692,9 +687,6 @@ TODO Unterverzeichnisse wurden noch nicht getestet
#+END_SRC
** Projectile
:PROPERTIES:
:ID: 3cc5c1d2-1a5d-4d1a-bfeb-48de8172dd63
:END:
Manage projects and jump quickly between its files
#+BEGIN_SRC emacs-lisp
(use-package projectile
@ -715,29 +707,32 @@ Manage projects and jump quickly between its files
#+END_SRC
** smartparens
:PROPERTIES:
:ID: 04be375f-d100-47e7-99f1-af47a3139a54
:END:
#+BEGIN_SRC emacs-lisp
(use-package smartparens
:ensure t
:diminish smartparens-mode
:bind
(:map smartparens-mode-map
("C-M-f" . sp-forward-sexp)
("C-M-b" . sp-backward-sexp)
("C-M-a" . sp-backward-down-sexp)
("C-M-e" . sp-up-sexp)
("C-M-w" . sp-copy-sexp)
("M-k" . sp-kill-sexp)
("C-M-<backspace>" . sp-slice-sexp-killing-backward)
("C-S-<backspace>" . sp-slice-sexp-killing-around)
("C-]" . sp-select-next-thing-exchange))
:config
(setq sp-show-pair-from-inside nil)
(setq sp-show-pair-from-inside nil
sp-escape-quotes-after-insert nil)
(require 'smartparens-config))
#+END_SRC
** lisp
:PROPERTIES:
:ID: e5ce0263-3b21-460e-a037-3fe27d6e836a
:END:
#+BEGIN_SRC emacs-lisp
(add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook)
#+END_SRC
** web
:PROPERTIES:
:ID: 5649b885-839f-48db-8b4f-8d594df7ebd8
:END:
apt install npm
sudo npm install -g vscode-html-languageserver-bin
@ -758,10 +753,28 @@ Manage projects and jump quickly between its files
(add-hook 'web-mode-hook 'smartparens-mode))
#+END_SRC
Emmet offers snippets, similar to yasnippet.
Default completion is C-j
[[https://github.com/smihica/emmet-mode#usage][Github]]
#+begin_src emacs-lisp
(use-package emmet-mode
:ensure t
:defer t
:hook
((web-mode . emmet-mode)
(css-mode . emmet-mode))
:config
(unbind-key "C-<return>" emmet-mode-keymap))
#+end_src
** YAML
#+begin_src emacs-lisp
(use-package yaml-mode
:if *sys/linux*
:ensure t
:mode ("\\.yml$" . yaml-mode))
#+end_src
** Python
:PROPERTIES:
:ID: cd4bbd1f-9980-42c9-a5af-aa808779d524
:END:
Systemseitig muss python-language-server installiert sein:
pip3 install 'python-language-server[all]'
@ -769,33 +782,31 @@ Manage projects and jump quickly between its files
https://github.com/emacs-lsp/lsp-mode#install-language-server
#+BEGIN_SRC emacs-lisp
(if (string-equal system-type "gnu/linux")
(use-package pyvenv
:ensure t
:config
(setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
(add-hook 'pyvenv-post-activate-hooks #'my/postactivatehook))
(defun my/postactivatehook ()
(setq lsp-python-ms-extra-paths pyvenv-virtual-env))
(use-package virtualenvwrapper
:ensure t
:hook (venv-postmkvirtualenv . (lambda() (shell-command "pip3 install importmagic epc")))
:config
(setq venv-location (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
(use-package lsp-python-ms
:ensure t
:after lsp-mode python))
(if *sys/linux*
(defun my/postactivatehook ()
(setq lsp-python-ms-extra-paths pyvenv-virtual-env))
(use-package pyvenv
:ensure t
:config
(setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
(add-hook 'pyvenv-post-activate-hooks 'my/postactivatehook))
(use-package virtualenvwrapper
:ensure t
:hook (venv-postmkvirtualenv . (lambda() (shell-command "pip3 install importmagic epc")))
:config
(setq venv-location (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
(use-package lsp-python-ms
:ensure t
:after lsp-mode python))
; :custom (lsp-python-executable-cmd "python3"))
#+END_SRC
* beancount
** Installation
:PROPERTIES:
:ID: 0c5f3396-4b08-4549-ac68-0c516cfd4435
:END:
#+BEGIN_SRC shell
sudo su
cd /opt
@ -809,21 +820,21 @@ deactivate
#+END_SRC
#+BEGIN_SRC emacs-lisp
(if (string-equal system-type "gnu/linux")
(use-package beancount
:load-path "user-local/elisp"
; :ensure t
:defer t
:mode
("\\.beancount$" . beancount-mode)
:init
(add-hook 'beancount-mode-hook 'company/beancount-mode-hook)
(use-package beancount
:if *sys/linux*
:load-path "user-global/elisp"
; :ensure t
:defer t
:mode
("\\.beancount$" . beancount-mode)
:init
(add-hook 'beancount-mode-hook 'company/beancount-mode-hook)
; (add-hook 'beancount-mode-hook (pyvenv-activate "/opt/beancount"))
; (setenv "PATH"
; (concat "/opt/beancount/bin:"
; (getenv "PATH")))
:config
(setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount")))
:config
(setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount"))
#+END_SRC
To support org-babel, check if it can find the symlink to ob-beancount.el

user-local/elisp/beancount.el → user-global/elisp/beancount.el

Loading…
Cancel
Save