Emacs : use undo tree, and keybindings

This commit is contained in:
2023-01-14 14:03:10 +09:00
parent a15e7437bd
commit 5ee0a142c7

View File

@ -1,4 +1,5 @@
#+title: Emacs Configuration
#+AUTHOR: JaeYoo-Im, (cpu3792@gmail.com)
* Basic Configuration
Emacs Configuration for emacs 29.50
@ -359,19 +360,6 @@ emacs built-in package config
doom-modeline-indent-info t)
(doom-modeline-mode 1)
#+end_src
**** Whiteroom
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
;;(use-package writeroom-mode
;; :defer t
;; :straight (:build t)
;; :init (global-writeroom-mode 1)
;; :config
;; (setq writeroom-width 100
;; writeroom-fullscreen-effect nil
;; writeroom-maximize-window nil
;; writeroom-mode-line t
;; writeroom-major-modes '(text-mode org-mode markdown-mode nov-mode Info-mode)))
#+end_src
**** Visual Fill Column
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
(require 'visual-fill-column)
@ -466,7 +454,7 @@ emacs built-in package config
(usr-package-install 'evil-collection)
(usr-package-install 'evil-nerd-commenter)
(usr-package-install 'evil-numbers)
;;(usr-package-install 'undo-tree)
(usr-package-install 'undo-tree)
(usr-package-install 'hydra)
#+end_src
**** Global Key
@ -518,18 +506,8 @@ for managing keybindings.
"f o p" '((lambda () (interactive) (find-file (expand-file-name "~/org/example/emacs_my_previous.org"))) :which-key "open exwm config")
"f o e" '((lambda () (interactive) (find-file (expand-file-name "~/org/example/emacs_another.org"))) :which-key "open exwm config")
"f o c" '((lambda () (interactive) (find-file (expand-file-name "~/.config/emacs/emacs.org"))) :which-key "open emacs config")
;; Hydra
"h" '(:ignore t :which-key "hydra")
"h t" '(hydra-text-scale/body :which-key "scale text")
"h w" '(hydra-writeroom-scale/body :which-key "scale whiteroom")
"h a" '(hydra-modify-alpha/body :which-key "modify alpha background")
;; Insert something
"i" '(:ignore t :which-key "insert something.")
"i s" '(yas-insert-snippet :which-key "snippet")
"i e" '(emojify-insert-emoji :which-key "emoji")
;; Magit
"g" '(:ignore t :which-key "magit")
"g g" '(magit :which-key "magit")
;; Project-el
"p" '(:ignore t :which-key "project")
"p ." '(project-switch-project :which-key "switch project")
@ -541,7 +519,6 @@ for managing keybindings.
"p e" '(project-eshell :which-key "eshell")
"p d" '(project-dired :which-key "dired")
"p g" '(project-find-regexp :which-key "find-regexp")
;; Extra
"t" '(:ignore t :which-key "extra")
"t a" '(toggle-transparency :which-key "Toggle Transparency")
@ -562,7 +539,8 @@ for managing keybindings.
;; Make evil search more like vim
;;(evil-select-search-module 'evil-search-module 'evil-search)
(evil-set-undo-system 'undo-redo)
(evil-set-undo-system 'undo-tree)
;;(evil-set-undo-system 'undo-redo)
(evil-set-initial-state 'messages-buffer-mode 'normal)
(evil-set-initial-state 'dashboard-mode 'normal)
@ -589,15 +567,15 @@ for managing keybindings.
#+end_src
**** Undo Tree
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
;;(require 'undo-tree)
;;(setq undo-tree-visualizer-diff t
;; undo-tree-visualizer-timestamps t
;; undo-tree-auto-save-history t
;; undo-tree-enable-undo-in-region t
;; undo-limit (* 800 1024)
;; undo-strong-limit (* 12 1024 1024)
;; undo-outer-limit (* 128 1024 1024))
;;(global-undo-tree-mode)
(require 'undo-tree)
(setq undo-tree-visualizer-diff t
undo-tree-visualizer-timestamps t
undo-tree-auto-save-history t
undo-tree-enable-undo-in-region t
undo-limit (* 800 1024)
undo-strong-limit (* 12 1024 1024)
undo-outer-limit (* 128 1024 1024))
(global-undo-tree-mode)
#+end_src
**** Hydra
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
@ -617,6 +595,12 @@ for managing keybindings.
("s" my/decrease-frame-alpha-background "decrease alpha")
("t" my/increase-frame-alpha-background "increase alpha")
("q" nil "finished" :exit t))
(ju/leader-key-def
;; Hydra
"h" '(:ignore t :which-key "hydra")
"h t" '(hydra-text-scale/body :which-key "scale text")
"h w" '(hydra-writeroom-scale/body :which-key "scale whiteroom")
"h a" '(hydra-modify-alpha/body :which-key "modify alpha background"))
#+end_src
**** Provide Modules
@ -786,6 +770,10 @@ get link from pdf,
;; ;;:custom
(setq magit-clone-default-directory "~/Project/"
magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
(ju/leader-key-def
;; Magit
"g" '(:ignore t :which-key "magit")
"g g" '(magit :which-key "magit"))
#+end_src
**** Gitgutter
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
@ -956,6 +944,9 @@ speed-up insertion of environments and math templates.
(usr-package-install 'pdf-view-restore)
(usr-package-install 'nov)
(usr-package-install 'emojify)
(usr-package-install 'avy)
(usr-package-install 'yasnippet)
(usr-package-install 'yasnippet-snippets)
#+end_src
**** Helpful
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
@ -968,11 +959,29 @@ speed-up insertion of environments and math templates.
(global-set-key [remap describe-variable] #'describe-variable)
(global-set-key [remap describe-key] #'helpful-key)
#+end_src
**** Avy
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
(ju/leader-key-def
"v" '(:ignore t :which-key "Avy")
"vc" '(avy-goto-char :which-key "Avy Goto Char")
"vw" '(avy-goto-word-0 :which-key "Avy Goto Word")
"vl" '(avy-goto-line :which-key "Avy Goto Line"))
#+end_src
**** Snippet
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
(defvar yas-snippet-dirs nil)
(add-hook 'prog-mode-hook #'yas-minor-mode)
(add-to-list 'yas-snippet-dirs "~/.config/emacs/snippets")
(yas-global-mode 1)
(ju/leader-key-def
"i s" '(yas-insert-snippet :which-key "snippet"))
#+end_src
**** Emojify
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
(global-emojify-mode 1)
(ju/leader-key-def
"i e" '(emojify-insert-emoji :which-key "emoji"))
#+end_src
**** PDF Tool
enhanced PDF viewer on emacs
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el