customizing

This commit is contained in:
JensJeBecker
2026-03-04 21:22:21 +01:00
parent b99a679a76
commit a31593b259

68
init.el
View File

@@ -215,7 +215,7 @@
(create-lockfiles nil) ;; Prevent the creation of lock files when editing.
(delete-by-moving-to-trash t) ;; Move deleted files to the trash instead of permanently deleting them.
(delete-selection-mode 1) ;; Enable replacing selected text with typed text.
(display-line-numbers-type 'relative) ;; Use relative line numbering in programming modes.
(display-line-numbers-type 'absolute) ;; Use absolute line numbering in programming modes.
(global-auto-revert-non-file-buffers t) ;; Automatically refresh non-file buffers.
(history-length 25) ;; Set the length of the command history.
(indent-tabs-mode nil) ;; Disable the use of tabs for indentation (use spaces instead).
@@ -252,10 +252,10 @@
;; Configure font settings based on the operating system.
;; Ok, this kickstart is meant to be used on the terminal, not on GUI.
;; But without this, I fear you could start Graphical Emacs and be sad :(
(set-face-attribute 'default nil :family "JetBrainsMono Nerd Font" :height 100)
(set-face-attribute 'default nil :family "JetBrainsMono NFM" :height 150)
(when (eq system-type 'darwin) ;; Check if the system is macOS.
(setq mac-command-modifier 'meta) ;; Set the Command key to act as the Meta key.
(set-face-attribute 'default nil :family "JetBrainsMono Nerd Font" :height 130))
(set-face-attribute 'default nil :family "JetBrainsMono NFM" :height 150))
;; Save manual customizations to a separate file instead of cluttering `init.el'.
;; You can M-x customize, M-x customize-group, or M-x customize-themes, etc.
@@ -1024,19 +1024,19 @@
;; Custom example. Formatting with prettier tool.
(evil-define-key 'normal 'global (kbd "<leader> m p")
(lambda ()
(interactive)
(shell-command (concat "prettier --write " (shell-quote-argument (buffer-file-name))))
(revert-buffer t t t)))
(lambda ()
(interactive)
(shell-command (concat "prettier --write " (shell-quote-argument (buffer-file-name))))
(revert-buffer t t t)))
;; LSP commands keybindings
(evil-define-key 'normal lsp-mode-map
;; (kbd "gd") 'lsp-find-definition ;; evil-collection already provides gd
(kbd "gr") 'lsp-find-references ;; Finds LSP references
(kbd "<leader> c a") 'lsp-execute-code-action ;; Execute code actions
(kbd "<leader> r n") 'lsp-rename ;; Rename symbol
(kbd "gI") 'lsp-find-implementation ;; Find implementation
(kbd "<leader> l f") 'lsp-format-buffer) ;; Format buffer via lsp
;; (kbd "gd") 'lsp-find-definition ;; evil-collection already provides gd
(kbd "gr") 'lsp-find-references ;; Finds LSP references
(kbd "<leader> c a") 'lsp-execute-code-action ;; Execute code actions
(kbd "<leader> r n") 'lsp-rename ;; Rename symbol
(kbd "gI") 'lsp-find-implementation ;; Find implementation
(kbd "<leader> l f") 'lsp-format-buffer) ;; Format buffer via lsp
(defun ek/lsp-describe-and-jump ()
@@ -1053,20 +1053,24 @@
(evil-define-key 'normal 'global (kbd "K")
(if (>= emacs-major-version 31)
#'eldoc-box-help-at-point
#'ek/lsp-describe-and-jump))
#'ek/lsp-describe-and-jump))
;; Commenting functionality for single and multiple lines
(evil-define-key 'normal 'global (kbd "gcc")
(lambda ()
(interactive)
(if (not (use-region-p))
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))))
(lambda ()
(interactive)
(if (not (use-region-p))
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))))
(evil-define-key 'visual 'global (kbd "gc")
(lambda ()
(interactive)
(if (use-region-p)
(comment-or-uncomment-region (region-beginning) (region-end)))))
(lambda ()
(interactive)
(if (use-region-p)
(comment-or-uncomment-region (region-beginning) (region-end)))))
(evil-define-key 'normal 'global (kbd "C-s") #'write-file)
(evil-define-key 'normal 'global (kbd "C-SPC") #'completion-at-point)
;; Enable evil mode
(evil-mode 1))
@@ -1120,6 +1124,24 @@
(global-evil-matchit-mode 1))
;; FLASH
;; like flash.nvim
(use-package flash
:commands (flash-jump flash-jump-continue
flash-treesitter)
;; :bind ("s-j" . flash-jump)
:custom
(flash-multi-window t)
:init
;; Evil integration (simple setup)
(with-eval-after-load 'evil
(require 'flash-evil)
(flash-evil-setup t)) ; t = also set up f/t/F/T char motions
:config
;; Search integration (labels during C-s, /, ?)
(require 'flash-isearch)
(flash-isearch-mode 1))
;; UNDO TREE
;; The `undo-tree' package provides an advanced and visual way to
;; manage undo history. It allows you to navigate and visualize your
@@ -1144,7 +1166,7 @@
:config
;; Set the directory where `undo-tree' will save its history files.
;; This keeps undo history across sessions, stored in a cache directory.
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/.cache/undo"))))
(setq undo-tree-history-directory-alist '(("." . "~/.config/emacs/.cache/undo"))))
;;; RAINBOW DELIMITERS