(config) emacs: make my configuration not evil

This commit is contained in:
Sakooooo 2024-10-19 16:46:54 +04:00
parent f1df9f0609
commit 8e3d26e656
Signed by: sako
GPG key ID: FE52FD65B76E4751

View file

@ -339,141 +339,141 @@ kept-old-versions 5)
#+end_src #+end_src
** General ** General
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package general ;; (use-package general
:config ;; :config
(general-create-definer sk/leader-keys ;; (general-create-definer sk/leader-keys
:keymaps '(normal insert visual emacs) ;; :keymaps '(normal insert visual emacs)
:prefix "SPC" ;; :prefix "SPC"
:global-prefix "C-SPC") ;; :global-prefix "C-SPC")
(sk/leader-keys ;; (sk/leader-keys
;; code ;; ;; code
"c" '(:ignore c :which-key "code") ;; "c" '(:ignore c :which-key "code")
"cc" '(compile :which-key "compile") ;; "cc" '(compile :which-key "compile")
"cC" '(recompile :which-key "compile") ;; "cC" '(recompile :which-key "compile")
"cX" '(lsp-treeemacs-errors-list :which-ley "list errors") ;; "cX" '(lsp-treeemacs-errors-list :which-ley "list errors")
;; toggles ;; ;; toggles
"t" '(:ignore t :which-key "toggles") ;; "t" '(:ignore t :which-key "toggles")
"tt" '(counsel-load-theme :which-key "choose theme") ;; "tt" '(counsel-load-theme :which-key "choose theme")
"ts" '(hydra-text-scale/body :which-key "scale text") ;; "ts" '(hydra-text-scale/body :which-key "scale text")
;; search ;; ;; search
"s" '(:ignore s :which-key "search") ;; "s" '(:ignore s :which-key "search")
"sb" '(swiper :which-key "search buffer") ;; "sb" '(swiper :which-key "search buffer")
;; insert ;; ;; insert
"i" '(:ignore i :which-key "insert") ;; "i" '(:ignore i :which-key "insert")
"ie" '(emoji-search :which-key "Emoji") ;; "ie" '(emoji-search :which-key "Emoji")
;; project ;; ;; project
"p" '(:ignore p :which-key "projects") ;; "p" '(:ignore p :which-key "projects")
"pp" '(project-switch-project :which-key "open project") ;; "pp" '(project-switch-project :which-key "open project")
"pk" '(project-kill-buffers :which-key "close project") ;; "pk" '(project-kill-buffers :which-key "close project")
"pt" '(magit-todos-list :which-key "list project todos") ;; "pt" '(magit-todos-list :which-key "list project todos")
"po" '(project-find-file :which-key "find file") ;; "po" '(project-find-file :which-key "find file")
"pc" '(project-compile :which-key "compile project") ;; "pc" '(project-compile :which-key "compile project")
;; open ;; ;; open
"o" '(:ignore o :which-key "open") ;; "o" '(:ignore o :which-key "open")
"op" '(treemacs :which-key "treemacs") ;; "op" '(treemacs :which-key "treemacs")
"oP" '(treemacs-find-file :which-key "treemacs find file") ;; "oP" '(treemacs-find-file :which-key "treemacs find file")
"oe" '(eshell :which-key "eshell") ;; "oe" '(eshell :which-key "eshell")
"ov" '(vterm :which-key "vterm") ;; "ov" '(vterm :which-key "vterm")
"or" '(elfeed :which-key "rss") ;; "or" '(elfeed :which-key "rss")
;; notes ;; ;; notes
"n" '(:ignore o :which-key "notes") ;; "n" '(:ignore o :which-key "notes")
"na" '(org-agenda :which-key "agenda") ;; "na" '(org-agenda :which-key "agenda")
"nf" '(org-roam-node-find :which-key "find node") ;; "nf" '(org-roam-node-find :which-key "find node")
"nc" '(org-capture :which-key "capture") ;; "nc" '(org-capture :which-key "capture")
"np" '(org-pomodoro :which-key "pomodoro") ;; "np" '(org-pomodoro :which-key "pomodoro")
"ne" '(:ignore ne :which-key "export") ;; "ne" '(:ignore ne :which-key "export")
"nep" '(org-latex-export-to-pdf :which-key "pdf") ;; "nep" '(org-latex-export-to-pdf :which-key "pdf")
;; quit ;; ;; quit
"q" '(:ignore q :which-key "quit") ;; "q" '(:ignore q :which-key "quit")
"qq" '(delete-frame :which-key "close emacs") ;; "qq" '(delete-frame :which-key "close emacs")
"qK" '(kill-emacs :which-key "quit emacs") ;; "qK" '(kill-emacs :which-key "quit emacs")
;; git ;; ;; git
"g" '(:ignore g :which-key "git") ;; "g" '(:ignore g :which-key "git")
"gs" '(magit-status :which-key "status") ;; "gs" '(magit-status :which-key "status")
"gc" '(:ignore gc :which-key "create") ;; "gc" '(:ignore gc :which-key "create")
"gcr" '(magit-init :which-key "init repo") ;; "gcr" '(magit-init :which-key "init repo")
"gcR" '(magit-clone :which-key "clone repo") ;; "gcR" '(magit-clone :which-key "clone repo")
"gcc" '(magit-commit-create :which-key "commit") ;; "gcc" '(magit-commit-create :which-key "commit")
"gci" '(forge-create-issue :which-key "issue") ;; "gci" '(forge-create-issue :which-key "issue")
"gcp" '(forge-create-pullreq :which-key "pull request") ;; "gcp" '(forge-create-pullreq :which-key "pull request")
;; mail ;; ;; mail
"m" '(mu4e :which-key "mu4e"))) ;; "m" '(mu4e :which-key "mu4e")))
#+end_src #+end_src
** Evil ** Evil
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package evil ;; (use-package evil
:init ;; :init
;; Pre-load configuration ;; ;; Pre-load configuration
(setq evil-want-integration t) ;; (setq evil-want-integration t)
(setq evil-want-keybinding nil) ;; (setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t) ;; (setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil) ;; (setq evil-want-C-i-jump nil)
(setq evil-respect-visual-line-mode t) ;; (setq evil-respect-visual-line-mode t)
(setq evil-undo-system 'undo-tree) ;; (setq evil-undo-system 'undo-tree)
:config ;; :config
(evil-mode 1) ;; (evil-mode 1)
;; use emacs state for these mods ;; ;; use emacs state for these mods
(dolist (mode '(custom-mode ;; (dolist (mode '(custom-mode
eshell-mode ;; eshell-mode
git-rebase-mode ;; git-rebase-mode
erc-mode ;; erc-mode
circe-server-mode ;; circe-server-mode
circe-chat-mode ;; circe-chat-mode
circe-query-mode ;; circe-query-mode
term-mode)) ;; term-mode))
(add-to-list 'evil-emacs-state-modes mode)) ;; (add-to-list 'evil-emacs-state-modes mode))
(defun sk/dont-arrow-me-bro () ;; (defun sk/dont-arrow-me-bro ()
(interactive) ;; (interactive)
(message "STOP USING THE ARROW KEYS!!!!!!!!!!!!!!!!!!!!!!!")) ;; (message "STOP USING THE ARROW KEYS!!!!!!!!!!!!!!!!!!!!!!!"))
;; Disable arrow keys in normal and visual modes ;; ;; Disable arrow keys in normal and visual modes
(define-key evil-normal-state-map (kbd "<left>") 'sk/dont-arrow-me-bro) ;; (define-key evil-normal-state-map (kbd "<left>") 'sk/dont-arrow-me-bro)
(define-key evil-normal-state-map (kbd "<right>") 'sk/dont-arrow-me-bro) ;; (define-key evil-normal-state-map (kbd "<right>") 'sk/dont-arrow-me-bro)
(define-key evil-normal-state-map (kbd "<down>") 'sk/dont-arrow-me-bro) ;; (define-key evil-normal-state-map (kbd "<down>") 'sk/dont-arrow-me-bro)
(define-key evil-normal-state-map (kbd "<up>") 'sk/dont-arrow-me-bro) ;; (define-key evil-normal-state-map (kbd "<up>") 'sk/dont-arrow-me-bro)
(evil-global-set-key 'motion (kbd "<left>") 'sk/dont-arrow-me-bro) ;; (evil-global-set-key 'motion (kbd "<left>") 'sk/dont-arrow-me-bro)
(evil-global-set-key 'motion (kbd "<right>") 'sk/dont-arrow-me-bro) ;; (evil-global-set-key 'motion (kbd "<right>") 'sk/dont-arrow-me-bro)
(evil-global-set-key 'motion (kbd "<down>") 'sk/dont-arrow-me-bro) ;; (evil-global-set-key 'motion (kbd "<down>") 'sk/dont-arrow-me-bro)
(evil-global-set-key 'motion (kbd "<up>") 'sk/dont-arrow-me-bro) ;; (evil-global-set-key 'motion (kbd "<up>") 'sk/dont-arrow-me-bro)
(evil-set-initial-state 'messages-buffer-mode 'normal) ;; (evil-set-initial-state 'messages-buffer-mode 'normal)
(evil-set-initial-state 'dashboard-mode 'normal)) ;; (evil-set-initial-state 'dashboard-mode 'normal))
(use-package evil-collection ;; (use-package evil-collection
:after evil ;; :after evil
:custom ;; :custom
(evil-collection-outline-bind-tab-p nil) ;; (evil-collection-outline-bind-tab-p nil)
:config ;; :config
;; Is this a bug in evil-collection? ;; ;; Is this a bug in evil-collection?
(setq evil-collection-company-use-tng nil) ;; (setq evil-collection-company-use-tng nil)
(delete 'lispy evil-collection-mode-list) ;; (delete 'lispy evil-collection-mode-list)
(delete 'org-present evil-collection-mode-list) ;; (delete 'org-present evil-collection-mode-list)
;; (delete 'mu4e evil-collection-mode-list) ;; ;; (delete 'mu4e evil-collection-mode-list)
;; (delete 'mu4e-conversation evil-collection-mode-list) ;; ;; (delete 'mu4e-conversation evil-collection-mode-list)
(evil-collection-init)) ;; (evil-collection-init))
(use-package evil-org ;; (use-package evil-org
:after (evil org) ;; :after (evil org)
:hook ((org-mode . evil-org-mode) ;; :hook ((org-mode . evil-org-mode)
(org-agenda-mode . evil-org-mode)) ;; (org-agenda-mode . evil-org-mode))
:config ;; :config
(require 'evil-org-agenda) ;; (require 'evil-org-agenda)
(evil-org-set-key-theme '(navigation todo insert textobjects additional)) ;; (evil-org-set-key-theme '(navigation todo insert textobjects additional))
(evil-org-agenda-set-keys)) ;; (evil-org-agenda-set-keys))
(use-package evil-nerd-commenter ;; (use-package evil-nerd-commenter
:bind ("M-/" . evilnc-comment-or-uncomment-lines)) ;; :bind ("M-/" . evilnc-comment-or-uncomment-lines))
(with-eval-after-load 'org ;; (with-eval-after-load 'org
(evil-define-key '(normal insert visual) org-mode-map (kbd "C-j") 'org-next-visible-heading) ;; (evil-define-key '(normal insert visual) org-mode-map (kbd "C-j") 'org-next-visible-heading)
(evil-define-key '(normal insert visual) org-mode-map (kbd "C-k") 'org-previous-visible-heading) ;; (evil-define-key '(normal insert visual) org-mode-map (kbd "C-k") 'org-previous-visible-heading)
(evil-define-key '(normal insert visual) org-mode-map (kbd "M-j") 'org-metadown) ;; (evil-define-key '(normal insert visual) org-mode-map (kbd "M-j") 'org-metadown)
(evil-define-key '(normal insert visual) org-mode-map (kbd "M-k") 'org-metaup)) ;; (evil-define-key '(normal insert visual) org-mode-map (kbd "M-k") 'org-metaup))
#+end_src #+end_src
* Interface * Interface
#+begin_src emacs-lisp #+begin_src emacs-lisp