emacs/init.el
marco 5c967dca79 CHANGE 22 drones
Update auto-compile       to  1.8.2-1-g945f4eb
Update compat             to  29.1.4.2-8-g75d0b85
Update consult            to  0.35-13-g40607fb
Update consult-notes      to  006b209
Update corfu              to  0.38-7-gcc244c5
Update denote             to  5a9645b
Update ef-themes          to  559de2d
Update embark             to  0.21-165-g46fb2f8
Update epkg               to v3.3.3-81-gb22da65
Update evil               to  1.14.0-387-gd6d2e5d
Update evil-collection    to  0.0.9-32-g8be4b75
Update llama              to v0.3.1-1-ga938ac0
Update magit              to v3.3.0-742-ga3b9b007
Assimilate ob-restclient       ded3b7e
Update org                to release_9.6.8-746-g234650af2
Assimilate puppet-mode         0.4-13-g71bcd38
Update rainbow-delimiters to  2.1.5-3-gf40ece5
Assimilate restclient          0ba7281
Update transient          to v0.4.3-5-g361d8ac
Update vertico            to  1.4-21-g5780fac
Update which-key          to v3.6.0-20-g4d20bc8
Update with-editor        to v3.3.2
2023-09-05 23:51:40 +02:00

313 lines
8.1 KiB
EmacsLisp

