Emacs and evil changes

This commit is contained in:
James Dixon 2025-05-25 14:04:59 -04:00
parent 52089c3306
commit 5b1c3940d9
2 changed files with 82 additions and 57 deletions

View File

@ -289,9 +289,10 @@
(setq evil-disable-insert-state-bindings t) (setq evil-disable-insert-state-bindings t)
(setq evil-insert-state-cursor '(box "violet") (setq evil-insert-state-cursor '(box "violet")
evil-normal-state-cursor '(box "yellow") evil-normal-state-cursor '(box "yellow")
evil-visual-state-cursor '(hollow "#1aa5db")) evil-visual-state-cursor '(hollow "#1aa5db")
(setq evil-want-keybinding nil) evil-emacs-state-cursor '(box "cyan"))
(setq evil-want-integration t) ;; (setq evil-want-keybinding nil)
;; (setq evil-want-integration t)
:config :config
(evil-mode 1)) (evil-mode 1))
@ -301,14 +302,14 @@
:straight t) :straight t)
;;; TODO: Look into https://codeberg.org/ideasman42/emacs-undo-fu-session ;;; TODO: Look into https://codeberg.org/ideasman42/emacs-undo-fu-session
;;; Make Evil work in more modes than by default ;; ;;; Make Evil work in more modes than by default
;; https://github.com/emacs-evil/evil-collection ;; ;; https://github.com/emacs-evil/evil-collection
(use-package evil-collection ;; (use-package evil-collection
:straight t ;; :straight t
:after evil ;; :after evil
:defer t ;; :defer t
:init ;; :init
(evil-collection-init)) ;; (evil-collection-init))
;;; Bindings and functionality to comment out code and other text objects ;;; Bindings and functionality to comment out code and other text objects
;; https://github.com/linktohack/evil-commentary ;; https://github.com/linktohack/evil-commentary
@ -337,6 +338,9 @@
(evil-define-key '(normal visual) 'global (kbd "C-a C-+") 'evil-numbers/inc-at-pt-incremental) (evil-define-key '(normal visual) 'global (kbd "C-a C-+") 'evil-numbers/inc-at-pt-incremental)
(evil-define-key '(normal visual) 'global (kbd "C-a C--") 'evil-numbers/dec-at-pt-incremental)) (evil-define-key '(normal visual) 'global (kbd "C-a C--") 'evil-numbers/dec-at-pt-incremental))
;; more ergo keybind for switching to normal<->emacs state
(global-set-key (kbd "C-;") (kbd "C-z"))
;; Custom Evil Keybinds ;; Custom Evil Keybinds
;; Evil Guide: https://github.com/noctuid/evil-guide?tab=readme-ov-file#keybindings-and-states ;; Evil Guide: https://github.com/noctuid/evil-guide?tab=readme-ov-file#keybindings-and-states
;; General keybind definition helper ;; General keybind definition helper
@ -356,6 +360,7 @@
"E" 'eval-print-last-sexp "E" 'eval-print-last-sexp
"b" 'eval-buffer "b" 'eval-buffer
"." 'repeat-complex-command "." 'repeat-complex-command
"q" 'evil-quit
"Q" 'evil-quit-all "Q" 'evil-quit-all
;; Buffer Management ;; Buffer Management
"w" 'save-buffer "w" 'save-buffer
@ -389,7 +394,7 @@
"t" 'indent-tabs-mode "t" 'indent-tabs-mode
"c" 'display-fill-column-indicator-mode) "c" 'display-fill-column-indicator-mode)
;; Global Normal Mode :: Git Keymaps ;; Global Normal Mode :: Magit Keymaps
(general-nmap (general-nmap
:prefix "SPC g" :prefix "SPC g"
;; Magit Commands ;; Magit Commands
@ -413,9 +418,8 @@
;; Custom Ex commands ;; Custom Ex commands
(evil-ex-define-cmd "Format" 'format-all-region-or-buffer) ;; format-all-code (evil-ex-define-cmd "Format" 'format-all-region-or-buffer) ;; format-all-code
;; end evil
;;; Regular Keybinds ;;; Vanilla Emacs Keybinds
(global-set-key (kbd "C-c i") (lambda () (interactive) (find-file user-init-file))) (global-set-key (kbd "C-c i") (lambda () (interactive) (find-file user-init-file)))
(global-set-key (kbd "C-c o") (lambda () (interactive) (find-file (concat user-emacs-directory "/init.org")))) (global-set-key (kbd "C-c o") (lambda () (interactive) (find-file (concat user-emacs-directory "/init.org"))))
(global-set-key (kbd "C-c d") (lambda () (interactive) (find-file (getenv "DOTFILES")))) (global-set-key (kbd "C-c d") (lambda () (interactive) (find-file (getenv "DOTFILES"))))
@ -437,6 +441,7 @@
(global-set-key (kbd "C-c a") #'org-agenda) (global-set-key (kbd "C-c a") #'org-agenda)
(global-set-key (kbd "C-c c") #'org-capture) (global-set-key (kbd "C-c c") #'org-capture)
(global-set-key (kbd "C-c l") #'org-store-link) (global-set-key (kbd "C-c l") #'org-store-link)
(setq org-html-htmlize-output-type 'css)
(setq org-clock-persist 'history) (setq org-clock-persist 'history)
(setq org-agenda-files (list "~/Documents/notes/org/life.org")) (setq org-agenda-files (list "~/Documents/notes/org/life.org"))
(org-clock-persistence-insinuate) (org-clock-persistence-insinuate)
@ -448,6 +453,13 @@
">" 'org-shiftmetaright ">" 'org-shiftmetaright
"<" 'org-shiftmetaleft)) "<" 'org-shiftmetaleft))
;; css and syntax highlighting for exported docs
(use-package htmlize
:straight t)
;; org-export packages
;; (use-package ox-pandoc
;; :straight t)
;;; Markdown support for emacs ;;; Markdown support for emacs
;; https://github.com/jrblevin/markdown-mode ;; https://github.com/jrblevin/markdown-mode
(use-package markdown-mode (use-package markdown-mode

View File

@ -1,5 +1,6 @@
#+TITLE: Emacs Literate Config #+TITLE: Emacs Literate Config
#+AUTHOR: James Dixon #+AUTHOR: James Dixon
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="https://gongzhitaao.org/orgcss/org.css"/>
* My Literate Emacs with EVIL * My Literate Emacs with EVIL
@ -381,9 +382,10 @@ Set settings as well as load EVIL and complementary packages.
(setq evil-disable-insert-state-bindings t) (setq evil-disable-insert-state-bindings t)
(setq evil-insert-state-cursor '(box "violet") (setq evil-insert-state-cursor '(box "violet")
evil-normal-state-cursor '(box "yellow") evil-normal-state-cursor '(box "yellow")
evil-visual-state-cursor '(hollow "#1aa5db")) evil-visual-state-cursor '(hollow "#1aa5db")
(setq evil-want-keybinding nil) evil-emacs-state-cursor '(box "cyan"))
(setq evil-want-integration t) ;; (setq evil-want-keybinding nil)
;; (setq evil-want-integration t)
:config :config
(evil-mode 1)) (evil-mode 1))
@ -393,14 +395,14 @@ Set settings as well as load EVIL and complementary packages.
:straight t) :straight t)
;;; TODO: Look into https://codeberg.org/ideasman42/emacs-undo-fu-session ;;; TODO: Look into https://codeberg.org/ideasman42/emacs-undo-fu-session
;;; Make Evil work in more modes than by default ;; ;;; Make Evil work in more modes than by default
;; https://github.com/emacs-evil/evil-collection ;; ;; https://github.com/emacs-evil/evil-collection
(use-package evil-collection ;; (use-package evil-collection
:straight t ;; :straight t
:after evil ;; :after evil
:defer t ;; :defer t
:init ;; :init
(evil-collection-init)) ;; (evil-collection-init))
;;; Bindings and functionality to comment out code and other text objects ;;; Bindings and functionality to comment out code and other text objects
;; https://github.com/linktohack/evil-commentary ;; https://github.com/linktohack/evil-commentary
@ -429,9 +431,11 @@ Set settings as well as load EVIL and complementary packages.
(evil-define-key '(normal visual) 'global (kbd "C-a C-+") 'evil-numbers/inc-at-pt-incremental) (evil-define-key '(normal visual) 'global (kbd "C-a C-+") 'evil-numbers/inc-at-pt-incremental)
(evil-define-key '(normal visual) 'global (kbd "C-a C--") 'evil-numbers/dec-at-pt-incremental)) (evil-define-key '(normal visual) 'global (kbd "C-a C--") 'evil-numbers/dec-at-pt-incremental))
;; more ergo keybind for switching to normal<->emacs state
(global-set-key (kbd "C-;") (kbd "C-z"))
#+end_src #+end_src
*** General Keybinds *** General Prefix/Leader Keybinds
#+begin_src emacs-lisp :tangle "init.el" #+begin_src emacs-lisp :tangle "init.el"
;; Custom Evil Keybinds ;; Custom Evil Keybinds
@ -453,6 +457,7 @@ Set settings as well as load EVIL and complementary packages.
"E" 'eval-print-last-sexp "E" 'eval-print-last-sexp
"b" 'eval-buffer "b" 'eval-buffer
"." 'repeat-complex-command "." 'repeat-complex-command
"q" 'evil-quit
"Q" 'evil-quit-all "Q" 'evil-quit-all
;; Buffer Management ;; Buffer Management
"w" 'save-buffer "w" 'save-buffer
@ -486,7 +491,7 @@ Set settings as well as load EVIL and complementary packages.
"t" 'indent-tabs-mode "t" 'indent-tabs-mode
"c" 'display-fill-column-indicator-mode) "c" 'display-fill-column-indicator-mode)
;; Global Normal Mode :: Git Keymaps ;; Global Normal Mode :: Magit Keymaps
(general-nmap (general-nmap
:prefix "SPC g" :prefix "SPC g"
;; Magit Commands ;; Magit Commands
@ -510,9 +515,8 @@ Set settings as well as load EVIL and complementary packages.
;; Custom Ex commands ;; Custom Ex commands
(evil-ex-define-cmd "Format" 'format-all-region-or-buffer) ;; format-all-code (evil-ex-define-cmd "Format" 'format-all-region-or-buffer) ;; format-all-code
;; end evil
;;; Regular Keybinds ;;; Vanilla Emacs Keybinds
(global-set-key (kbd "C-c i") (lambda () (interactive) (find-file user-init-file))) (global-set-key (kbd "C-c i") (lambda () (interactive) (find-file user-init-file)))
(global-set-key (kbd "C-c o") (lambda () (interactive) (find-file (concat user-emacs-directory "/init.org")))) (global-set-key (kbd "C-c o") (lambda () (interactive) (find-file (concat user-emacs-directory "/init.org"))))
(global-set-key (kbd "C-c d") (lambda () (interactive) (find-file (getenv "DOTFILES")))) (global-set-key (kbd "C-c d") (lambda () (interactive) (find-file (getenv "DOTFILES"))))
@ -532,7 +536,7 @@ Emacs directory editor
(setq dired-dwim-target t)) (setq dired-dwim-target t))
#+end_src #+end_src
*** Org *** Org (org-mode)
#+begin_src emacs-lisp :tangle "init.el" #+begin_src emacs-lisp :tangle "init.el"
;; Org mode (organization outline framework) ;; Org mode (organization outline framework)
@ -544,6 +548,7 @@ Emacs directory editor
(global-set-key (kbd "C-c a") #'org-agenda) (global-set-key (kbd "C-c a") #'org-agenda)
(global-set-key (kbd "C-c c") #'org-capture) (global-set-key (kbd "C-c c") #'org-capture)
(global-set-key (kbd "C-c l") #'org-store-link) (global-set-key (kbd "C-c l") #'org-store-link)
(setq org-html-htmlize-output-type 'css)
(setq org-clock-persist 'history) (setq org-clock-persist 'history)
(setq org-agenda-files (list "~/Documents/notes/org/life.org")) (setq org-agenda-files (list "~/Documents/notes/org/life.org"))
(org-clock-persistence-insinuate) (org-clock-persistence-insinuate)
@ -554,9 +559,16 @@ Emacs directory editor
(kbd "SPC TAB") 'org-todo (kbd "SPC TAB") 'org-todo
">" 'org-shiftmetaright ">" 'org-shiftmetaright
"<" 'org-shiftmetaleft)) "<" 'org-shiftmetaleft))
;; css and syntax highlighting for exported docs
(use-package htmlize
:straight t)
;; org-export packages
;; (use-package ox-pandoc
;; :straight t)
#+end_src #+end_src
*** Markdown Mode *** Markdown Mode (markdown-mode)
#+begin_src emacs-lisp :tangle "init.el" #+begin_src emacs-lisp :tangle "init.el"
;;; Markdown support for emacs ;;; Markdown support for emacs
@ -570,7 +582,7 @@ Emacs directory editor
("C-c C-e" . markdown-do))) ("C-c C-e" . markdown-do)))
#+end_src #+end_src
*** Magit *** Magit (git mode)
#+begin_src emacs-lisp :tangle "init.el" #+begin_src emacs-lisp :tangle "init.el"
;; Magit (intuitive git interface) ;; Magit (intuitive git interface)
@ -579,7 +591,7 @@ Emacs directory editor
:straight t) :straight t)
#+end_src #+end_src
*** Theme and Highlight *** Theme and Highlight (doom-themes)
#+begin_src emacs-lisp :tangle "init.el" #+begin_src emacs-lisp :tangle "init.el"
;; https://github.com/doomemacs/themes ;; https://github.com/doomemacs/themes
@ -906,4 +918,5 @@ Emacs directory editor
;; eval: (add-hook 'after-save-hook (lambda ()(if (y-or-n-p "Tangle?")(org-babel-tangle))) nil t) ;; eval: (add-hook 'after-save-hook (lambda ()(if (y-or-n-p "Tangle?")(org-babel-tangle))) nil t)
;; End: ;; End:
;;; init.el ends here ;;; init.el ends here
#+end_src #+end_src