My private Doom Emacs configuration
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.
 
 

259 lines
8.6 KiB

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
(setq user-full-name "Christian Kruse"
user-mail-address "christian@kruse.cool")
;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;; - `doom-unicode-font' -- for unicode glyphs
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-font (font-spec :family "Source Code Pro" :size 13 :weight 'regular)
doom-variable-pitch-font (if IS-LINUX
(font-spec :family "Source Sans 3" :size 14)
(font-spec :family "Source Sans Pro" :size 12))
doom-theme 'doom-one
org-directory "~/org/"
display-line-numbers-type t
default-directory "~/"
indent-tabs-mode nil
window-resize-pixelwise t
frame-resize-pixelwise t)
(when (and (fboundp 'menu-bar-mode)
(not IS-MAC))
(menu-bar-mode -1))
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(custom-set-faces!
'(aw-leading-char-face
:foreground "white" :background "red"
:weight bold :height 2.0 :box (:line-width 10 :color "red")))
(add-to-list 'exec-path "~/Code/emacs/elixir-ls/release")
(map!
"<s-up>" #'beginning-of-buffer
"<s-down>" #'end-of-buffer
"s-d" #'mc/mark-next-like-this
"s-D" #'mc/mark-all-like-this
"M-s-d" #'mc/mark-next-like-this
"C-s-d" #'mc/edit-lines
"C-c c C-c" (cmd! (save-excursion (comment-line 1)))
"C-x C-j" #'dired-jump
"s-+" #'er/expand-region
"s-=" #'er/expand-region
"s-u" #'revert-buffer
(:after smartparens
:map smartparens-mode-map
"C-<left>" nil
"C-<right>" nil
"M-<left>" nil
"M-<right>" nil)
;; (:after js2-mode
;; (:map js2-mode-map
;; "M-." nil))
(:when IS-LINUX
;; "H-s-<up>" #'beginning-of-buffer
;; "H-s-<down>" #'end-of-buffer
"s-<left>" #'doom/backward-to-bol-or-indent
"s-<right>" #'doom/forward-to-last-non-comment-or-eol
"s-c" #'kill-ring-save
"s-v" #'yank
"s-z" #'undo-fu-only-undo
"s-Z" #'undo-fu-only-redo))
;; "H-s-u" #'revert-buffer))
(map!
:leader
:prefix "u"
"fi" (lambda ()
(interactive)
(find-file "~/org/inbox.org"))
"fp" (lambda ()
(interactive)
(find-file "~/org/passwords.org.gpg")))
(unbind-key "M--")
(unbind-key "s--")
(after! org
(setq! org-startup-indented nil
org-startup-folded 'content
org-agenda-files (file-expand-wildcards "~/org/*.org")
org-capture-templates '(("t" "todo" entry (file+headline "~/org/inbox.org" "Inbox")
"* TODO %?\n%U\n%a\n")
("n" "note" entry (file+headline "~/org/notes.org" "Notizen")
"* %?\n%U\n")
("w" "blog entry" entry (file+headline "~/org/inbox.org" "Inbox")
"* TODO %? :blog:\n%U\n")
("m" "Meeting" entry (file+headline "~/org/inbox.org" "Inbox")
"* MEETING with %? :MEETING:\n%U")
("c" "Phone call" entry (file+headline "~/org/inbox.org" "Inbox")
"* PHONE %? :PHONE:\n%U")
("P" "password" entry (file "~/org/passwords.gpg")
"* %^{Title}\n %^{URL}p %^{USERNAME}p %^{PASSWORD}p"))))
;; (after! js2-mode
;; (setq js2-basic-offset 2))
(after! css-mode
(setq css-indent-offset 2))
(after! javascript-mode
(setq javascript-indentation 2
js-indent-level 2))
(after! typescript
(setq typescript-indent-level 2))
(after! json-mode
(setq javascript-indentation 2
js-indent-level 2))
(after! web-mode
(setq web-mode-engines-alist '(("django" . "\\.html\\.tera\\'")))
(add-hook! web-mode
(setq web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
web-mode-code-indent-offset 2)))
(add-to-list 'auto-mode-alist (cons (rx ".html.tera" string-end) #'web-mode))
(use-package! uniquify
:config
(setq uniquify-buffer-name-style 'forward))
(after! magit
(push (cons [unpushed status] 'show) magit-section-initial-visibility-alist)
(push (cons [stashes status] 'show) magit-section-initial-visibility-alist))
(after! lsp-mode
(push "[/\\\\]_build\\'" lsp-file-watch-ignored-directories)
(push "[/\\\\]deps\\'" lsp-file-watch-ignored-directories)
(push "[/\\\\]cover\\'" lsp-file-watch-ignored-directories)
(push "[/\\\\]priv\\'" lsp-file-watch-ignored-directories)
(push "[/\\\\]\\.deliver\\'" lsp-file-watch-ignored-directories)
(push "[/\\\\]\\.elixir_ls\\'" lsp-file-watch-ignored-directories)
(push "[/\\\\]\\.build\\'" lsp-file-watch-ignored-directories)
(push "[/\\\\]node_modules\\'" lsp-file-watch-ignored-directories))
(setq-hook! 'typescript-tsx-mode-hook +format-with-lsp nil)
(setq-hook! 'typescript-mode-hook +format-with-lsp nil)
;; (setq-hook! 'js2-mode-hook +format-with-lsp nil)
;; (setq-hook! 'js2-mode-hook +format-with-lsp nil)
(setq-hook! 'json-mode-hook +format-with-lsp nil)
(setq-hook! 'elixir-mode-hook +format-with-lsp t)
(add-hook! elixir-mode
(add-hook 'before-save-hook 'lsp-format-buffer nil t))
(add-hook! rustic-mode
(add-hook 'before-save-hook 'lsp-format-buffer nil t))
(after! rustic
(setq rustic-lsp-server 'rust-analyzer))
(after! company
(setq company-minimum-prefix-length 1
company-idle-delay 0.1))
(after! vertico
(setq vertico-sort-function #'vertico-sort-length-alpha))
(use-package! tsx-mode
:mode (("\\.tsx\\'" . tsx-mode))
:hook (tsx-mode . lsp!)
:hook (tsx-mode . rainbow-delimiters-mode)
:hook (tsx-mode . add-node-modules-path)
:custom (tsx-mode-tsx-auto-tags t)
:init
(after! flycheck
(flycheck-add-mode 'javascript-eslint 'tsx-mode))
(add-hook! 'tsx-mode-hook
(defun ck/tsx-setup ()
(flycheck-select-checker 'javascript-eslint)
(flycheck-add-next-checker 'javascript-eslint 'lsp)
(pushnew! flycheck-disabled-checkers
'javascript-jshint
'tsx-tide
'jsx-tide)))
(set-electric! 'tsx-mode
:chars '(?\} ?\))
:words '("||" "&&")))
(use-package! tree-sitter
:hook (prog-mode . turn-on-tree-sitter-mode)
:hook (tree-sitter-after-on . tree-sitter-hl-mode))
(use-package! tree-sitter-langs :after tree-sitter)
(use-package! prettier
:hook ((tsx-mode . prettier-mode)
(typescript-mode . prettier-mode)
(javascript-mode . prettier-mode)
(json-mode . prettier-mode)
(scss-mode . prettier-mode)
(css-mode . prettier-mode)))
(use-package! goggles
:hook ((prog-mode text-mode) . goggles-mode))
(use-package! dirvish
:custom
(dirvish-attributes '(expanded-state all-the-icons file-size))
(dirvish-bookmarks-alist
'(("h" "~/" "Home")
("d" "~/Downloads/" "Downloads")
("c" "~/Code/" "Code")
("t" "~/.Trash/" "Trash")))
(dirvish-async-listing-threshold 10000)
(dirvish-hide-details nil)
(dirvish-cache-dir (concat doom-cache-dir "dirvish/"))
(dirvish-hide-details nil)
:init
(dirvish-override-dired-mode)
:config
(setq dired-omit-files (concat dired-omit-files "\\|^\\..*$")))
;(dirvish-peek-mode))
(use-package! deadgrep)
(after! highlight-indent-guides
(setq highlight-indent-guides-method 'fill))
;; highlight-indent-guides-auto-odd-face-perc 3
;; highlight-indent-guides-auto-even-face-perc 1.5))