MyEmacsConfig/init.el
2026-02-03 15:23:18 +02:00

225 lines
6.4 KiB
EmacsLisp

(setq inhibit-startup-message t)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(set-fringe-mode 10)
(menu-bar-mode -1)
(setq visible-bell t)
(global-display-line-numbers-mode t)
(global-display-fill-column-indicator-mode t)
(set-fill-column 80)
(column-number-mode t)
(setq-default truncate-lines t)
(prefer-coding-system 'utf-8)
(set-face-attribute 'default nil :font "FiraCode Nerd Font" :height 120)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(use-package lsp-mode
:commands (lsp lsp-deferred)
:init
(setq lsp-keymap-prefix "C-c l"
lsp-semantic-tokens-enable t))
(use-package company
:config
(global-company-mode 1)
(setq company-minimum-prefix-length 1
company-idle-delay 0.0))
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
(with-eval-after-load 'lsp-mode
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection '("typescript-language-server" "--stdio"))
:activation-fn (lambda (filename _)
(or (string-suffix-p ".ts" filename)
(string-suffix-p ".tsx" filename)
(string-suffix-p ".vue" filename)))
:priority 1
:add-on? t
:server-id 'ts-ls)))
(with-eval-after-load 'lsp-mode
(add-hook 'typescript-ts-mode-hook #'lsp-deferred)
(add-hook 'tsx-ts-mode-hook #'lsp-deferred))
(use-package vue-mode
:mode "\\.vue\\'"
:hook (vue-mode . lsp-deferred)
:config
(setq mmm-submode-decoration-level 0))
(add-hook 'vue-mode-hook
(lambda ()
(setq-local lsp-disabled-clients '(vls))
(setq-local company-backends '(company-capf))))
(with-eval-after-load 'lsp-mode
(lsp-enable-which-key-integration t))
(use-package lsp-ui
:commands lsp-ui-mode
:hook (lsp-mode . lsp-ui-mode)
:config
(setq lsp-ui-doc-enable t
lsp-ui-doc-position 'at-point
lsp-ui-sideline-enable t))
(use-package yasnippet
:config
(yas-global-mode 1))
(use-package mmm-mode
:config
(setq mmm-global-mode 'maybe))
(use-package typescript-mode
:mode ("\\.ts\\'" . typescript-mode))
(with-eval-after-load 'vue-mode
(mmm-add-classes
'((vue-ts
:submode typescript-mode
:face mmm-code-submode-face
:front "<script[^>]*lang=[\"']ts[\"'][^>]*>"
:back "</script>")))
(mmm-add-mode-ext-class 'vue-mode nil 'vue-ts))
(setq treesit-language-source-alist
'((typescript . ("https://github.com/tree-sitter/tree-sitter-typescript"
"master" "typescript/src"))
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript"
"master" "tsx/src"))))
(use-package doom-themes)
(load-theme 'doom-dark+ t)
(use-package exec-path-from-shell
:config
:init (setq exec-path-from-shell-variables '("PATH" "MANPATH" "SSH_AUTH_SOCK" ))
(exec-path-from-shell-initialize))
(use-package ultra-scroll
:init
(setq scroll-conservatively 3
scroll-margin 0)
:config
(ultra-scroll-mode t))
(use-package rg)
(use-package magit
:config
(setq magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1))
(use-package vertico
:init
(vertico-mode))
(use-package php-mode
:init
(setq phpactor-executable (executable-find "phpactor"))
:hook ((php-mode . eglot-ensure)
(php-mode . (lambda ()
(setq-local phpactor-executable
(executable-find "phpactor"))))
(php-mode . my/php-mode-face-setup))
:mode ("\\.php\\'")
:config
(defun my/php-mode-face-setup ()
(set-face-attribute 'php-method-call-traditional nil :foreground "goldenrod")
(set-face-attribute 'php-function-call-traditional nil :foreground "#708090")))
(use-package nix-mode
(add-to-list 'eglot-server-programs '(nix-mode . ("nil")))
:hook (nix-mode . eglot-ensure)
:mode ("\\.nix\\'"))
(use-package phpactor
:after php-mode)
(use-package smartparens
:config (require 'smartparens-config)
:init (smartparens-global-mode))
(use-package diff-hl
:init (global-diff-hl-mode)
:hook (magit-post-refresh . diff-hl-magit-post-refresh))
(use-package which-key
:config (which-key-mode 1))
(use-package cape
:init
(add-to-list `completion-at-point-functions #'cape-keyword)
(add-to-list `completion-at-point-functions #'cape-file)
(add-to-list `completion-at-point-functions #'cape-emoji))
(use-package orderless
:custom (completion-styles '(orderless basic)))
(use-package marginalia
:init (marginalia-mode))
(use-package yaml-mode)
(use-package rjsx-mode
:mode ("\\.jsx\\'" "\\.js\\'")
:interpreter ("node" . rjsx-mode)
:config
(define-key rjsx-mode-map (kbd "M-.") nil)
(setq js2-strict-missing-semi-warning nil))
(use-package projectile
:init
(projectile-mode +1)
:bind (:map projectile-mode-map
("C-c p" . projectile-command-map)
("C-c C-p" . projectile-command-map)))
(use-package editorconfig
:config (editorconfig-mode 1))
(use-package dumb-jump
:config (add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("e4a702e262c3e3501dfe25091621fe12cd63c7845221687e36a79e17cf3a67e0" "aec7b55f2a13307a55517fdf08438863d694550565dee23181d2ebd973ebd6b8" default))
'(safe-local-variable-values
'((projectile-project-test-cmd . "php ./vendor/bin/phpunit --color=never --verbose")))
'(warning-suppress-types '((comp) (use-package))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)