Emacs and evil changes
This commit is contained in:
parent
52089c3306
commit
5b1c3940d9
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
@ -267,10 +268,10 @@ Better functions for some of the defaults.
|
|||||||
`I` ignore binary files; `E` extended regular expressions; `r` recursive"
|
`I` ignore binary files; `E` extended regular expressions; `r` recursive"
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((grep-flags "-inrEI --color=always -C3")
|
(let* ((grep-flags "-inrEI --color=always -C3")
|
||||||
(search-term (read-string (format "Recursive regex search with grep %s: " grep-flags)))
|
(search-term (read-string (format "Recursive regex search with grep %s: " grep-flags)))
|
||||||
(search-path (directory-file-name (expand-file-name (read-directory-name "directory: "))))
|
(search-path (directory-file-name (expand-file-name (read-directory-name "directory: "))))
|
||||||
(default-directory (file-name-as-directory search-path))
|
(default-directory (file-name-as-directory search-path))
|
||||||
(grep-command (concat grep-program " " grep-flags " " search-term " " search-path)))
|
(grep-command (concat grep-program " " grep-flags " " search-term " " search-path)))
|
||||||
(compilation-start grep-command 'grep-mode (lambda (mode) "*grep*") nil)))
|
(compilation-start grep-command 'grep-mode (lambda (mode) "*grep*") nil)))
|
||||||
|
|
||||||
;; Open External Terminal Emulator
|
;; Open External Terminal Emulator
|
||||||
@ -380,10 +381,11 @@ Set settings as well as load EVIL and complementary packages.
|
|||||||
(setq evil-ex-visual-char-range t)
|
(setq evil-ex-visual-char-range t)
|
||||||
(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,31 +536,39 @@ 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)
|
||||||
;; https://orgmode.org/
|
;; https://orgmode.org/
|
||||||
(use-package org
|
(use-package org
|
||||||
:straight nil
|
:straight nil
|
||||||
:config
|
:config
|
||||||
'(org-export-backends '(ascii html icalendar latex man md odt org))
|
'(org-export-backends '(ascii html icalendar latex man md odt org))
|
||||||
(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-clock-persist 'history)
|
(setq org-html-htmlize-output-type 'css)
|
||||||
(setq org-agenda-files (list "~/Documents/notes/org/life.org"))
|
(setq org-clock-persist 'history)
|
||||||
(org-clock-persistence-insinuate)
|
(setq org-agenda-files (list "~/Documents/notes/org/life.org"))
|
||||||
(setq org-todo-keywords '((sequence "TODO(!)" "IN PROGRESS" "DONE")))
|
(org-clock-persistence-insinuate)
|
||||||
(setq org-treat-insert-todo-heading-as-state-change t)
|
(setq org-todo-keywords '((sequence "TODO(!)" "IN PROGRESS" "DONE")))
|
||||||
(setq org-log-done t)
|
(setq org-treat-insert-todo-heading-as-state-change t)
|
||||||
(evil-define-key 'normal org-mode-map
|
(setq org-log-done t)
|
||||||
(kbd "SPC TAB") 'org-todo
|
(evil-define-key 'normal org-mode-map
|
||||||
">" 'org-shiftmetaright
|
(kbd "SPC TAB") 'org-todo
|
||||||
"<" 'org-shiftmetaleft))
|
">" 'org-shiftmetaright
|
||||||
|
"<" '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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user