Konfiguration mit Org-Mode und LSP
This commit is contained in:
188
config.org
188
config.org
@@ -53,16 +53,22 @@
|
||||
[[https://github.com/emacscollective/no-littering][Help keeping ~/.emacs.d clean]]
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package no-littering
|
||||
:config (with-eval-after-load 'recentf
|
||||
(add-to-list 'recentf-exclude no-littering-var-directory)
|
||||
(add-to-list 'recentf-exclude no-littering-etc-directory))
|
||||
:config
|
||||
(with-eval-after-load 'recentf
|
||||
(add-to-list 'recentf-exclude no-littering-var-directory)
|
||||
(add-to-list 'recentf-exclude no-littering-etc-directory))
|
||||
|
||||
(setq auto-save-file-name-transforms ; autosaved-file-name~
|
||||
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t))
|
||||
|
||||
custom-file (no-littering-expand-etc-file-name "custom.el"))
|
||||
|
||||
(if (file-exists-p custom-file)
|
||||
(load-file custom-file)))
|
||||
(load-file custom-file))
|
||||
|
||||
;; no-littering changes default snippets directory, so i changed it back.
|
||||
(add-to-list 'yas-snippet-dirs
|
||||
(expand-file-name "snippets" user-emacs-directory)))
|
||||
#+END_SRC
|
||||
|
||||
* Konfigurationsdatei
|
||||
@@ -278,12 +284,7 @@
|
||||
|
||||
*** Klammern
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(electric-pair-mode)
|
||||
(show-paren-mode 1)
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:hook
|
||||
(prog-mode . rainbow-delimiters-mode))
|
||||
#+END_SRC
|
||||
|
||||
** Fenster
|
||||
@@ -505,8 +506,11 @@
|
||||
Mit Yasnippet lassen sich Templates definieren und mit einer Tastenkombination belegen.
|
||||
Die Templates werden im Ordner /snippets/ jeweils unter einem Mode-spezifischen Ordner gespeichert.
|
||||
|
||||
Das Paket /yasnippet-snippets/ stellt eine Auswahl an Templates zur Verfügung. Mit /helm-c-yasnippet/ lassen sich die Snippets mit Helm durchsuchen und filtern.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq yas-snippet-dirs (append yas-snippet-dirs '("~/.emacs.d/snippets")))
|
||||
#+END_SRC
|
||||
|
||||
Das Paket /yasnippet-snippets/ stellt eine Auswahl an Templates zur Verfügung. Mit /helm-c-yasnippet/ lassen sich die Snippets mit Helm durchsuchen und filtern.
|
||||
| Key | Aktion |
|
||||
|-----------+------------------------|
|
||||
| C-c & C-n | neues Template anlegen |
|
||||
@@ -522,6 +526,7 @@
|
||||
|
||||
(use-package yasnippet-snippets
|
||||
:after yasnippet)
|
||||
(append yas-snippet-dirs '("~/.emacs.d/snippets"))
|
||||
|
||||
(use-package helm-c-yasnippet
|
||||
:bind (("C-c y" . helm-yas-complete)))
|
||||
@@ -555,6 +560,7 @@
|
||||
(setq artr/dir-nextcloud "~/Nextcloud/")
|
||||
(setq artr/dir-org (concat artr/dir-nextcloud "Notes/org/"))
|
||||
(setq artr/dir-notes (concat artr/dir-nextcloud "Notes/org/notes/"))
|
||||
(setq artr/dir-journal (concat artr/dir-org "journal/"))
|
||||
(setq artr/dir-archive (concat artr/dir-org "archives/"))
|
||||
|
||||
(setq artr/dir-gtd (concat artr/dir-org "gtd/"))
|
||||
@@ -1169,3 +1175,165 @@
|
||||
:ensure t
|
||||
:init (setq org-books-file (concat artr/dir-gtd "books.org")))
|
||||
#+END_SRC
|
||||
|
||||
* Programming
|
||||
** Zeilennummerierung
|
||||
Anzeige der Zeilennummern am Rand:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package display-line-numbers
|
||||
:ensure nil
|
||||
:hook (prog-mode . display-line-numbers-mode))
|
||||
#+END_SRC
|
||||
|
||||
** Einzug
|
||||
Die Einzüge werden als Linien dargestellt:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package highlight-indent-guides
|
||||
:diminish
|
||||
:hook (prog-mode . highlight-indent-guides-mode)
|
||||
:init (setq highlight-indent-guides-method 'character
|
||||
highlight-indent-guides-responsive 'top))
|
||||
#+END_SRC
|
||||
|
||||
** Klammern
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'prog-mode-hook 'electric-pair-local-mode)
|
||||
(use-package rainbow-delimiters
|
||||
:hook
|
||||
(prog-mode . rainbow-delimiters-mode))
|
||||
#+END_SRC
|
||||
|
||||
** Elisp
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package highlight-defined
|
||||
:hook (emacs-lisp-mode . highlight-defined-mode))
|
||||
|
||||
(use-package paredit
|
||||
:config
|
||||
(add-hook 'emacs-lisp-mode-hook #'paredit-mode)
|
||||
;; enable in the *scratch* buffer
|
||||
(add-hook 'lisp-interaction-mode-hook #'paredit-mode)
|
||||
(add-hook 'ielm-mode-hook #'paredit-mode)
|
||||
(add-hook 'lisp-mode-hook #'paredit-mode)
|
||||
(add-hook 'eval-expression-minibuffer-setup-hook #'paredit-mode))
|
||||
#+END_SRC
|
||||
** Plantuml
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package plantuml-mode
|
||||
:custom
|
||||
(plantuml-jar-path "/usr/share/plantuml/plantuml.jar")
|
||||
:mode "\\.uml\\'")
|
||||
#+END_SRC
|
||||
|
||||
** Git
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package git-gutter
|
||||
:config
|
||||
(global-git-gutter-mode +1))
|
||||
#+END_SRC
|
||||
|
||||
** Java
|
||||
*** Environment Setup
|
||||
Für einige Betriebssysteme werden die Umgebungsvariablen nicht korrekt geladen. Das Paket exec-path-from-shell initialisiert die Variablen.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package exec-path-from-shell)
|
||||
(exec-path-from-shell-initialize)
|
||||
;; Java-HOME
|
||||
(setenv "JAVA_HOME" "/usr/lib/jvm/java-11-openjdk-amd64")
|
||||
;; Java-Executable
|
||||
(setq lsp-java-java-path "/usr/lib/jvm/java-11-openjdk-amd64/bin/java")
|
||||
#+END_SRC
|
||||
|
||||
** Run Code
|
||||
Das Package quickrun ermöglich es Code auszuführen, wenn eine main-Methode existiert.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package quickrun)
|
||||
#+END_SRC
|
||||
|
||||
** Check Code
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package flycheck
|
||||
:init (global-flycheck-mode))
|
||||
#+END_SRC
|
||||
|
||||
** Debugging
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package dap-mode
|
||||
:ensure t
|
||||
:after (lsp-mode)
|
||||
:functions dap-hydra/nil
|
||||
:config
|
||||
(require 'dap-java)
|
||||
:bind (:map lsp-mode-map
|
||||
("<f5>" . dap-debug)
|
||||
("M-<f5>" . dap-hydra))
|
||||
:hook ((dap-mode . dap-ui-mode)
|
||||
(dap-session-created . (lambda (&_rest) (dap-hydra)))
|
||||
(dap-terminated . (lambda (&_rest) (dap-hydra/nil)))))
|
||||
|
||||
(use-package dap-java
|
||||
:ensure nil
|
||||
:after (lsp-java))
|
||||
#+END_SRC
|
||||
|
||||
** Language Server Protocol (LSP)
|
||||
*** Grundkonfiguration
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package lsp-mode
|
||||
:hook (
|
||||
(lsp-mode . lsp-enable-which-key-integration)
|
||||
(java-mode . #'lsp-deferred)
|
||||
)
|
||||
:init (setq
|
||||
lsp-keymap-prefix "C-c l" ; this is for which-key integration documentation, need to use lsp-mode-map
|
||||
lsp-enable-file-watchers nil
|
||||
read-process-output-max (* 1024 1024) ; 1 mb
|
||||
lsp-completion-provider :capf
|
||||
lsp-idle-delay 0.500
|
||||
)
|
||||
:config
|
||||
(setq lsp-intelephense-multi-root nil) ; don't scan unnecessary projects
|
||||
(with-eval-after-load 'lsp-intelephense
|
||||
(setf (lsp--client-multi-root (gethash 'iph lsp-clients)) nil))
|
||||
;; :global/:workspace/:file
|
||||
(setq lsp-modeline-diagnostics-scope :workspace)
|
||||
(define-key lsp-mode-map (kbd "C-c l") lsp-command-map))
|
||||
#+END_SRC
|
||||
|
||||
*** Erweiterungen
|
||||
**** LSP-UI
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package lsp-ui
|
||||
:ensure t
|
||||
:after (lsp-mode)
|
||||
:bind (:map lsp-ui-mode-map
|
||||
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
|
||||
([remap xref-find-references] . lsp-ui-peek-find-references))
|
||||
:init (setq lsp-ui-doc-delay 1.5
|
||||
lsp-ui-doc-position 'bottom
|
||||
lsp-ui-doc-max-width 100))
|
||||
#+END_SRC
|
||||
|
||||
**** LSP-Helm
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package helm-lsp
|
||||
:ensure t
|
||||
:after (lsp-mode)
|
||||
:commands (helm-lsp-workspace-symbol)
|
||||
:init (define-key lsp-mode-map [remap xref-find-apropos] #'helm-lsp-workspace-symbol))
|
||||
#+END_SRC
|
||||
|
||||
**** LSP-Java
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package lsp-java
|
||||
:config (add-hook 'java-mode-hook 'lsp))
|
||||
#+END_SRC
|
||||
|
||||
** Compilation
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq compilation-scroll-output t)
|
||||
(add-hook 'compilation-filter-hook
|
||||
(lambda () (ansi-color-apply-on-region (point-min) (point-max))))
|
||||
(add-hook 'compilation-mode-hook
|
||||
(lambda () (buffer-face-set :weight 'light :height 100)))
|
||||
#+END_SRC
|
||||
|
||||
Reference in New Issue
Block a user