;; -*- lexical-binding: t -*-
(progn
(setq inhibit-startup-buffer-menu t)
(setq inhibit-startup-screen t)
(setq initial-buffer-choice t)
(setq initial-scratch-message "")
(setq confirm-kill-emacs 'yes-or-no-p)
(scroll-bar-mode 0)
(tool-bar-mode 0)
(menu-bar-mode 0)
(setq ns-use-proxy-icon nil)
(setq frame-title-format nil)
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(setq isearch-allow-scroll t)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq show-trailing-whitespace t)
(setq backup-by-copying t)
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(defalias 'go-mode 'go-ts-mode)
(defalias 'gomod-mode 'go-mod-ts-mode)
(defvar modus-themes-italic-constructs t)
(defvar modus-themes-bold-constructs nil)
(defvar modus-themes-mode-line '(borderless accented))
(defvar modus-themes-region '(bg-only no-extend))
(load-theme 'modus-vivendi t)
(global-display-line-numbers-mode))
(eval-and-compile
(add-to-list 'load-path (expand-file-name "lib/borg/" user-emacs-directory))
(require 'borg)
(borg-initialize))
(use-package auto-compile
:config
(setq auto-compile-display-buffer nil)
(setq auto-compile-mode-line-counter t)
(setq auto-compile-source-recreate-deletes-dest t)
(setq auto-compile-toggle-deletes-nonlib-dest t))
(use-package epkg
:defer t
:init
(setq epkg-repository (expand-file-name "var/epkgs/" user-emacs-directory)))
(use-package dash
:config (global-dash-fontify-mode))
(use-package server
:commands (server-running-p)
:config (or (server-running-p) (server-mode)))
(use-package magit
:defer t
:commands (magit-add-section-hook)
:config
(magit-add-section-hook 'magit-status-sections-hook
'magit-insert-modules
'magit-insert-stashes
'append))
(use-package evil
:hook (after-init . evil-mode)
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(evil-mode t)
:config
(evil-set-initial-state 'shell-mode 'normal)
(evil-set-initial-state 'doc-view-mode 'normal)
(evil-set-initial-state 'package-menu-mode 'normal)
(evil-set-initial-state 'biblio-selection-mode 'motion)
(evil-global-set-key 'motion "gs" 'tab-bar-switch-to-tab)
(setq doc-view-continuous t))
(use-package evil-collection
:after evil
:init
(evil-collection-init))
(use-package org
:config
(setq org-confirm-babel-evaluate nil)
(setq org-export-use-babel nil)
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(plantuml . t)
(restclient . t)
(C . t)
(java . t)
(shell . t)
(sql . t)
(go . t)
(python . t))))
(use-package vertico
:init
(vertico-mode))
(use-package orderless
:init
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((eglot (styles orderless)) (file (styles partial-completion)))))
(use-package consult
:config
(defun find-fd (&optional dir initial)
(interactive "P")
(let ((consult-find-args "fzf -e"))
(consult-find dir initial)))
(autoload 'projectile-project-root "projectile")
(setq consult-project-root-function #'projectile-project-root))
(use-package embark)
(use-package embark-consult
:hook
(embark-collect-mode . consult-preview-at-point-mode))
(use-package marginalia
:custom
(marginalia-align 'right)
:init
(marginalia-mode))
(use-package which-key
:init (which-key-mode t))
(use-package general
:after which-key
:config
(general-override-mode t)
(general-auto-unbind-keys)
(general-define-key
:keymaps 'key-translation-map
"ESC" (kbd "C-g"))
(general-def
"C-x x" 'eval-defun)
(general-create-definer tyrant-def
:states '(normal visual insert motion emacs)
:prefix "SPC"
:non-normal-prefix "C-SPC")
(tyrant-def
"" nil
"SPC" (general-simulate-key "M-x")
"c" (general-simulate-key "C-c")
"h" (general-simulate-key "C-h")
"u" (general-simulate-key "C-u")
"x" (general-simulate-key "C-x")
"w" (general-simulate-key "C-w")
":" 'shell-command
"git" 'magit
"rg" 'consult-ripgrep
"fzf" 'consult-find
"em" '(:ignore t :which-key "emacs")
"emr" (lambda ()
(interactive)
(load-file user-init-file))
"emd" (lambda ()
(interactive)
(find-file user-init-file))
"th" '(:ignore t :which-key "themes")
"ths" 'consult-theme
"ta" '(:ignore t :which-key "tabs")
"tac" 'tab-new
"taq" 'tab-close
"tar" 'tab-rename
"b" '(:ignore t :which-key "buffers")
"bl" 'switch-to-buffer
"bd" 'kill-this-buffer
"f" '(:ignore t :which-key "files")
"ff" 'find-file
"fr" 'rename-file-and-buffer
"p" '(:ignore t :which-key "projects")
"pf" 'projectile-find-file
"pp" 'projectile-switch-project
"pb" 'projectile-switch-to-buffer
"o" '(:ignore t :which-key "org")
"oi" 'org-insert-structure-template
"odu" 'org-update-all-dblocks
"n" '(:ignore t :which-key "notes")
"nl" 'consult-notes
"x" '(:ignore t :which-key "xref")
"xr" 'xref-find-references
"xd" 'xref-find-definitions
))
(use-package corfu
:init
(global-corfu-mode))
(use-package projectile
:init
(projectile-mode t)
:config
(setq projectile-require-project-root nil)
(setq projectile-find-dir-includes-top-level t)
(setq projectile-project-search-path '(
"~/work/ost/"
"~/work/private"
)))
(use-package denote
:config
(setq denote-directory (expand-file-name "~/denote"))
(defun x/denote-journal ()
(interactive)
(let* ((today (format-time-string "%A %e %B %Y"))
(string (denote-sluggify today))
(files (denote-directory-files-matching-regexp string)))
(cond
((> (length files) 1)
(find-file (completing-read "Select file: " files nil :require-match)))
(files
(find-file (car files)))
(t
(denote
today
'("journal"))))))
(defun x/denote-append-region-to-note (beg end)
(interactive "r")
(if-let (((region-active-p))
(text (buffer-substring-no-properties beg end)))
(progn
(consult-notes)
(goto-char (point-max))
(insert text))
(user-error "No region is available")))
)
(use-package consult-notes
:config
(consult-notes-denote-mode))
(use-package rainbow-delimiters
:config
(set-face-foreground 'rainbow-delimiters-depth-1-face "#c66")
(set-face-foreground 'rainbow-delimiters-depth-2-face "#6c6")
(set-face-foreground 'rainbow-delimiters-depth-3-face "#69f")
(set-face-foreground 'rainbow-delimiters-depth-4-face "#cc6")
(set-face-foreground 'rainbow-delimiters-depth-5-face "#6cc")
(set-face-foreground 'rainbow-delimiters-depth-6-face "#c6c")
(set-face-foreground 'rainbow-delimiters-depth-7-face "#ccc")
(set-face-foreground 'rainbow-delimiters-depth-8-face "#999")
(set-face-foreground 'rainbow-delimiters-depth-9-face "#666"))
(use-package lisp-mode
:config
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode))
(use-package no-littering)
(use-package custom
:no-require t
:config
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file)))
;; http://steve.yegge.googlepages.com/my-dot-emacs-file
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "New name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file name new-name t)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))