mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
5.7 KiB
5.7 KiB
My Emacs Config
- bootstrapping
- Looks
- Functions
- Backups
- Splash Screen
- Editor
- Word wrapping
- Keybindings
- evil
- which-key
- Completion
- ivy
- Projectile
- Git
- Org-Mode
- Restart
- Customize settings
- Private Settings
bootstrapping
I've manly been following the Daniel Mai's approach to bootstrap the config.
Looks
(use-package doom-themes
:ensure t
:config (load-theme 'doom-one t))
(use-package all-the-icons)
(use-package doom-modeline
:ensure t
:hook (after-init . doom-modeline-mode))
Functions
(defun find-user-init-file ()
"Edit the `user-init-file', in another window."
(interactive)
(find-file "~/.dotfiles/emacs/.emacs.d/emacs.org"))
Backups
(setq make-backup-files nil)
(setq auto-save-default nil)
Splash Screen
(setq inhibit-startup-screen t)
(setq initial-scratch-message "; Now, go wild!")
Editor
(setq-default tab-width 4
tab-always-indent t
indent-tabs-mode nil
fill-column 80)
Word wrapping
(setq-default word-wrap t
truncate-lines t
truncate-partial-width-windows nil)
(setq sentence-end-double-space nil
delete-trailing-lines nil
require-final-newline t
tabify-regexp "^\t* [ \t]+") ; for :retab
Keybindings
- figure out how to define mode keybindings with general
(use-package general
:ensure t
:config
(general-define-key
:states '(normal visual insert emacs)
:prefix "SPC"
:non-normal-prefix "M-SPC"
"/" '(counsel-rg :wich-key "rg")
"b" '(ivy-switch-buffer :which-key "Switch Buffer")
"SPC" '(counsel-M-x :which-key "M-x")
"r" '(restart-emacs :which-key "Restart")
"g" '(:ignore t :which-key "Git")
"gg" '(magit :which-key "Magit Status")
"h" '(:ignore t :which-key "Help")
"hc" '(counsel-describe-function :which-key "Command")
"hv" '(counsel-describe-variable :which-key "Variable")
"f" '(:ignore t :which-key "Files")
"ff" '(counsel-git :which-key "find in git dir")
"fd" '(find-user-init-file :which-key "open init file")
"m" '(:ignore t :which-key "Mode")
"m'" '(org-edit-src-code :which-key "Edit code block")
))
evil
(use-package evil
:ensure t
:init
(setq evil-want-keybinding nil)
:config
(evil-mode 1)
(define-key evil-insert-state-map "jk" 'evil-normal-state))
(use-package evil-magit
:ensure t)
(use-package evil-collection
:after evil
:ensure t
:config
(evil-collection-init))
which-key
(use-package which-key
:ensure t
:init
(setq which-key-separator " ")
(setq which-key-prefix-prefix "+")
:config
(which-key-mode 1))
Completion
(use-package company
:ensure t
:init (add-hook 'after-init-hook 'global-company-mode))
ivy
(use-package ivy
:ensure t
:defer 1
:init
(setq ivy-re-builders-alist
'((counsel-ag . ivy--regex-plus)
(counsel-rg . ivy--regex-plus)
(counsel-grep . ivy--regex-plus)
(swiper . ivy--regex-plus)
(swiper-isearch . ivy--regex-plus)
))
:config
(setq ivy-height 15
ivy-wrap t
ivy-fixed-height-minibuffer t
projectile-completion-system 'ivy
; Don't use ^ as initial input
ivy-initial-inputs-alist nil
; disable magic slash on non-match
ivy-magic-slash-non-match-action nil
; don't show recent files in switch-buffer
ivy-use-virtual-buffers nil
; ...but if that ever changes, show their full path
ivy-virtual-abbreviate 'full
; don't quit minibuffer on delete-error
ivy-on-del-error-function nil
; enable ability to select prompt (alternative to `ivy-immediate-done')
ivy-use-selectable-prompt t
; use fuzzy matching
ivy-re-builders-alist '((t . ivy--regex-fuzzy)))
(ivy-mode +1))
(use-package ivy-rich
:after ivy
:ensure t
:config
(ivy-rich-mode +1))
(use-package counsel
:ensure t)
(use-package counsel-projectile
:ensure t
:defer t)
Projectile
(use-package projectile
:ensure t
:init
(setq projectile-require-project-root nil))
Git
(use-package magit
:ensure t
:bind ("C-x g" . magit-status))
(use-package forge
:ensure t)
(use-package git-gutter
:ensure t)
Org-Mode
(use-package f
:ensure t)
(use-package org
:ensure t
:config
(setq org-directory "~/org/")
(org-indent-mode t))
(use-package org-bullets
:ensure t
:config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
Restart
(use-package restart-emacs :ensure t)
Customize settings
Set up the customize file to its own separate file, instead of saving customize settings in init.el.
- TODO do not load when file is missing
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)
Private Settings
(setq user-full-name "Thomas Ruoff"
user-mail-address "thomasruoff@gmail.com"
calendar-latitude 48.286993
calendar-longitude 8.726407
calendar-location-name "Rosenfeld, Germany")