From 4a6c7d49aef2b921e15c80635d1e04ff599e03d5 Mon Sep 17 00:00:00 2001 From: Julius Klotz Date: Fri, 29 Aug 2025 12:42:57 +0200 Subject: [PATCH] added basic emacs evil stuff --- emacs/init.el | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index eaeb637..0c6fa44 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -3,9 +3,16 @@ (tooltip-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1) +(setq ring-bell-function 'ignore) (global-display-line-numbers-mode 1) +(dolist (mode '(org-mode-hook + shell-mode-hook + term-mode-hook + eshell-mode-hook)) + (add-hook mode (lambda () (display-line-numbers-mode 0)))) + (set-face-attribute 'default nil :font "JetBrains Mono" :height 130) (load-theme 'leuven-dark) @@ -51,7 +58,9 @@ ;; 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. - '(package-selected-packages '(doom-modeline ivy swiper))) + '(package-selected-packages + '(all-the-icons counsel doom-modeline doom-themes evil evil-collection + general helpful ivy ivy-rich swiper))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -62,3 +71,81 @@ (use-package doom-modeline :ensure t :hook (after-init . doom-modeline-mode)) + +(use-package which-key + :init (which-key-mode) + :diminish which-key-mode + :config + (setq which-key-idle-delay 0.3)) + +(use-package ivy-rich + :init + (ivy-rich-mode 1)) + +(use-package counsel + :bind (("M-x" . counsel-M-x) + ("C-x b" . counsel-ibuffer) + ("C-x C-f" . counsel-find-file) + :map minibuffer-local-map + ("C-r" . counsel-minibuffer-history)) + :config + (setq ivi-initial-inputs-alist nil)) + +(use-package helpful + :commands (helpful-callable helpful-variable helpful-command helpful-key) + :custom + (counsel-describe-function-function #'helpful-callable) + (counsel-describe-variable-function #'helpful-variable) + :bind + ([remap describe-function] . counsel-describe-function) + ([remap describe-command] . helpful-command) + ([remap describe-variable] . counsel-describe-variable) + ([remap describe-key] . helpful-key)) + +(use-package doom-themes + :init (load-theme 'doom-palenight t)) +;; run M-x all-the-icons-install-fonts once on new machine +(use-package all-the-icons) + + +(use-package general + :config + (general-create-definer rune/leader-keys + :keymaps '(normal insert visual emacs) + :prefix "SPC" + :global-prefix "C-SPC") + + (rune/leader-keys + "f" '(:ignore t :which-key "find") + "ff" '(counsel-find-file :which-key "find file") + "t" '(:ignore t :which-key "toggles") + "tt" '(counsel-load-theme :which-key "choose theme"))) + +(general-define-key + "C-s" 'counsel-grep-or-swiper) + + +(use-package evil + :init + (setq evil-want-integration t) + (setq evil-want-keybinding nil) + (setq evil-want-C-u-scroll t) + (setq evil-want-C-i-jump nil) + :config + (evil-mode 1) + (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) + (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) + + ;; Use visual line motions even outside of visual-line-mode buffers + (evil-global-set-key 'motion "j" 'evil-next-visual-line) + (evil-global-set-key 'motion "k" 'evil-previous-visual-line) + + (evil-set-initial-state 'messages-buffer-mode 'normal) + (evil-set-initial-state 'dashboard-mode 'normal)) + +(use-package evil-collection + :after evil + :config + (evil-collection-init)) + +